[SPIR-V] SPIR-V not valid when ROV is used with branch if.

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

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the linked Godbolt reproducer and inspect the generated SPIR-V around the reported dominance validation error. Compare compilation with the branch layouts and resource types described in the issue; done means the ROV read case produces valid SPIR-V without regressing the working DXIL, RWTexture2D, or else-branch cases.

Written by the indexing model from the issue text.

Description

bug needs-triage spirv

Hi everyone!

Description
DXC generates invalid SPIR-V with error generated SPIR-V is invalid: ID '47[%47]' defined in block '39[%39]' does not dominate its use in block '38[%38]' if a read of a ROV is attempted inside a if branch.

Steps to Reproduce
https://godbolt.org/z/MGME6Wc97

Actual Behavior
DXC returns generated SPIR-V is invalid: ID '47[%47]' defined in block '39[%39]'. It compiles with DXIL. It compiles with RWTexture2D instead of ROVTexture2D. It compiles if the ROV is read in the else branch of the doSSR.

Environment
DXC trunk on godbolt.
Reproduce also on windows 11 and custom fork of 1.10.2605.24.

If this shader is invalid and I misunderstood something, I'm sorry but I will be eager for the explanation :D

Have a nice day,
Robin.

Dominant language
C++
Stars
3.7k
Forks
926
Avg merge
3d 22h
Merged PRs (30d)
45

Getting set up

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.

More from microsoft/DirectXShaderCompiler

All issues in microsoft/DirectXShaderCompiler

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.