Skip to content

D3D12.X: add GPU-based validation behind XCL_D3D12_GBV - #3208

Draft
Dremaus wants to merge 1 commit into
xcl-dev:mainfrom
Dremaus:d3d12x/gpu-based-validation
Draft

Dremaus wants to merge 1 commit into
xcl-dev:mainfrom
Dremaus:d3d12x/gpu-based-validation

Conversation

@Dremaus

@Dremaus Dremaus commented Nov 28, 2026

Copy link
Copy Markdown

Adds GPU-based validation behind XCL_D3D12_GBV. GBV runs shader-side checks the plain debug
layer and DRED miss — out-of-bounds UAV/descriptor access, SetMeshOutputCounts past the declared
maximum, resource-state and RT/DSV format mismatches — which is the fault class that removes the
device with no page fault (the symptom behind the two-pass mesh hang, 0x887A0005).

What is in it

  • agility::enable_gpu_based_validation() in crates/xcl/src/gpu/agility.rs: ID3D12Debug1,
    debug layer + SetEnableGPUBasedValidation(true), once per process, before device creation.
  • Wired in at crates/xcl/src/hle/d3d12x/real.rs (game path) and gpu/recomp/runner.rs (test
    runner). The existing info-queue message callback now also fires for GBV, so validation
    messages reach xcl.log rather than only a debugger.
  • README documents the switch.

This builds on the existing debug-layer and DRED plumbing and does not change it.

Tested

  • cargo build -p xcl --lib: builds clean.
  • Not yet run on a GPU. To run: a matching-version D3D12SDKLayers.dll next to D3D12Core.dll,
    then launch a title with XCL_D3D12_GBV=1 and read xcl.log.

Regression run

  • Runtime change (real.rs, agility.rs, runner.rs): needs the two xcl-smoke blocks
    (main vs this head) — pending the GPU run. Draft until then. The switch is off by default, so a
    default run exercises none of the new path.

Not tested

  • The GPU run with GBV enabled.

AI use

  • Claude Code, Claude Opus 4.8 — wrote the change.

🤖 Generated with Claude Code

GPU-based validation runs shader-side checks the plain debug layer and DRED
miss - out-of-bounds UAV/descriptor access, SetMeshOutputCounts past the
declared maximum, resource-state and RT/DSV format mismatches - the fault
class that removes the device with no page fault.

agility::enable_gpu_based_validation enables the debug layer plus
SetEnableGPUBasedValidation (ID3D12Debug1) once, before device creation. It
is wired into the game path (real.rs) and the test runner, and the existing
info-queue message callback now also fires for GBV so validation messages
reach xcl.log instead of only a debugger. Off by default; builds on the
existing debug-layer and DRED plumbing without changing it. README documents
the switch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Review (head 4fe6a83, diff read, not a merge-check; draft, conflicts with main, PR description red):

  • The conflict is a design change on main, not just text. Main moved DRED setup into agility::create_device (enable_dred_once), because devices can be created before init_with_remap. This PR turns GBV on in two callers only (real.rs ~808-828, runner.rs ~92). Devices are also made in bind.rs ~5599, texture.rs ~927 and offline_cold_profile.rs, and turning the debug layer on after one of them has made a device removes that device. After the rebase, GBV belongs in create_device, next to enable_dred_once. Unverified whether those creators run before the title's device in a real launch.
  • Unverified: how GBV interacts with pipeline_library::activate, and with library blobs made without it.
  • There is no GPU run, suite count or smoke pair yet, which is why PR description fails.

Fine:

  • Off by default, and called before device creation in both paths.
  • It is set through ID3D12Debug1 from configuration_interface, so it configures the Agility SDK's debug interface.
  • A repeated EnableDebugLayer is harmless.
  • The info-queue callback is registered for GBV alone (~876).
  • The README is updated.

Main has nothing like it yet; #3349 turns GBV on only inside one of its own tests.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head 4fe6a83

No open or merged PR adds GPU-based validation. One point: real.rs and runner.rs check XCL_D3D12_GBV with var_os(...).is_some(), so XCL_D3D12_GBV=0 also turns it on, while the README describes =1. Either parse the value or say "any value" in the README. Not yet run on a GPU (per the description).

Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants