[PIX] Select callable and node shader debug invocations - #8854
Open
Damyan Pepper (damyanp) wants to merge 1 commit into
Open
[PIX] Select callable and node shader debug invocations#8854Damyan Pepper (damyanp) wants to merge 1 commit into
Damyan Pepper (damyanp) wants to merge 1 commit into
Conversation
The debug instrumentation pass numbers the instructions of a callable shader and advertises them to PIX, but it emits no instrumentation for it. PIX offers a callable shader that it can never step into. Every node shader uses a selection criterion that is always true. Every invocation matches, so the debugger shows whichever invocation reaches the UAV first, and that differs between runs. A callable shader has neither a ray nor a thread of its own. dx.op.dispatchRaysIndex is legal in it, and it reports the ray generation index responsible for the call. PIX selects a ray generation, any-hit, closest-hit, or miss invocation on that same identity, so a callable invocation uses it too. For a node shader, the pass selects by launch type. A broadcasting node is dispatched over a grid, so SV_DispatchThreadID names one invocation, as it does for a compute shader. A coalescing node has only the position of a thread within its group, so the selection narrows to the group size. A thread launch node has no thread identity at all, so every invocation stays of interest. The pass report names which case applies, so the caller can present the selection as exact or approximate. Assisted-by: Copilot Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ac42a8d8-c740-45a3-9a2d-7cfc39b92853
Damyan Pepper (damyanp)
requested a review
from Austin Kinross (austinkinross)
August 28, 2026 03:58
Damyan Pepper (damyanp)
marked this pull request as ready for review
August 28, 2026 04:00
Contributor
There was a problem hiding this comment.
Pull request overview
Extends PIX debug instrumentation to select callable and node shader invocations appropriately.
Changes:
- Selects callable shaders using ray dispatch indices.
- Selects node shaders according to launch type.
- Adds unit and FileCheck coverage for each selection mode.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
lib/DxilPIXPasses/DxilDebugInstrumentation.cpp |
Implements callable and node invocation selection. |
tools/clang/unittests/HLSL/PixTest.cpp |
Adds validation tests and parameterized pass execution. |
tools/clang/test/HLSLFileCheck/pix/DebugCallableShader.hlsl |
Checks callable instrumentation. |
tools/clang/test/HLSLFileCheck/pix/DebugNodeBroadcasting.hlsl |
Checks broadcasting-node selection. |
tools/clang/test/HLSLFileCheck/pix/DebugNodeCoalescing.hlsl |
Checks coalescing-node selection. |
tools/clang/test/HLSLFileCheck/pix/DebugNodeThreadLaunch.hlsl |
Checks thread-launch fallback selection. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| case DXIL::ShaderKind::AnyHit: | ||
| case DXIL::ShaderKind::ClosestHit: | ||
| case DXIL::ShaderKind::Miss: | ||
| case DXIL::ShaderKind::Callable: |
Comment on lines
+8
to
+21
| // CHECK: NodeInvocationSelection:GroupThreadId | ||
|
|
||
| // CHECK: %ThreadIdX = call i32 @dx.op.threadIdInGroup.i32(i32 95, i32 0) | ||
| // CHECK: %ThreadIdY = call i32 @dx.op.threadIdInGroup.i32(i32 95, i32 1) | ||
| // CHECK: %ThreadIdZ = call i32 @dx.op.threadIdInGroup.i32(i32 95, i32 2) | ||
| // CHECK: %CompareToThreadIdX = icmp eq i32 %ThreadIdX, 3 | ||
| // CHECK: %CompareToThreadIdY = icmp eq i32 %ThreadIdY, 1 | ||
| // CHECK: %CompareToThreadIdZ = icmp eq i32 %ThreadIdZ, 0 | ||
| // CHECK: %CompareAll = and i1 %CompareXAndY, %CompareToThreadIdZ | ||
| // CHECK: br i1 %CompareAll, label %PIXInterestingBlock, label %PIXNonInterestingBlock | ||
|
|
||
| // The requested thread must lie inside the declared thread group, or the pass | ||
| // discriminates nothing. The parameters above lie inside [NumThreads(4, 2, 1)]. | ||
| // CHECK-NOT: NodeInvocationSelection:None |
Comment on lines
+5
to
+6
| // GroupId for a broadcasting launch only. The thread group ID is legal, so the | ||
| // debugger discriminates invocations within a group by SV_GroupThreadID. |
Comment on lines
+6289
to
+6290
| // it. The thread group ID is legal, and discriminates invocations within one | ||
| // group. |
Comment on lines
+360
to
+362
| PassOutput RunDebugPassWithParameters(IDxcBlob *dxil, unsigned parameter0, | ||
| unsigned parameter1, | ||
| unsigned parameter2) { |
Austin Kinross (austinkinross)
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The debug instrumentation pass numbers the instructions of a callable shader and advertises them to PIX, but it emits no instrumentation for it. PIX offers a callable shader that it can never step into.
Every node shader uses a selection criterion that is always true. Every invocation matches, so the debugger shows whichever invocation reaches the UAV first, and that differs between runs.
A callable shader has neither a ray nor a thread of its own. dx.op.dispatchRaysIndex is legal in it, and it reports the ray generation index responsible for the call. PIX selects a ray generation, any-hit, closest-hit, or miss invocation on that same identity, so a callable invocation uses it too.
For a node shader, the pass selects by launch type. A broadcasting node is dispatched over a grid, so SV_DispatchThreadID names one invocation, as it does for a compute shader. A coalescing node has only the position of a thread within its group, so the selection narrows to the group size. A thread launch node has no thread identity at all, so every invocation stays of interest.
The pass report names which case applies, so the caller can present the selection as exact or approximate.
Assisted-by: Copilot
Stack created with GitHub Stacks CLI • Give Feedback 💬