Name Strings
SPV_EXT_descriptor_indexing
Contact
To report problems with this extension, please open a new issue at:
Contributors
-
Daniel Koch, NVIDIA
-
Jeff Bolz, NVIDIA
-
Neil Henning, Codeplay
-
Matthaeus Chajdas, AMD
-
John Kessenich, Google
Status
-
Complete
Version
Last Modified Date |
2018-12-17 |
Revision |
5 |
Dependencies
This extension is written against the SPIR-V Specification, Version 1.3 Revision 1.
This extension requires SPIR-V 1.0.
This extension interacts with SPV_KHR_storage_buffer_storage_class.
This extension provides SPIR-V support for the GL_EXT_nonuniform_qualifier GLSL extension.
Overview
This extension adds new capabilities to support the Vulkan VK_EXT_descriptor_indexing extension along with a new decoration in order to enable support for the GL_EXT_nonuniform_qualifier GLSL extension.
The NonUniformEXT decoration is used to indicate that a variable or instruction is non-uniform (or divergent control flow) for different invocations. The ShaderNonUniformEXT capability is used to indicate that a module uses this decoration.
The RuntimeDescriptorArrayEXT capability is used to indicate that a module uses arrays of resources which are declared with OpTypeRuntimeArray.
The InputAttachmentArrayDynamicIndexingEXT, UniformTexelBufferArrayDynamicIndexingEXT, and StorageTexelBufferArrayDynamicIndexingEXT capabilities are used to indicate that a module uses an array of InputAttachment, SampledBuffer, or ImageBuffer, respectively, with dynamic indexing.
The UniformBufferArrayNonUniformIndexingEXT, SampledImageArrayNonUniformIndexingEXT, StorageBufferArrayNonUniformIndexingEXT, StorageImageArrayNonUniformIndexingEXT, InputAttachmentArrayNonUniformIndexingEXT, UniformTexelBufferArrayNonUniformIndexingEXT, and StorageTexelBufferArrayNonUniformIndexingEXT capabilities are used to indicate that a module uses an array of Block-decorated uniforms, sampled images, StorageBuffer, non-sampled images, InputAttachment, SampledBuffer, or ImageBuffer resources, respectively, with non-uniform indexing.
Extension Name
To use this extension within a SPIR-V module, the following OpExtension must be present in the module:
OpExtension "SPV_EXT_descriptor_indexing"
New Capabilities
This extension introduces the following new capabilities:
ShaderNonUniformEXT RuntimeDescriptorArrayEXT InputAttachmentArrayDynamicIndexingEXT UniformTexelBufferArrayDynamicIndexingEXT StorageTexelBufferArrayDynamicIndexingEXT UniformBufferArrayNonUniformIndexingEXT SampledImageArrayNonUniformIndexingEXT StorageBufferArrayNonUniformIndexingEXT StorageImageArrayNonUniformIndexingEXT InputAttachmentArrayNonUniformIndexingEXT UniformTexelBufferArrayNonUniformIndexingEXT StorageTexelBufferArrayNonUniformIndexingEXT
New Decorations
Decoration added under the ShaderNonUniformEXT capability:
NonUniformEXT
New Builtins
None.
New Instructions
None.
Token Number Assignments
Name | Value | Usage |
---|---|---|
NonUniformEXT |
5300 |
Decoration |
ShaderNonUniformEXT |
5301 |
Capability |
RuntimeDescriptorArrayEXT |
5302 |
Capability |
InputAttachmentArrayDynamicIndexingEXT |
5303 |
Capability |
UniformTexelBufferArrayDynamicIndexingEXT |
5304 |
Capability |
StorageTexelBufferArrayDynamicIndexingEXT |
5305 |
Capability |
UniformBufferArrayNonUniformIndexingEXT |
5306 |
Capability |
SampledImageArrayNonUniformIndexingEXT |
5307 |
Capability |
StorageBufferArrayNonUniformIndexingEXT |
5308 |
Capability |
StorageImageArrayNonUniformIndexingEXT |
5309 |
Capability |
InputAttachmentArrayNonUniformIndexingEXT |
5310 |
Capability |
UniformTexelBufferArrayNonUniformIndexingEXT |
5311 |
Capability |
StorageTexelBufferArrayNonUniformIndexingEXT |
5312 |
Capability |
Modifications to the SPIR-V Specification, Version 1.3
- (Add a new Section 2.X, Uniformity)
-
SPIR-V has multiple notions of uniformity of values. A result <id> decorated as Uniform (for a particular scope) is a contract that all invocations within that scope will compute the same value for that result, for a given dynamic instance of an instruction. This is useful to enable implementations to store results in a scalar register file (scalarization), for example. Results are assumed not to be uniform unless decorated as such.
An <id> is defined to be dynamically uniform for a dynamic instance of an instruction if all invocations (in an invocation group) that execute the dynamic instance have the same value for that <id>. This is not something that is explicitly decorated, it is just a property that arises. This property is assumed to hold for operands of certain instructions, such as the Image operand of image instructions, unless that operand is decorated as NonUniformEXT. Some implementations require more complex instruction expansions to handle non-dynamically uniform values in certain instructions, and thus it is mandatory for certain operands to be decorated as NonUniformEXT if they are not guaranteed to be dynamically uniform.
While the names may suggest otherwise, nothing forbids an <id> from being decorated as both Uniform and NonUniformEXT. Since dynamically uniform is at a larger scope (invocation group) than the default Uniform scope (subgroup), it is even possible for the <id> to be uniform at the subgroup scope but not dynamically uniform.
- (Modify Section 3.20, Decoration, adding a row to the Decoration table)
-
Decoration Enabling Capabilities Extra Operands 5300
NonUniformEXT
Apply to an object. Asserts that the value backing the decorated <id> is not dynamically uniform. See the API specification for more information.ShaderNonUniformEXT
- (Modify Section 3.31, Capability, adding new rows to the Capability table)
-
Capability Depends On Enabled by Extension 5301
ShaderNonUniformEXT
Uses the NonUniformEXT decoration on a variable or instruction.Shader
SPV_EXT_descriptor_indexing
5302
RuntimeDescriptorArrayEXT
Uses arrays of resources which are sized at run-time.Shader
SPV_EXT_descriptor_indexing
5303
InputAttachmentArrayDynamicIndexingEXT
Arrays of InputAttachment-s use dynamically uniform indexing.InputAttachment
SPV_EXT_descriptor_indexing
5304
UniformTexelBufferArrayDynamicIndexingEXT
Arrays of SampledBuffer-s use dynamically uniform indexingSampledBuffer
SPV_EXT_descriptor_indexing
5305
StorageTexelBufferArrayDynamicIndexingEXT
Arrays of ImageBuffer-s use dynamically uniform indexingImageBuffer
SPV_EXT_descriptor_indexing
5306
UniformBufferArrayNonUniformIndexingEXT
Block-decorated arrays in uniform storage classes use non-uniform indexing.ShaderNonUniformEXT
SPV_EXT_descriptor_indexing
5307
SampledImageArrayNonUniformIndexingEXT
Arrays of sampled images use non-uniform indexing.ShaderNonUniformEXT
SPV_EXT_descriptor_indexing
5308
StorageBufferArrayNonUniformIndexingEXT
Arrays in the StorageBuffer Storage Class, or BufferBlock-decorated arrays use non-uniform indexing.ShaderNonUniformEXT
SPV_EXT_descriptor_indexing
5309
StorageImageArrayNonUniformIndexingEXT
Arrays of non-sampled images use non-uniform indexing.ShaderNonUniformEXT
SPV_EXT_descriptor_indexing
5310
InputAttachmentArrayNonUniformIndexingEXT
Arrays of InputAttachment-s use non-uniform indexing.InputAttachment, ShaderNonUniformEXT
SPV_EXT_descriptor_indexing
5311
UniformTexelBufferArrayNonUniformIndexingEXT
Arrays of SampledBuffer-s use non-uniform indexing.SampledBuffer, ShaderNonUniformEXT
SPV_EXT_descriptor_indexing
5312
StorageTexelBufferArrayNonUniformIndexingEXT
Arrays of ImageBuffer-s use non-uniform indexing.ImageBuffer, ShaderNonUniformEXT
SPV_EXT_descriptor_indexing
Validation Rules
An OpExtension must be added to the SPIR-V for validation layers to check legal use of this extension:
OpExtension "SPV_EXT_descriptor_indexing"
Issues
-
SPIR-V 1.3 Core spec says the following for OpTypeRuntimeArray "Objects of this type can only be created with OpVariable using the StorageBuffer or Uniform Storage Classes. This should be removed and defer to the environment specifications instead."
RESOLVED: Agree. This is superseded by the language in the Vulkan and OpenGL SPIR-V Environment specifications which states that "OpTypeRuntimeArray must only be used for the last member of an OpTypeStruct in the Uniform Storage Class and is decorated as BufferBlock."
-
What type of SPIR-V instructions can the NonUniformEXT decoration be used on?
RESOLVED: Using the same language as Uniform (Apply to an object). In SPIR-V, we have the following definition:
Object: An instantiation of a non-void type, either as the Result <id> of an operation, or created through OpVariable.
which means it can apply to both variables declarations and specific instructions.
Revision History
Rev | Date | Author | Changes |
---|---|---|---|
1 |
2018-01-19 |
Daniel Koch |
Initial draft |
2 |
2018-02-14 |
Daniel Koch |
address WG feedback |
3 |
2018-02-21 |
Daniel Koch |
Resolve issue 2. |
4 |
2018-12-11 |
Daniel Koch |
Update issue 2 for resolution of Issue 317. |
5 |
2018-12-17 |
Daniel Koch |
Add 2.x Uniformity section. |