You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Adds an additional scope, subgroup, for [=uniform control flow=]
1946
+
[[#subgroup-builtin-functions|subgroup]] and
1947
+
[[#quad-builtin-functions|quad]] built-in functions to be all invocations
1948
+
in the same [=subgroup=].
1949
+
1950
+
Note: The use of subgroup and quad built-in functions requires the
1951
+
[=extension/subgroups=] extension to be enabled.
1942
1952
</table>
1943
1953
1944
1954
Note: The intent is that, over time, WGSL will define language extensions embodying all functionality in language extensions commonly supported at that time.
@@ -11275,11 +11285,20 @@ The analysis is what actually defines these concepts, and when a program is vali
11275
11285
11276
11286
For a given group of invocations:
11277
11287
- If all invocations in a given scope execute as if they are executing in lockstep at a given
11278
-
point in the program, that point is said to have <dfn noexport>uniform control flow</dfn>.
11279
-
- For a [=compute shader stage=], the scope of uniform control flow is all invocations
11280
-
in the same [=compute shader stage/workgroup=].
11281
-
- For other shader stages, the scope of uniform control flow is all invocations for that
11282
-
[=entry point=] in the same [=draw command=].
11288
+
point in the program, that point is said to have <dfn noexport>uniform control flow</dfn>
11289
+
for the given <dfn noexport>uniformity scope</dfn>.
11290
+
- <dfn noexport>Workgroup uniformity scope</dfn>: For a [=compute shader
11291
+
stage=], the uniformity scope is all invocations in the same [=compute
11292
+
shader stage/workgroup=].
11293
+
- <dfn noexport>Draw uniformity scope</dfn>: For other shader stages, the
11294
+
uniformity scope is all invocations for that [=entry point=] in the same
11295
+
[=draw command=].
11296
+
- <dfn noexport>Subgroup uniformity scope</dfn>: If the
11297
+
[=language_extension/subgroup_uniformity=] feature is supported, the
11298
+
uniformity scope for [[#subgroup-builtin-functions|subgroup]] and
11299
+
[[#quad-builtin-functions|quad]] built-in functions instead is all
11300
+
invocations in the same [=subgroup=].
11301
+
11283
11302
- If an expression is executed in uniform control flow, and all invocations compute the
11284
11303
same value, it is said to be a <dfn noexport>uniform value</dfn>.
11285
11304
- If invocations hold the same value for a local variable at every point where it is live,
@@ -11290,6 +11309,15 @@ For a given group of invocations:
11290
11309
The remaining subsections specify a static analysis that verifies that
11291
11310
[[#collective-operations|collective operations]] are only executed in [=uniform
11292
11311
control flow=].
11312
+
If the [=language_extension/subgroup_uniformity=] feature is supported then
11313
+
there are multiple [=uniformity scopes=].
11314
+
This analysis is performed once for each scope.
11315
+
11316
+
Note: The analysis is described as being executed once per scope, but
11317
+
implementations may perform a single analysis that includes each scope.
11318
+
[=Workgroup uniformity scope|Workgroup=] and [=draw uniformity scope|draw=]
11319
+
uniformity scopes are effectively equivalent since they operate on different
11320
+
shader stages and represent the largest uniformity scope in a shader stage.
11293
11321
11294
11322
The analysis assumes [=dynamic errors=] do not occur.
11295
11323
A shader stage with a [=dynamic error=] is already non-portable, no matter the outcome
@@ -12035,24 +12063,32 @@ Most built-in functions have tags of:
12035
12063
Here is the list of exceptions:
12036
12064
- A call to a function in [[#sync-builtin-functions]]:
12037
12065
- Has a [=function tag=] of [=NoRestriction=].
12038
-
- Has a [=call site tag=] of [=CallSiteRequiredToBeUniform.S|CallSiteRequiredToBeUniform.error=], with [=potential-trigger-set=]
12039
-
consisting of an unnamed [=diagnostic/triggering rule=].
12040
-
- Note: The triggering rule has no name, and so it cannot be filtered.
12041
-
- Additionally for the case of a call to [[#workgroupUniformLoad-builtin|workgroupUniformLoad]],
12066
+
- Has a [=call site tag=] of:
12067
+
- [=CallSiteRequiredToBeUniform.S|CallSiteRequiredToBeUniform.error=], with [=potential-trigger-set=]
12068
+
consisting of an unnamed [=diagnostic/triggering rule=]
12069
+
if [=language_extension/subgroup_uniformity=] is not supported or
12070
+
the [=uniformity scope=] is not subgroup.
12071
+
- Note: The triggering rule has no name, and so it cannot be filtered.
12072
+
- [=CallSiteNoRestriction=] otherwise.
12073
+
- Additionally if [=language_extension/subgroup_uniformity=] is not
12074
+
supported or the [=uniformity scope=] is not subgroup, for a
12075
+
call to [[#workgroupUniformLoad-builtin|workgroupUniformLoad]],
12042
12076
the parameter `p` has a [=parameter tag=] of [=ParameterRequiredToBeUniform.S|ParameterRequiredToBeUniform.error=],
12043
12077
with [=potential-trigger-set=] consisting of an unnamed [=diagnostic/triggering rule=].
12044
12078
- A call to a function in
12045
12079
[[#derivative-builtin-functions]], [[#texturesample]], [[#texturesamplebias]], and [[#texturesamplecompare]]:
12046
12080
- Has a [=function tag=] of [=ReturnValueMayBeNonUniform=].
12047
12081
- Has a [=call site tag=] as follows:
12048
-
- Let *DF* be the [=nearest enclosing diagnostic filter=] for the call site location and triggering rule [=trigger/derivative_uniformity=]
12049
-
- If *DF* exists, then let *S* be the *DF*'s new severity parameter.
12050
-
- If *S* is the severity [=severity/off=], the call site tag is [=CallSiteNoRestriction=].
12051
-
- Otherwise the call site tag is [=CallSiteRequiredToBeUniform.S=], with [=potential-trigger-set=]
12082
+
- If [=language_extension/subgroup_uniformity=] is not supported or the [=uniformity scope=] is not subgroup
12083
+
- Let *DF* be the [=nearest enclosing diagnostic filter=] for the call site location and triggering rule [=trigger/derivative_uniformity=]
12084
+
- If *DF* exists, then let *S* be the *DF*'s new severity parameter.
12085
+
- If *S* is the severity [=severity/off=], the call site tag is [=CallSiteNoRestriction=].
12086
+
- Otherwise the call site tag is [=CallSiteRequiredToBeUniform.S=], with [=potential-trigger-set=]
12087
+
consisting of a [=trigger/derivative_uniformity=] element.
12088
+
- If there is no such *DF*,
12089
+
the call site tag is [=CallSiteRequiredToBeUniform.S|CallSiteRequiredToBeUniform.error=], with [=potential-trigger-set=]
12052
12090
consisting of a [=trigger/derivative_uniformity=] element.
12053
-
- If there is no such *DF*,
12054
-
the call site tag is [=CallSiteRequiredToBeUniform.S|CallSiteRequiredToBeUniform.error=], with [=potential-trigger-set=]
12055
-
consisting of a [=trigger/derivative_uniformity=] element.
12091
+
- [=CallSiteNoRestriction=] otherwise.
12056
12092
- A call to [[#textureload]]:
12057
12093
- Has a [=call site tag=] of [=CallSiteNoRestriction=]
12058
12094
- Has a [=function tag=] as follows:
@@ -12061,38 +12097,58 @@ Here is the list of exceptions:
12061
12097
- [=NoRestriction=] otherwise
12062
12098
- A call to a function in
12063
12099
[[#subgroup-builtin-functions]] or [[#quad-builtin-functions]]:
12064
-
- Has a [=function tag=] of [=ReturnValueMayBeNonUniform=].
12100
+
- Has a [=function tag=] of:
12101
+
- [=NoRestriction=] if the [=uniformity scope=] is subgroup and the function is one of the following: