Skip to content

[PIX] Record only real resource accesses, including samplers - #8847

Open
Damyan Pepper (damyanp) wants to merge 2 commits into
mainfrom
users/damyanp/pix-fixes-06
Open

Damyan Pepper (damyanp) wants to merge 2 commits into
mainfrom
users/damyanp/pix-fixes-06

Conversation

@damyanp

@damyanp Damyan Pepper (damyanp) commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

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

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

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 AnnotateHandle and 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.

Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Comment thread lib/DxilPIXPasses/DxilShaderAccessTracking.cpp
Copilot AI review requested due to automatic review settings September 29, 2026 02:24

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.

Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Copilot AI review requested due to automatic review settings September 29, 2026 16:26

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.

Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Copilot AI balanced review requested due to automatic review settings September 30, 2026 00:03

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.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 21:58

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.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 23:10

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.

Base automatically changed from users/damyanp/pix-fixes-05 to main October 6, 2026 21:00
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
Copilot AI balanced review requested due to automatic review settings October 7, 2026 18:03

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.

Comment thread lib/DxilPIXPasses/DxilShaderAccessTracking.cpp
// 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,

@inbelic Finn Plummer (inbelic) Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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).

Comment on lines +4937 to +4943
for (const std::string &line : instrumentedLines) {
if (line.find("dx.op.bufferStore") != std::string::npos) {
hasBufferStore = true;
break;
}
}
VERIFY_IS_TRUE(hasBufferStore);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Check the indexed texture's store, not any bufferStore?

Suggested change
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);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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).

@inbelic Finn Plummer (inbelic) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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
Copilot AI balanced review requested due to automatic review settings October 9, 2026 03:22

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.

🟢 Approval recommended

The focused implementation is consistent with the pass architecture and has appropriate regression coverage.

0 open findings

🧠 Review effort: Balanced

This branch has not been deployed

No deployments
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.

5 participants