microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] -Gis causes multiple NoContraction
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Compiling certain inputs to SPIRV with the flag -Gis causes a compile error.
Steps to Reproduce
The following link demonstrates a trivial input that has this behaviour.
https://godbolt.org/z/rq6r1j7on
Actual Behavior
https://godbolt.org/z/rq6r1j7on
Compiling with the flags -spirv -Gis causes a compile error with the following output:
fatal error: generated SPIR-V is invalid: ID '8' decorated with NoContraction multiple times is not allowed.
%8 = OpIMul %v2uint %31 %13
note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible
https://godbolt.org/z/q9cMnP7jh
Compiling with the flags -Vd on top removes the validation step and doesn't cause the error. However, the generated SPIRV code contains multiple NoContraction instructions:
OpDecorate %9 NoContraction
OpDecorate %9 NoContraction
This corresponds with the error message produced without -Vd.
Environment
- DXC version: dxcompiler.dll: 1.9 - 1.8.2505.1
- Host Operating System: Windows 11 Enterprise version 24H2
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 with the Godbolt reproducer at https://godbolt.org/z/rq6r1j7on and compare compilation with -spirv -Gis, with and without -Vd. Trace the SPIR-V generation path responsible for NoContraction decorations and inspect the generated output shown in the issue. Done means the reproducer no longer emits duplicate decorations and validation succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100