|
| 1 | +SPV_EXT_long_vector |
| 2 | +=================== |
| 3 | + |
| 4 | +Name Strings |
| 5 | +------------ |
| 6 | + |
| 7 | +SPV_EXT_long_vector |
| 8 | + |
| 9 | +Contact |
| 10 | +------- |
| 11 | + |
| 12 | +To report problems with this extension, please open a new issue at: |
| 13 | + |
| 14 | +https://github.com/KhronosGroup/SPIRV-Headers |
| 15 | + |
| 16 | +Contributors |
| 17 | +------------ |
| 18 | + |
| 19 | +- Jeff Bolz, NVIDIA |
| 20 | +
|
| 21 | +Notice |
| 22 | +------ |
| 23 | + |
| 24 | +Copyright (c) 2025 The Khronos Group Inc. Copyright terms at |
| 25 | +http://www.khronos.org/registry/speccopyright.html |
| 26 | + |
| 27 | +Status |
| 28 | +------ |
| 29 | + |
| 30 | +- Approved by the SPIR-V Working Group: 2025-10-29 |
| 31 | +- Approved by the Khronos Board of Promoters: 2025-12-12 |
| 32 | +
|
| 33 | +
|
| 34 | +Version |
| 35 | +------- |
| 36 | + |
| 37 | +[width="40%",cols="25,25"] |
| 38 | +|======================================== |
| 39 | +| Last Modified Date | 2025-10-13 |
| 40 | +| Revision | 1 |
| 41 | +|======================================== |
| 42 | + |
| 43 | +Dependencies |
| 44 | +------------ |
| 45 | + |
| 46 | +This extension is written against the SPIR-V Specification, |
| 47 | +Version 1.6, Revision 5, Unified. |
| 48 | + |
| 49 | +This extension requires SPIR-V 1.3. |
| 50 | + |
| 51 | +This extension interacts with SPV_KHR_physical_storage_buffer. |
| 52 | + |
| 53 | +Overview |
| 54 | +-------- |
| 55 | + |
| 56 | +This extension adds support for vector types with an arbitrary positive number |
| 57 | +of components, and for a number of components taken from a specialization |
| 58 | +constant. These new vector types can be used with any instructions that act |
| 59 | +on vector types with an unrestricted number of components, but support a |
| 60 | +limited set of storage classes. |
| 61 | + |
| 62 | +This extension shares some functionality (*OpTypeVectorIdEXT*) with |
| 63 | +SPV_NV_cooperative_vector. It is intended to be a compilation target |
| 64 | +for GL_EXT_long_vector (GLSL) and |
| 65 | +https://github.com/microsoft/hlsl-specs/blob/main/proposals/0026-hlsl-long-vector-type.md |
| 66 | +(HLSL). |
| 67 | + |
| 68 | +Extension Name |
| 69 | +-------------- |
| 70 | + |
| 71 | +To use this extension within a SPIR-V module, the following |
| 72 | +*OpExtension* must be present in the module: |
| 73 | + |
| 74 | +---- |
| 75 | +OpExtension "SPV_EXT_long_vector" |
| 76 | +---- |
| 77 | + |
| 78 | +Modifications to the SPIR-V Specification, Version 1.6 |
| 79 | +------------------------------------------------------ |
| 80 | + |
| 81 | +2.16 Validation Rules |
| 82 | +~~~~~~~~~~~~~~~~~~~~~ |
| 83 | + |
| 84 | +==== Modify section 2.16.1. Universal Validation Rules: |
| 85 | + |
| 86 | +* Vector types with more than four components (or types containing them) can |
| 87 | +only be allocated in *Function*, *Private*, *Uniform*, *Workgroup*, |
| 88 | +*StorageBuffer*, *PhysicalStorageBuffer*, *PushConstant*, |
| 89 | +*ShaderRecordBufferKHR*, *CrossWorkgroup*, and *Generic* storage classes. |
| 90 | + |
| 91 | +* Matrix types must be parameterized only with *OpTypeVector* having 2, 3, or 4 |
| 92 | +components. |
| 93 | + |
| 94 | +3.31 Capabilities |
| 95 | +~~~~~~~~~~~~~~~~~ |
| 96 | + |
| 97 | +Modify Section 3.31, "Capability", adding these rows to the Capability table: |
| 98 | + |
| 99 | +-- |
| 100 | +[options="header"] |
| 101 | +|==== |
| 102 | +2+^| Capability ^| Implicitly Declares |
| 103 | +| 5425 | *LongVectorEXT* + |
| 104 | +Enables vector types with more than four components, one component, and |
| 105 | +*OpTypeVectorIdEXT*. |
| 106 | +| |
| 107 | +|==== |
| 108 | +-- |
| 109 | + |
| 110 | +3.56.6 Type-Declaration Instructions |
| 111 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 112 | + |
| 113 | +Modify *OpTypeVector* to allow a 'Component Count' of 1. |
| 114 | + |
| 115 | +[cols="1,1,3*3",width="100%"] |
| 116 | +|===== |
| 117 | +4+|[[OpTypeVectorIdEXT]]*OpTypeVectorIdEXT* + |
| 118 | + + |
| 119 | +Declare a new vector type with 'Component Count' components of the requested scalar type. + |
| 120 | + + |
| 121 | +'Component Type' is the type of each component in the resulting type. It must be a 'scalar type'. |
| 122 | + + |
| 123 | +'Component Count' is the number of components in the resulting type. |
| 124 | +'Component Count' must be a 'constant instruction' with scalar 32-bit 'integer type'. |
| 125 | +It is treated as an unsigned value and must be greater than zero. + |
| 126 | + + |
| 127 | +1+|Capability: + |
| 128 | +*LongVectorEXT* |
| 129 | +1+| 4 | 5288 | 'Result <id>' | '<id>' + |
| 130 | +'Component Type' | '<id>' + |
| 131 | +'Component Count' |
| 132 | +|===== |
| 133 | + |
| 134 | +3.56.12 Composite Instructions |
| 135 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 136 | + |
| 137 | +Modify *OpCompositeConstruct* to remove the following sentence: |
| 138 | + |
| 139 | +If constructing a vector, there must be at least two Constituent operands. |
| 140 | + |
| 141 | +Modify *OpVectorExtractDynamic*, *OpVectorInsertDynamic*, *OpVectorShuffle*, |
| 142 | +to change restrictions from "must be an *OpTypeVector*" or "must have a type *OpTypeVector*" |
| 143 | +to "must be/have a vector type". |
| 144 | + |
| 145 | +Issues |
| 146 | +------ |
| 147 | +
|
| 148 | +. How can a shader construct a vector with number of components defined by |
| 149 | +a specialization constant? |
| 150 | ++ |
| 151 | +-- |
| 152 | +*RESOLVED*: Use the instructions in SPV_EXT_replicated_composites to construct |
| 153 | +a vector with the same value replicated for all components. |
| 154 | +-- |
| 155 | +
|
| 156 | +. Which instructions support the new vector types? |
| 157 | ++ |
| 158 | +-- |
| 159 | +*RESOLVED*: Unless otherwise stated, any instruction that claims to support |
| 160 | +vector types and doesn't have a specific limitation on the number of components |
| 161 | +(for example, GLSL.std.450 *Cross* requires exactly three components) supports |
| 162 | +vectors with more than four components, one component, and vectors created using |
| 163 | +*OpTypeVectorIdEXT*. This includes GLSL.std.450 instructions. |
| 164 | +-- |
| 165 | +
|
| 166 | +. Should *OpVectorShuffle* support vectors with more than four components or |
| 167 | +*OpTypeVectorIdEXT*? |
| 168 | ++ |
| 169 | +-- |
| 170 | +*RESOLVED*: *OpVectorShuffle* has a similar problem to the other composite |
| 171 | +instructions where the number of operands must match the number of components, |
| 172 | +and this makes it awkward to work with *OpTypeVectorIdEXT*. Also, the high |
| 173 | +level language exposure of shuffle (swizzles) doesn't naturally extend to more |
| 174 | +components, though it is not hard to imagine a new intrinsic to expose this. |
| 175 | +Practically speaking, it's hard to draw a line for what not to support, and |
| 176 | +this could be useful in the future, so it is supported. |
| 177 | +-- |
| 178 | +
|
| 179 | +. Do we need to forbid spec-constant-sized vectors in explicitly laid out |
| 180 | +storage classes? |
| 181 | ++ |
| 182 | +-- |
| 183 | +*RESOLVED*: Vulkan has a restriction for spec-constant sized arrays, a similar |
| 184 | +restriction will apply to spec-constant-sized vectors. |
| 185 | +-- |
| 186 | +
|
| 187 | +Revision History |
| 188 | +---------------- |
| 189 | + |
| 190 | +[cols="5,15,15,70"] |
| 191 | +[grid="rows"] |
| 192 | +[options="header"] |
| 193 | +|======================================== |
| 194 | +|Rev|Date|Author|Changes |
| 195 | +|1|2025-10-13|Jeff Bolz|Initial revision of SPV_EXT_long_vector |
| 196 | +|======================================== |
0 commit comments