microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] sign() on uint matrices with at least two rows and two columns constructs an unsigned result array
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
sign() called on a uint matrix with at least two rows and two columns generates invalid SPIR-V, as codegen attempts to construct an array of unsigned integer vectors from signed integer vectors.
Steps to Reproduce
Compile with dxc -T cs_6_0 -E main -Od -spirv source.hlsl:
[numthreads(1,1,1)]
void main() {
uint2x2 u;
int2x2 result = sign(u);
}
Actual Behavior
fatal error: generated SPIR-V is invalid: Expected Constituent type to be equal to the column type Result Type array
%34 = OpCompositeConstruct %_arr_v2uint_uint_2 %30 %33
Disabling validation shows that we are trying to construct an array of unsigned integer vectors from signed integer vectors:
%30 = OpSelect %v2int %29 %11 %10
[...]
%33 = OpSelect %v2int %32 %11 %10
%34 = OpCompositeConstruct %_arr_v2uint_uint_2 %30 %33
Environment
- DXC version:
libdxcompiler.so: 1.10(5474-942eeceb)(1.9.0.15470) - Host Operating System: Fedora Linux 43 <!--- Host operating system and version --->
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the HLSL reproducer from the issue with dxc -T cs_6_0 -E main -Od -spirv source.hlsl and inspect the generated SPIR-V validation error. Trace the codegen path for sign() on the uint2x2 matrix; done means the reproducer compiles with valid SPIR-V and the signed and unsigned constituent types match.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100