microsoft / microsoft/DirectXShaderCompiler

[SPIR-V] NoContraction from precise does not propagate to functions

Open
#8,423 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage spirv
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
When I mark vs output position as precise, I expect to get precise semantics for all computations that contribute to it's value. However, when I put computations in a separate function, the NoContraction decorators are not applied to the computations inside the function, even though it is inlined in the final SpirV.

Steps to Reproduce
Here the NoContraction decorations are missing https://godbolt.org/z/xoj5hbh5T
And here (using macro instead of function) they are present https://godbolt.org/z/eGfbh5z6E

Actual Behavior
Missing NoContraction has led to artifacts on vulkan where it was fine on dx12 when using same shader codebase for SpirV and DXIL generation.

Environment

  • DXC version 1.9.2602, also reproduced with 1.8.2505.1
  • Host Operating System Windows 10 Pro 22H2 (also reproduced on other machines)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the two Godbolt reproductions and compare the generated SPIR-V for the separate-function and macro cases. Trace how precise on the vertex-position output is propagated during compilation and inlining. Done means computations inside the separate function receive the expected NoContraction decorations, matching the macro case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.