-
Notifications
You must be signed in to change notification settings - Fork 102
/
GL_KHR_shader_subgroup_rotate.txt
169 lines (112 loc) · 5.72 KB
/
GL_KHR_shader_subgroup_rotate.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Name
KHR_shader_subgroup_rotate
Name Strings
GL_KHR_shader_subgroup_rotate
Contact
Kevin Petit (kevin.petit 'at' arm.com), Arm Ltd.
Contributors
Kevin Petit, Arm Ltd.
Jeff Bolz, NVidia
Stuart Brady, Arm Ltd.
Sven van Haastregt, Arm Ltd.
Notice
Copyright (c) 2021-2024 The Khronos Group Inc. Copyright terms at
http://www.khronos.org/registry/speccopyright.html
Status
Draft
Version
Last Modified Date: 2024/02/06
Revision: 1
Dependencies
This extension can be applied to OpenGL GLSL versions 1.40
(#version 140) and higher.
This extension can be applied to OpenGL ES ESSL versions 3.10
(#version 310) and higher.
This extension is written against the OpenGL Shading Language
Specification version 4.60, dated July 23, 2017.
This extension interacts with revision 1 of the
GL_EXT_shader_subgroup_extended_types_int8,
GL_EXT_shader_subgroup_extended_types_int16,
GL_EXT_shader_subgroup_extended_types_int64 and
GL_EXT_shader_subgroup_extended_types_float16 extensions, dated
January 8, 2019.
Overview
This extension adds built-in functions to rotate values within a subgroup.
Mapping to SPIR-V
-----------------
For informational purposes (non-normative), the following is an
expected way for an implementation to map GLSL constructs to SPIR-V
constructs, the SPIR-V capabilities they require, and the Vulkan
feature bits those capabilities require:
subgroupRotate(value, delta) ->
Opcode: OpGroupNonUniformRotateKHR(
/*Execution*/Subgroup,
/*Value*/value,
/*Delta*/delta)
Capabilities: GroupNonUniformRotateKHR
Vulkan features: shaderSubgroupRotate
subgroupClusteredRotate(value, delta, clusterSize) ->
Opcode: OpGroupNonUniformRotateKHR(
/*Execution*/Subgroup,
/*Value*/value,
/*Delta*/delta,
/*ClusterSize*/clusterSize)
Capabilities: GroupNonUniformRotateKHR
Vulkan features: shaderSubgroupRotateClustered
Modifications to the OpenGL Shading Language Specification, Version 4.60
Including the following line in a shader can be used to control the
language features described in this extension:
#extension GL_KHR_shader_subgroup_rotate : <behavior>
where <behavior> is as specified in section 3.3. If
GL_KHR_shader_subgroup_rotate is enabled, the GL_KHR_shader_subgroup_basic
extension is also implicitly enabled.
New preprocessor #defines are added:
#define GL_KHR_shader_subgroup_rotate 1
Additions to Chapter 8 of the OpenGL Shading Language Specification
(Built-in Functions)
Add to Section 8.18, Shader Invocation Group Functions
Syntax:
genType subgroupRotate(genType value, uint delta);
genIType subgroupRotate(genIType value, uint delta);
genUType subgroupRotate(genUType value, uint delta);
genBType subgroupRotate(genBType value, uint delta);
genDType subgroupRotate(genDType value, uint delta);
genType subgroupClusteredRotate(genType value, uint delta, uint clusterSize);
genIType subgroupClusteredRotate(genIType value, uint delta, uint clusterSize);
genUType subgroupClusteredRotate(genUType value, uint delta, uint clusterSize);
genBType subgroupClusteredRotate(genBType value, uint delta, uint clusterSize);
genDType subgroupClusteredRotate(genDType value, uint delta, uint clusterSize);
If GL_EXT_shader_subgroup_extended_types_int8 is enabled:
genI8Type subgroupRotate(genI8Type value, uint delta);
genU8Type subgroupRotate(genU8Type value, uint delta);
genI8Type subgroupClusteredRotate(genI8Type value, uint delta, uint clusterSize);
genU8Type subgroupClusteredRotate(genU8Type value, uint delta, uint clusterSize);
If GL_EXT_shader_subgroup_extended_types_int16 is enabled:
genI16Type subgroupRotate(genI16Type value, uint delta);
genU16Type subgroupRotate(genU16Type value, uint delta);
genI16Type subgroupClusteredRotate(genI16Type value, uint delta, uint clusterSize);
genU16Type subgroupClusteredRotate(genU16Type value, uint delta, uint clusterSize);
If GL_EXT_shader_subgroup_extended_types_int64 is enabled:
genI64Type subgroupRotate(genI64Type value, uint delta);
genU64Type subgroupRotate(genU64Type value, uint delta);
genI64Type subgroupClusteredRotate(genI64Type value, uint delta, uint clusterSize);
genU64Type subgroupClusteredRotate(genU64Type value, uint delta, uint clusterSize);
If GL_EXT_shader_subgroup_extended_types_float16 is enabled:
genF16Type subgroupRotate(genF16Type value, uint delta);
genF16Type subgroupClusteredRotate(genF16Type value, uint delta, uint clusterSize);
Only usable if the extension GL_KHR_shader_subgroup_rotate is enabled.
The function subgroupRotate() returns the <value> whose
<gl_SubgroupInvocationID> is equal to the remainder of the division
of this invocation's <gl_SubgroupInvocationID> plus <delta> by
<gl_SubgroupSize>.
If the selected invocation is inactive, an undefined value is returned.
<delta> must be dynamically uniform within the calling subgroub.
When the addition of <gl_SubgroupInvocationID> and <delta> results in
overflow, its result will be the low-order 32 bits of the correct result R,
where R is computed with enough precision to avoid overflow.
Issues
None.
Revision History
Rev. Date Author Changes
---- ----------- -------- -------------------------------------------
1 2024/02/06 Kevin Petit Initial revision.