Description
sign() generates invalid SPIR-V for any non-square uintMxN matrix with at least two rows and two columns due to a shape mismatch in the generated code: it uses OpUGreaterThan to compare each N-element row vector to an M-element zero vector and uses an M-element boolean vector result type.
Steps to Reproduce
Godbolt
Compile with dxc -T cs_6_0 -E main -Od -spirv source.hlsl:
[numthreads(1,1,1)]
void main() {
uint2x4 u;
int2x4 result = sign(u);
}
Actual Behavior
fatal error: generated SPIR-V is invalid: Expected vector sizes of Result Type and the operands to be equal: UGreaterThan
%31 = OpUGreaterThan %v2bool %28 %8
Disabling validation, we can see the shape mismatch:
%8 = OpConstantComposite %v2uint %uint_0 %uint_0
[...]
%28 = OpCompositeExtract %v4uint %27 0
%31 = OpUGreaterThan %v2bool %28 %8
Environment
- DXC version:
libdxcompiler.so: 1.10(5474-942eeceb)(1.9.0.15470)
- Host Operating System: Fedora Linux 43
Description
sign()generates invalid SPIR-V for any non-squareuintMxNmatrix with at least two rows and two columns due to a shape mismatch in the generated code: it usesOpUGreaterThanto compare eachN-element row vector to anM-element zero vector and uses anM-element boolean vector result type.Steps to Reproduce
Godbolt
Compile with
dxc -T cs_6_0 -E main -Od -spirv source.hlsl:Actual Behavior
Disabling validation, we can see the shape mismatch:
Environment
libdxcompiler.so: 1.10(5474-942eeceb)(1.9.0.15470)