microsoft / microsoft/DirectXShaderCompiler

DXC generates corrupted DXIL IR from a code that uses RayQuery as a struct member

Open
#6,998 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug diagnostic incorrect-code validation
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Description
DXC generates corrupted DXIL IR from a code that uses RayQuery as a struct member

Steps to Reproduce
https://godbolt.org/z/9a4WeTWW3

Actual Behavior
The allocateRayQuery instruction is missing.
rayquery allocation argument in other rayquery intrinsics is replaced with an undef. Like this:

  call void @dx.op.rayQuery_TraceRayInline(i32 179, i32 **undef**, %dx.types.Handle %6, i32 0, i32 -1, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+03), !dbg !48
  %7 = call i1 @dx.op.rayQuery_Proceed.i1(i32 180, i32 **undef**), !dbg !74

Environment
See godbolt link

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 Godbolt reproduction at https://godbolt.org/z/9a4WeTWW3 and inspect the generated DXIL IR for a RayQuery used as a struct member. Trace the compiler entry points that lower this case, focusing on the missing allocateRayQuery instruction and undef ray-query arguments. Done means the generated IR preserves the allocation and passes the correct ray-query value to the intrinsics, with a regression test covering the reproduction.

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
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.