Skip to content

Commit fba15c4

Browse files
committed
Add comment explaining the vector size restrictions.
1 parent e17a42e commit fba15c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ SPIRVLegalizerInfo::SPIRVLegalizerInfo(const SPIRVSubtarget &ST) {
160160
return IsExtendedInts && Ty.isValid();
161161
};
162162

163+
// The universal validation rules in the SPIR-V specification state that
164+
// vector sizes are typically limited to 2, 3, or 4. However, larger vector
165+
// sizes (8 and 16) are enabled when the Kernel capability is present. For
166+
// shader execution models, vector sizes are strictly limited to 4. In
167+
// non-shader contexts, vector sizes of 8 and 16 are also permitted, but
168+
// arbitrary sizes (e.g., 6 or 11) are not.
163169
uint32_t MaxVectorSize = ST.isShader() ? 4 : 16;
164170

165171
for (auto Opc : getTypeFoldingSupportedOpcodes()) {

0 commit comments

Comments
 (0)