Repository navigation
[PIX] Record only real resource accesses, including samplers - #8847
Damyan Pepper (damyanp) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Corrects PIX shader access tracking to record genuine resource accesses, including library samplers, while excluding annotations and barriers.
Changes:
- Adds sampler matching for library handles.
- Excludes
AnnotateHandleand resource barriers from access records. - Adds FileCheck and validation coverage.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
lib/DxilPIXPasses/DxilShaderAccessTracking.cpp |
Updates resource matching and non-access exclusions. |
tools/clang/unittests/HLSL/PixTest.cpp |
Extends pass configuration and validation tests. |
tools/clang/test/HLSLFileCheck/pix/AccessTrackingLibAnnotateHandleIsNotAnAccess.hlsl |
Tests annotation exclusion. |
tools/clang/test/HLSLFileCheck/pix/AccessTrackingLibAnnotatedHandleReadStillRecorded.hlsl |
Tests accesses through annotated handles. |
tools/clang/test/HLSLFileCheck/pix/AccessTrackingBarrierIsNotAnAccess.hlsl |
Tests barrier exclusion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused behavior changes have targeted coverage; remaining feedback is non-blocking style cleanup.
Review effort: Balanced
Findings: 2
Open (6)
The default pass configuration declares only UAV ranges, but this shader accesses an SRV and a… This helper does not actually constrain the match to the byte-offset operand:i32 264in any… Spell out the inferred types explicitly · New This changes user-visible PIX access records and fixes sampler bindings being reported as unused,… Please spell out this simple return type under the repository's almost-never-autoconvention;… Please use explicit types for these straightforward locals under the repository's…
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is focused and adequately tested, with only minor style and spelling feedback outstanding.
Review effort: Balanced
Findings: 2
Open (8)
The default pass configuration declares only UAV ranges, but this shader accesses an SRV and a… This helper does not actually constrain the match to the byte-offset operand:i32 264in any… Fix misspelling of delimiter · New Use explicit std::string type instead of auto · New Spell out the inferred types explicitly This changes user-visible PIX access records and fixes sampler bindings being reported as unused,… Please spell out this simple return type under the repository's almost-never-autoconvention;… Please use explicit types for these straightforward locals under the repository's…
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The sampler regression assertion can falsely accept an incorrect byte offset, and new declarations violate the explicit-type convention.
Review effort: Balanced
Findings: 2
Open (8)
The default pass configuration declares only UAV ranges, but this shader accesses an SRV and a… This helper does not actually constrain the match to the byte-offset operand:i32 264in any… Use explicit std::string type instead of auto Fix misspelling of delimiter Spell out the inferred types explicitly This changes user-visible PIX access records and fixes sampler bindings being reported as unused,… Please spell out this simple return type under the repository's almost-never-autoconvention;… Please use explicit types for these straightforward locals under the repository's…
80a9c34 to
79770f0
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation is focused and well tested; the remaining findings are minor explicit-type convention issues.
Review effort: Balanced
Findings: 2
Open (8)
The default pass configuration declares only UAV ranges, but this shader accesses an SRV and a… This helper does not actually constrain the match to the byte-offset operand:i32 264in any… Use explicit std::string type instead of auto Fix misspelling of delimiter Spell out the inferred types explicitly This changes user-visible PIX access records and fixes sampler bindings being reported as unused,… Please spell out this simple return type under the repository's almost-never-autoconvention;… Please use explicit types for these straightforward locals under the repository's…
79770f0 to
810a923
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The behavioral changes have focused regression coverage; remaining feedback concerns only explicit-type conventions.
Review effort: Balanced
Findings: 2
Open (8)
The default pass configuration declares only UAV ranges, but this shader accesses an SRV and a… This helper does not actually constrain the match to the byte-offset operand:i32 264in any… Use explicit std::string type instead of auto Fix misspelling of delimiter Spell out the inferred types explicitly This changes user-visible PIX access records and fixes sampler bindings being reported as unused,… Please spell out this simple return type under the repository's almost-never-autoconvention;… Please use explicit types for these straightforward locals under the repository's…
810a923 to
fa0c17b
Compare
Exclude annotateHandle and barrierByMemoryHandle from access records while still tracing annotated handles for real accesses. Match library sampler handles so sampler accesses are recorded, with regression coverage for these paths. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93
fa0c17b to
6d4c693
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The user-visible PIX behavior fix needs release-note coverage or confirmation of planned shared coverage.
0 open findings
8 resolved since last review
The default pass configuration declares only UAV ranges, but this shader accesses an SRV and a… This helper does not actually constrain the match to the byte-offset operand:i32 264in any… Use explicit std::string type instead of auto Fix misspelling of delimiter Spell out the inferred types explicitly This changes user-visible PIX access records and fixes sampler bindings being reported as unused,… Please spell out this simple return type under the repository's almost-never-autoconvention;… Please use explicit types for these straightforward locals under the repository's…
🧠 Review effort: Balanced
| // ResourceAccessStyle in the next four. RayGeneration is 7 and SRVRead is | ||
| // 5, so 0x75000000 == 1962934272. | ||
|
|
||
| // CHECK-NOT: bufferStore.i32(i32 69, %dx.types.Handle {{.*}}, i32 16, |
There was a problem hiding this comment.
nit: this will technically not catch the case if this operation is between any of the following 3 ops. I think there is a filecheck flag like -implicit-check-not that would check not everywhere. Not sure if it is in llvm 3.7 filecheck tho
There was a problem hiding this comment.
GitHub Copilot agent: Implemented in dc2ac17. The Windows FileCheck test wrapper rejects --implicit-check-not, so the test now repeats the offset-16 CHECK-NOT between every positive check, including before the first and after the last. The standard PIX FileCheck suite passes (71/71).
| for (const std::string &line : instrumentedLines) { | ||
| if (line.find("dx.op.bufferStore") != std::string::npos) { | ||
| hasBufferStore = true; | ||
| break; | ||
| } | ||
| } | ||
| VERIFY_IS_TRUE(hasBufferStore); |
There was a problem hiding this comment.
Check the indexed texture's store, not any bufferStore?
| for (const std::string &line : instrumentedLines) { | |
| if (line.find("dx.op.bufferStore") != std::string::npos) { | |
| hasBufferStore = true; | |
| break; | |
| } | |
| } | |
| VERIFY_IS_TRUE(hasBufferStore); | |
| const bool trackedIndexedTexture = std::any_of( | |
| instrumentedLines.begin(), instrumentedLines.end(), | |
| [](const std::string &line) { | |
| return line.find("call void @dx.op.bufferStore.i32(") != | |
| std::string::npos && | |
| line.find(", i32 %OffsetByteIndex,") != std::string::npos; | |
| }); | |
| VERIFY_IS_TRUE(trackedIndexedTexture); |
There was a problem hiding this comment.
GitHub Copilot agent: Implemented in dc2ac17. The test now requires a bufferStore with i32 %OffsetByteIndex after the handle, rather than accepting any bufferStore. The PixTest suite passes (73/73).
Finn Plummer (inbelic)
left a comment
There was a problem hiding this comment.
LGTUS Alex Sepkowski (@alsepkow) Deric C. (@Icohedron) - some nits inline
Check forbidden resource writes across every FileCheck interval and require the dynamic texture tracking store to use its computed byte offset. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93


Do not record handle annotations or memory barriers as resource accesses. Continue tracing annotated handles so genuine accesses are still recorded.
Record sampler accesses in library shaders so sampler bindings are not missed.
Tests cover annotation and barrier handling, library sampler records, and dynamically indexed resources.
Assisted-by: Copilot