[PIX] Fix shared instrumentation resource handling - #8842
Open
Damyan Pepper (damyanp) wants to merge 1 commit into
Open
[PIX] Fix shared instrumentation resource handling#8842Damyan Pepper (damyanp) wants to merge 1 commit into
Damyan Pepper (damyanp) wants to merge 1 commit into
Conversation
More than one PIX pass can run on the same module. Each pass adds its own tools UAV, so a pipeline with two passes makes two resources at the same register and space. The code that adds this UAV to a root signature has three unsafe paths. Root signature serialization can fail and give a null blob, which the code then reads. An empty result can replace a correct root signature. Only the first global root-signature subobject gets the new parameter, so a state object that declares more than one is left in a mixed state. The tools UAV is a raw buffer, so it changes the shader flags of the module. The code does not compute the flags again. Some passes make a dx.op overload declaration and then find no callers for it. They leave the declaration in the module, and the validator refuses a module that has an unused declaration. When serialization fails, the helpers keep the original root signature. A valid signature is better than an empty one. Assisted-by: Copilot Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93
Damyan Pepper (damyanp)
requested a review
from Austin Kinross (austinkinross)
August 27, 2026 22:45
Austin Kinross (austinkinross)
approved these changes
Aug 27, 2026
Member
Author
|
/azp run |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes PIX instrumentation resource reuse, root-signature handling, shader flags, and unused DXIL operation declarations.
Changes:
- Reuses tools UAVs and safely updates all global root signatures.
- Recomputes shader flags and centralizes unused declaration cleanup.
- Adds regression and validation coverage for affected PIX passes.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tools/clang/unittests/HLSL/PixTest.cpp |
Adds PIX resource, root-signature, flags, cleanup, and validation tests. |
tools/clang/test/HLSLFileCheck/pix/pixelCounterEarlyZ.hlsl |
Updates expected raw-buffer shader flags. |
lib/DxilPIXPasses/PixPassHelpers.h |
Exposes the operation cleanup helper. |
lib/DxilPIXPasses/PixPassHelpers.cpp |
Implements UAV reuse, root-signature updates, flags, and cleanup. |
lib/DxilPIXPasses/DxilRemoveDiscards.cpp |
Removes unused discard declarations. |
lib/DxilPIXPasses/DxilPIXMeshShaderOutputInstrumentation.cpp |
Cleans obsolete mesh operation overloads. |
lib/DxilPIXPasses/DxilPIXAddTidToAmplificationShaderPayload.cpp |
Cleans the replaced dispatch declaration. |
lib/DxilPIXPasses/DxilOutputColorBecomesConstant.cpp |
Cleans unused output overloads. |
lib/DxilPIXPasses/DxilNonUniformResourceIndexInstrumentation.cpp |
Cleans unused instrumentation operations. |
lib/DxilPIXPasses/DxilDebugInstrumentation.cpp |
Removes obsolete UAV-selection logic. |
lib/DxilPIXPasses/DxilDebugBreakInstrumentation.cpp |
Uses centralized operation cleanup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+246
to
249
| ExtendRootSig<DxilRootSignatureDesc1, DxilRootParameter1>(rs->Desc_1_1, | ||
| toolsUAVRegister); | ||
| rs->Desc_1_1.pParameters[rs->Desc_1_1.NumParameters - 1].Descriptor.Flags = | ||
| hlsl::DxilRootDescriptorFlags::None; |
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.
More than one PIX pass can run on the same module. Each pass adds its own tools UAV, so a pipeline with two passes makes two resources at the same register and space.
The code that adds this UAV to a root signature has three unsafe paths. Root signature serialization can fail and give a null blob, which the code then reads. An empty result can replace a correct root signature. Only the first global root-signature subobject gets the new parameter, so a state object that declares more than one is left in a mixed state.
The tools UAV is a raw buffer, so it changes the shader flags of the module. The code does not compute the flags again. Some passes make a dx.op overload declaration and then find no callers for it. They leave the declaration in the module, and the validator refuses a module that has an unused declaration.
When serialization fails, the helpers keep the original root signature. A valid signature is better than an empty one.
Assisted-by: Copilot
Stack created with GitHub Stacks CLI • Give Feedback 💬