Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfbaf903

Browse files
authored
Add subgroup_uniformity language extension (#5431)
* Adds subgroup uniformity language* When supported uniformity analysis is performed at twice (at differentscopes)See:#5368
1 parent33fd347 commitfbaf903

File tree

1 file changed

+99
-39
lines changed

1 file changed

+99
-39
lines changed

‎wgsl/index.bs‎

Lines changed: 99 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,7 @@ The [=language extension=] names are:
14681468
* <a for=language_extension lt=pointer_composite_access>`'pointer_composite_access'`</a>
14691469
* <a for=language_extension lt=uniform_buffer_standard_layout>`'uniform_buffer_standard_layout'`</a>
14701470
* <a for=language_extension lt=subgroup_id>`'subgroup_id'`</a>
1471+
* <a for=language_extension lt=subgroup_uniformity>`'subgroup_uniformity'`</a>
14711472

14721473
### Interpolation Type Names ### {#interpolation-type-names}
14731474

@@ -1939,6 +1940,15 @@ Extension names are not [=identifiers=]: they do not [=resolves|resolve=] to [=d
19391940
Allows the use of the [=built-in values/subgroup_id=] and [=built-in
19401941
values/num_subgroups=] built-in values when the [=extension/subgroups=]
19411942
extension is enabled.
1943+
<tr><td><dfn for="language_extension">subgroup_uniformity</dfn>
1944+
<td>
1945+
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.
19421952
</table>
19431953

19441954
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
1127511285

1127611286
For a given group of invocations:
1127711287
- 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+
1128311302
- If an expression is executed in uniform control flow, and all invocations compute the
1128411303
same value, it is said to be a <dfn noexport>uniform value</dfn>.
1128511304
- 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:
1129011309
The remaining subsections specify a static analysis that verifies that
1129111310
[[#collective-operations|collective operations]] are only executed in [=uniform
1129211311
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.
1129311321

1129411322
The analysis assumes [=dynamic errors=] do not occur.
1129511323
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:
1203512063
Here is the list of exceptions:
1203612064
- A call to a function in [[#sync-builtin-functions]]:
1203712065
- 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]],
1204212076
the parameter `p` has a [=parameter tag=] of [=ParameterRequiredToBeUniform.S|ParameterRequiredToBeUniform.error=],
1204312077
with [=potential-trigger-set=] consisting of an unnamed [=diagnostic/triggering rule=].
1204412078
- A call to a function in
1204512079
[[#derivative-builtin-functions]], [[#texturesample]], [[#texturesamplebias]], and [[#texturesamplecompare]]:
1204612080
- Has a [=function tag=] of [=ReturnValueMayBeNonUniform=].
1204712081
- 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=]
1205212090
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.
1205612092
- A call to [[#textureload]]:
1205712093
- Has a [=call site tag=] of [=CallSiteNoRestriction=]
1205812094
- Has a [=function tag=] as follows:
@@ -12061,38 +12097,58 @@ Here is the list of exceptions:
1206112097
- [=NoRestriction=] otherwise
1206212098
- A call to a function in
1206312099
[[#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:
12102+
- [[#subgroupadd-builtin|subgroupAdd]]
12103+
- [[#subgroupall-builtin|subgroupAll]]
12104+
- [[#subgroupand-builtin|subgroupAnd]]
12105+
- [[#subgroupany-builtin|subgroupAny]]
12106+
- [[#subgroupballot-builtin|subgroupBallot]]
12107+
- [[#subgroupbroadcast-builtin|subgroupBroadcast]]
12108+
- [[#subgroupbroadcastfirst-builtin|subgroupBroadcastFirst]]
12109+
- [[#subgroupmax-builtin|subgroupMax]]
12110+
- [[#subgroupmin-builtin|subgroupMin]]
12111+
- [[#subgroupmul-builtin|subgroupMul]]
12112+
- [[#subgroupor-builtin|subgroupOr]]
12113+
- [[#subgroupxor-builtin|subgroupXor]]
12114+
- [=ReturnValueMayBeNonUniform=] otherwise
1206512115
- Let *DF* be the [=nearest enclosing diagnostic filter=] for the call site location and triggering rule [=trigger/subgroup_uniformity=]
1206612116
- Has a [=call site tag=] as follows:
12067-
- If *DF* exists, then let *S* be the *DF*'s new severity parameter.
12068-
- If *S* is the severity [=severity/off=], the call site tag is [=CallSiteNoRestriction=].
12069-
- Otherwise, the call site tag is [=CallSiteRequiredToBeUniform.S=], with [=potential-trigger-set=]
12117+
- If [=language_extension/subgroup_uniformity=] is not supported or the [=uniformity scope=] is subgroup then:
12118+
- If *DF* exists, then let *S* be the *DF*'s new severity parameter.
12119+
- If *S* is the severity [=severity/off=], the call site tag is [=CallSiteNoRestriction=].
12120+
- Otherwise, the call site tag is [=CallSiteRequiredToBeUniform.S=], with [=potential-trigger-set=]
12121+
consisting of a [=trigger/subgroup_uniformity=] element.
12122+
- If there is no such *DF*,
12123+
the call site tag is [=CallSiteRequiredToBeUniform.S|CallSiteRequiredToBeUniform.error=], with [=potential-trigger-set=]
1207012124
consisting of a [=trigger/subgroup_uniformity=] element.
12071-
- If there is no such *DF*,
12072-
the call site tag is [=CallSiteRequiredToBeUniform.S|CallSiteRequiredToBeUniform.error=], with [=potential-trigger-set=]
12073-
consisting of a [=trigger/subgroup_uniformity=] element.
12125+
- [=CallSiteNoRestriction=] otherwise.
1207412126
- Additionally for the case of a call to [[#subgroupshuffleup-builtin|subgroupShuffleUp]] or [[#subgroupshuffledown-builtin|subgroupShuffleDown]],
1207512127
the parameter `delta` has a [=parameter tag=] of:
12076-
- If *DF* exists, then let *S* be *DF*'s new severity parameter.
12077-
- If *S* is the severity [=severity/off=], the parameter tag is [=NoRestriction=].
12078-
- Otherwise, the parameter tag is [=ParameterRequiredToBeUniform.S=] with [=potential-trigger-set=]
12079-
consisting of a [=trigger/subgroup_uniformity=] element.
12080-
- If there is no such *DF*,
12081-
the parameter tag is [=ParameterRequiredToBeUniform.S|ParameterRequiredToBeUniform.error=], with [=potential-trigger-set=]
12082-
consisting of a [=trigger/subgroup_uniformity=] element.
12128+
- If [=language_extension/subgroup_uniformity=] is not supported or the [=uniformity scope=] is subgroup then:
12129+
- If *DF* exists, then let *S* be *DF*'s new severity parameter.
12130+
- If *S* is the severity [=severity/off=], the parameter tag is [=NoRestriction=].
12131+
- Otherwise, the parameter tag is [=ParameterRequiredToBeUniform.S=] with [=potential-trigger-set=]
12132+
consisting of a [=trigger/subgroup_uniformity=] element.
12133+
- If there is no such *DF*,
12134+
the parameter tag is [=ParameterRequiredToBeUniform.S|ParameterRequiredToBeUniform.error=], with [=potential-trigger-set=]
12135+
consisting of a [=trigger/subgroup_uniformity=] element.
12136+
- [=NoRestriction=] otherwise.
1208312137
- Additionally for the case of a call to [[#subgroupshufflexor-builtin|subgroupShuffleXor]],
1208412138
the parameter `mask` has a [=parameter tag=] of:
12085-
- If *DF* exists, then let *S* be *DF*'s new severity parameter.
12086-
- If *S* is the severity [=severity/off=], the parameter tag is [=NoRestriction=].
12087-
- Otherwise, the parameter tag is [=ParameterRequiredToBeUniform.S=] with [=potential-trigger-set=]
12088-
consisting of a [=trigger/subgroup_uniformity=] element.
12089-
- If there is no such *DF*,
12090-
the parameter tag is [=ParameterRequiredToBeUniform.S|ParameterRequiredToBeUniform.error=], with [=potential-trigger-set=]
12091-
consisting of a [=trigger/subgroup_uniformity=] element.
12139+
- If [=language_extension/subgroup_uniformity=] is not supported or the [=uniformity scope=] is subgroup then:
12140+
- If *DF* exists, then let *S* be *DF*'s new severity parameter.
12141+
- If *S* is the severity [=severity/off=], the parameter tag is [=NoRestriction=].
12142+
- Otherwise, the parameter tag is [=ParameterRequiredToBeUniform.S=] with [=potential-trigger-set=]
12143+
consisting of a [=trigger/subgroup_uniformity=] element.
12144+
- If there is no such *DF*,
12145+
the parameter tag is [=ParameterRequiredToBeUniform.S|ParameterRequiredToBeUniform.error=], with [=potential-trigger-set=]
12146+
consisting of a [=trigger/subgroup_uniformity=] element.
12147+
- [=NoRestriction=] otherwise.
1209212148

1209312149
Note: A WGSL implementation will ensure that if control flow prior to a
12094-
function call is [=uniform control flow|uniform=], it will also be uniform
12095-
after the function call.
12150+
function call is [=uniform control flow|uniform=] for a particular scope, it
12151+
will also be uniformafter the function call.
1209612152

1209712153
### Uniformity Rules for Expressions ### {#uniformity-expressions}
1209812154

@@ -12247,6 +12303,10 @@ The following built-in input variables are considered uniform:
1224712303
- [=built-in values/subgroup_size=] when used in a [=compute shader stage=]
1224812304
- [=built-in values/num_subgroups=]
1224912305

12306+
At [=subgroup uniformity scope=], the following built-in
12307+
input variables are also considered uniform:
12308+
- [=built-in values/subgroup_id=]
12309+
1225012310
All other ones (see [=built-in values=]) are considered non-uniform.
1225112311

1225212312
Note: An author should avoid grouping the uniform built-in values together with

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp