Skip to content

[PIX] Add validation support to PIX pass tests - #8841

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

[PIX] Add validation support to PIX pass tests#8841
Damyan Pepper (damyanp) wants to merge 5 commits into
mainfrom
users/damyanp/pix-fixes-01

Conversation

@damyanp

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

Copy link
Copy Markdown
Member

Part 1 of 14 in the PIX instrumentation stack. It targets main. It is the stack floor, and the later layers use the test helpers it adds.

The PIX passes change DXIL after the compiler completes. A pass can add a resource, change a root signature, insert an operation, and remove a declaration. The result can be a module that the validator refuses. The tests only examine the disassembly, so they cannot find this type of defect.

The new helpers run the DXIL validator on the output of a pass. They also separate the diagnostics that PIX instrumentation is permitted to cause from the diagnostics that are defects. The set of permitted diagnostics decides what every later layer can ignore, so it is the part to examine with care.

There is no change to the compiler.

Assisted-by: Copilot

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


Stack created with GitHub Stacks CLIGive Feedback 💬

The PIX passes change DXIL after the compiler completes. A pass can add a resource, change a root signature, insert an operation, and remove a declaration. The result can be a module that the validator refuses. The tests only examine the disassembly, so they cannot find this type of defect.

The new helpers run the DXIL validator on the output of a pass. They also separate the diagnostics that PIX instrumentation is permitted to cause from the diagnostics that are defects. The set of permitted diagnostics decides what every later layer can ignore, so it is the part to examine with care.

There is no change to the compiler.

Assisted-by: Copilot

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93

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

Adds a validation harness for PIX pass test outputs.

Changes:

  • Adds single-pass execution and DXIL validation helpers.
  • Filters permitted PIX metadata diagnostics.
  • Adds control tests for valid and invalid outputs.

💡 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 on lines +3711 to +3713
FilteredValidationDiagnostics realDiagnostic =
GetSignificantValidationDiagnostics("Validation failed.\n"
"Some real validator diagnostic.\n");
Comment thread tools/clang/unittests/HLSL/PixTest.cpp Outdated
Comment on lines +361 to +363
if (line.find("All metadata must be used by dxil") != std::string::npos) {
result.PermittedExceptionCount++;
continue;
Virtual-register annotation attaches metadata that DXIL does not
consume, so validation of an instrumented module always reported a
generic "unused metadata" diagnostic even when the module was otherwise
correct. The prior handling matched that diagnostic by substring, which
would also swallow a genuinely unrelated unused-metadata defect.

Replace it with a structural check: on direct validation failure, clone
the module, strip only the four known PIX virtual-register metadata
kinds, and revalidate. Accept only if the stripped clone validates,
proving PIX metadata was the sole cause.

Rework Validation_ControlInvalidModuleFails so the corrupted container
itself proves both facts independently: direct validation's diagnostic
confirms the permitted PIX metadata is present and unused, and the
harness's rejection confirms a real, non-boilerplate defect remains.

Replace Validation_ControlBoilerplateOnlyFailureIsRejected, which
exercised the removed string classifier, with
Validation_ControlNonPixUnusedMetadataIsRejected: a foreign metadata
kind alongside the module's own PIX metadata must still be rejected
after the four-kind strip.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apply the repository's almost-never-auto convention to every remaining auto introduced by the L1 original and direct-feedback commits. Use the declared Compile and RunSinglePass result types and std::string::size_type for the find result. No behavior changes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 3, 2026 01:28

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.

🟡 Changes recommended

Fresh container reconstruction can hide container-level validation defects.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread tools/clang/unittests/HLSL/PixTest.cpp
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 3, 2026 01:49

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.

🔵 Needs a closer look

Container reconstruction can mask genuine root-signature or PSV validation failures.

Review details

Suppressed comments (1)

tools/clang/unittests/HLSL/PixTest.cpp:400

  • Reassembling the stripped module changes more than the permitted PIX metadata: the assembler regenerates derived parts such as PSV/signatures and this clone path does not restore container-only state such as RTS0/RDAT. Therefore, if direct validation reports both unused PIX metadata and a real container/module mismatch (for example an incompatible root signature or stale PSV), the second validation can see the mismatch repaired or removed and incorrectly return Valid. Preserve the original non-module container parts while replacing only the metadata-stripped DXIL payload, and add a control case for a container-part mismatch.
    CComPtr<IDxcBlob> strippedContainer =
        CloneModuleAndMutate(pContainer, StripKnownPixVirtualRegisterMetadata);
    if (RunValidator(strippedContainer).Valid) {
  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

4 participants