Skip to content

[PIX] Select callable and node shader debug invocations - #8854

Open
Damyan Pepper (damyanp) wants to merge 1 commit into
users/damyanp/pix-fixes-12from
users/damyanp/pix-fixes-13
Open

[PIX] Select callable and node shader debug invocations#8854
Damyan Pepper (damyanp) wants to merge 1 commit into
users/damyanp/pix-fixes-12from
users/damyanp/pix-fixes-13

Conversation

@damyanp

@damyanp Damyan Pepper (damyanp) commented Aug 28, 2026

Copy link
Copy Markdown
Member

Part 13 of 14 in the PIX instrumentation stack. It targets users/damyanp/pix-fixes-12, and extends the helpers it introduces.

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

This changes only the PIX instrumentation, so it needs no release note.


Stack created with GitHub Stacks CLIGive Feedback 💬

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

3 participants