This issue is regarding the handling of vectors that have an element count of one or more than four.
Currently the spec states:
The element count must be between 2 and 4, inclusive.
See types.md for reference.
Looking at the current implementation of vectors in the slang compiler it seems like this is handled differently.
The compiler will attempt legalize a vector with element count one into its base type, see slang-ir-legalize-vector-types.cpp.
I believe that this is the more desirable behavior compared to making this illegal, as it would allow algorithms to be specialized to any vector length.
Looking at the other side of things, vectors of lengths longer than four also seem to be permitted by the current compiler implementation, at least when targeting SPIR-V.
As per the SPIR-V spec this is legal:
Component Count is the number of components in the resulting type. Component Count is an unsigned 32-bit integer. It must be at least 2.
While this may not be applicable to current GPU hardware I believe that this should not be a limitation imposed by the language.
The current restriction on vector element counts in the specification creates an unnecessary limitation that is at odds with the more flexible and practical handling already implemented in the slang compiler. Removing this restriction would align the specification with the compiler's behavior and broader hardware capabilities, particularly for SPIR-V, where vectors with lengths greater than four are valid.
This issue is regarding the handling of vectors that have an element count of one or more than four.
Currently the spec states:
See types.md for reference.
Looking at the current implementation of vectors in the slang compiler it seems like this is handled differently.
The compiler will attempt legalize a vector with element count one into its base type, see slang-ir-legalize-vector-types.cpp.
I believe that this is the more desirable behavior compared to making this illegal, as it would allow algorithms to be specialized to any vector length.
Looking at the other side of things, vectors of lengths longer than four also seem to be permitted by the current compiler implementation, at least when targeting SPIR-V.
As per the SPIR-V spec this is legal:
While this may not be applicable to current GPU hardware I believe that this should not be a limitation imposed by the language.
The current restriction on vector element counts in the specification creates an unnecessary limitation that is at odds with the more flexible and practical handling already implemented in the slang compiler. Removing this restriction would align the specification with the compiler's behavior and broader hardware capabilities, particularly for SPIR-V, where vectors with lengths greater than four are valid.