Skip to content

D3D12.X: DRED's VA 0 output follows the device state it comes with - #3119

Open
Raul-Paiva wants to merge 1 commit into
xcl-dev:mainfrom
Raul-Paiva:d3d12x/dred-no-fault-at-va0
Open

Raul-Paiva wants to merge 1 commit into
xcl-dev:mainfrom
Raul-Paiva:d3d12x/dred-no-fault-at-va0

Conversation

@Raul-Paiva

@Raul-Paiva Raul-Paiva commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

On a device removal, log_device_removed logged DRED's page-fault output as a fault unconditionally. When the output is VA 0 with no allocation named, the log said DRED page fault at GPU VA 0x0; allocations there: []; recently freed: [], which reads as a real fault at VA 0; logs of this shape were discussed as VA 0 faults in #2920 and #3052. DRED gives that output when it recorded no fault, but the allocation lists can be empty for a real fault too. The DRED device state read just before tells the two apart, so the log now follows it. With XCL_DRED=pagefault the breadcrumbs are never switched on, yet the log said no breadcrumbs (no list was in flight).

Log changes (wording only, no behaviour change):

  • VA 0 with no existing and no recently freed allocation:
  • Device state 0 is UNKNOWN and is logged as DRED device state: 0 (unknown); nothing infers from it whether the GPU's work faulted.
  • A failed GetPageFaultAllocationOutput logs its HRESULT when XCL switched the page-fault output on: DRED page-fault output not available (<hr>). Without XCL_DRED: DRED: no page-fault output (not switched on; XCL_DRED=1 or XCL_DRED=pagefault does).
  • Breadcrumbs not switched on: DRED: no breadcrumbs (not switched on; XCL_DRED=1 does). Switched on and no node returned: DRED: no breadcrumbs (empty output).

Review points from Prime1997 (state 0 unknown, the query's error, VA 0 kept ambiguous, "empty output") and Foniass (the device state decides VA 0, the output not switched on, tests of the wording) are in the single commit.

What is in it

  • crates/xcl/src/hle/d3d12x/real.rs: dred_unplaced_page_fault (the line for VA 0 with no allocation named, by device state), dred_page_fault_missing and dred_breadcrumbs_missing (the lines for an output DRED did not give, switched on or not), pure helpers; their tests dred_output_at_va_0_with_no_allocations_follows_the_device_state and missing_dred_output_says_whether_it_was_switched_on in dred_tests; the log lines in log_device_removed.
  • crates/xcl/src/gpu/agility.rs: dred_switched_on, what enable_dred_once switched on (nothing, the page faults, or the breadcrumbs too); its test dred_outputs_are_on_only_when_the_settings_took.

Tested

  • Hardware: RTX 3070 Laptop GPU 8 GB, driver 621.40, i7-11800H, 32 GB, Windows 10 19045, rustc 1.100.0, release build.
  • Base for the comparison: main 5b0d5fa (same commands, same machine). The head pushed here is this change, with the review fixes of 12-01, rebased onto main b2b1f10 without conflicts; main's newer commits also change real.rs, which the rebase merged. The full-suite counts below were measured before those fixes and that rebase.
  • At this head efb8790 (with the review fixes, on main b2b1f10), the lib tests of the modules this PR touches (gpu::agility, hle::d3d12x::real), release, serial, with the 20 skips: 185 passed, 0 failed, 0 ignored, the three new tests among them.
  • cargo test --release --workspace --no-fail-fast -- --test-threads=4: the lib test binary ends early on main too (exit 0x80004005 after sparse upload preparation still failed after bounded retries), so the lib was also run alone, serially (--test-threads=1), with --skip for the 20 tests that end the binary on main (6 list_x, 12 sparse, 1 texture_upload, 1 uma_driver; each passes alone).
  • This PR tested at 436dff78 (on main 5b0d5fa):
    • integration tests (all binaries but the lib): 139 passed, 0 failed, 20 ignored; main: the same.
    • lib, serial with the 20 skips: 2603 passed, 15 failed, 29 ignored; main: 2604 passed, 13 failed, 29 ignored.
    • The test of the first version, dred_output_at_va_0_with_no_allocations_is_ambiguous (now ..._follows_the_device_state), passes. The 13 failures of main fail here too (12 title_textures, 1 vram::d32s8_targets_take_their_own_size_of_video_memory).
    • The 2 failures only in this run, alloc_pool::tests::a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_reads and vram::tests::superseded_texture_waits_for_every_title_queue, pass alone 3/3 on this head and on main, and their whole modules pass serially 2/2 here; they wait on GPU fences and fail only late in the long run. They do not reach the code this PR changes.
  • SKIPPED on this adapter (same on main): the wave64 forms (no wave64), three f16/f32 per-lane forms refused by the recompiler, and the heap-window tests (no heap windows).

Regression run
scripts/smoke.ps1 -Seconds 120 -Title 'retail title A', release builds of clean trees, one after the other on the machine in Tested, with XCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000. The title is left on its own, with no input; the shader cache was warmed by two runs of main before.

main:

xcl-smoke v1
commit: b2b1f109d27e746a62ec95b04dd1f9924452e682
gpu: NVIDIA GeForce RTX 3070 Laptop GPU
title: retail title A
seconds: 120
exit: 0x0
frames shown: 3358 (PresentX 3358)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 15865 MB

This PR:

xcl-smoke v1
commit: efb879063f590a6c8725486bda8264d45a09c577
gpu: NVIDIA GeForce RTX 3070 Laptop GPU
title: retail title A
seconds: 120
exit: 0x0
frames shown: 3366 (PresentX 3366)
presents per 2 s (last 3): 61 60 61
device removals: 0
crashes: 0
peak commit: 16918 MB

Not tested

  • A device removal with the new wording: no removal happened in these runs.
  • A removal with the breadcrumbs on.
  • AMD and Intel GPUs.

AI use

  • Claude Code (Claude Opus 5.5) wrote the change, the test and this description, and ran the tests; I read the diff.

🤖 Generated with Claude Code

@Raul-Paiva
Raul-Paiva force-pushed the d3d12x/dred-no-fault-at-va0 branch from bf39c45 to 284d140 Compare November 28, 2026 11:43
@Prime1997

Copy link
Copy Markdown
Collaborator

Source review of 284d1401f2061c16f1f5e93f0b9a3bbd4064eac4: this partially overlaps our local diagnostics correction, so I’m bringing the remaining points here rather than opening another diagnostics PR.

  • DRED state 0 is UNKNOWN; it does not establish that GPU work caused no fault. The PR description and dred_recorded_fault comment currently make that inference. Microsoft enum reference.
  • A failed GetPageFaultAllocationOutput call is currently silent. Its HRESULT should be logged: Microsoft documents DXGI_ERROR_UNSUPPORTED when page-fault reporting was not enabled, and DXGI_ERROR_NOT_CURRENTLY_AVAILABLE when the device is not removed. Missing output is not a negative fault finding. Microsoft method reference.
  • VA 0 plus empty allocation lists is ambiguous. The lists describe matching active/recent allocations and may be empty; the documented contract does not require a real VA-zero fault to identify an allocation. Please preserve that uncertainty in the new helper/test and wording, especially when device state is unknown. Microsoft output structure.
  • Distinguishing explicitly disabled breadcrumbs is useful. The enabled-but-empty branch should say “empty output,” rather than infer that no list was in flight.

Our small reporting correction labels UNKNOWN, logs page-fault query errors and removes the empty-breadcrumb inference. It does not implement your VA-zero or disabled-breadcrumb changes. No new diagnostic settings are enabled. This is source review only; no tests or native reproduction were run for these points.

AI use: OpenAI Codex (GPT-6) inspected the exact diff and Microsoft references and prepared this follow-up.

Optional contributor/test coordination: https://discord.gg/gK3y7WRRY

@JJAutoCompare

Copy link
Copy Markdown

Tested

Independently reran the pinned standalone CPU test for 284d1401f2061c16f1f5e93f0b9a3bbd4064eac4 on Windows 11 x64 build 26200.9974 with a Ryzen 7 3800X. The executable was built with Rust 1.100.1 (x86_64 MSVC). I verified that the harness copies DRED, dred_request, and dred_breadcrumbs_on byte for byte from the tested commit.

Ran predicate.exe --exact <state>_<input> --nocapture --test-threads=1 in 12 separate processes. The state filters were uninitialized, initialized_none, initialized_err, and initialized_ok. The input filters unset, pagefault, and one set the child’s XCL_DRED to absent, pagefault, and 1, respectively.

All 12 processes exited 0 (12 passed, 0 failed, 0 ignored, 0 skipped). Each case asserted the raw environment value, synthetic OnceLock state, and predicate result. Only initialized_ok_one returned true.

Not tested

Runtime DRED initialization, GPU or D3D12 operation, device removal, page-fault or breadcrumb output, title smoke, and the workspace suite.

AI use

T3 Code through Codex (gpt-6.2-sol, high) prepared the standalone harness, verified the source and executable pins, independently reran the cases, and drafted this report.

@Prime1997
Prime1997 changed the base branch from nvidia-dev to main November 28, 2026 20:13
@Raul-Paiva
Raul-Paiva force-pushed the d3d12x/dred-no-fault-at-va0 branch from 284d140 to 07dd787 Compare November 30, 2026 00:12
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) labels Nov 30, 2026
@Raul-Paiva

Copy link
Copy Markdown
Contributor Author

Thanks for the review. All four points are in, folded into the single commit; the PR is rebased onto main and its head is now 07dd7879.

  1. State 0 is UNKNOWN: adopted. It is logged as DRED device state: 0 (unknown), and the comment, commit message and description no longer say that 0 means the GPU's work did not fault.
  2. GetPageFaultAllocationOutput error: adopted. A failed call now logs DRED page-fault output not available (<HRESULT>) instead of nothing.
  3. VA 0 with empty lists is ambiguous: adopted. The helper is now dred_unplaced_page_fault, which returns the line for that case: VA 0x0, no allocations named (no fault recorded, or a fault DRED could not place). Its test (dred_output_at_va_0_with_no_allocations_is_ambiguous) checks that the line keeps both readings and that a non-zero VA or any named allocation is still logged as a fault.
  4. Enabled but empty breadcrumbs: adopted. That branch now says no breadcrumbs (empty output); the disabled case (XCL_DRED=pagefault) still says they are not switched on.

The full suite was run against main on an RTX 3070 Laptop; the counts are in the description (no new failure). The smoke runs are still to come.

Written with Claude Code (Claude Opus 5.5).

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 1c89197

No open or merged PR makes the same change. No problems found in the diff. dred_unplaced_page_fault is only used for VA 0 with both allocation lists empty, dred_breadcrumbs_on follows enable_dred_once / dred_request, and the test covers the helper.
Recommendation: keep open.

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

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

merge-check
base: 493dbd3
head: 1c89197
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2901 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+41/-8). Findings: (1) It ignores the DRED device state read just above (real.rs ~12458). State 7 (PAGEFAULT) means a page fault happened. #2920's rows b-d are exactly that: state 7, VA 0x0, no allocations, during Dispatch / DispatchMesh / ExecuteIndirect, real null-address faults. This PR would log them as "no fault recorded, or a fault DRED could not place" (dred_unplaced_page_fault ~12432). The no-fault removals in #2920 (RTX 4080) and #3052 are the state-0 ones. PageFaultFlags (DRED 1.3) defines only NONE, so it can't separate the two. Passing the state in, keeping the fault line for state 7, and using the ambiguous line only when the state is unknown would keep both cases right. (2) Without XCL_DRED page-fault reporting is off, so every removal may now log "page-fault output not available" (unverified). (3) The one test covers the pure helper and builds in the state-blind behaviour; dred_breadcrumbs_on and the breadcrumb wording are untested. Fine: state 0 is labelled unknown, the query's HRESULT is logged, and "breadcrumbs not switched on" is now told apart from "empty output". This code runs only after a device removal, so no smoke run.
performance: no smoke run (the default path doesn't reach this change); not measured. Runs only after a device removal.
verdict: not yet: it ignores the DRED device state it reads just above, so real null-address page faults (state 7, VA 0, as in #2920) would be logged as "no fault recorded"; keep the fault line for state 7 and use the ambiguous line only when the state is unknown
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

When the device is removed, DRED's page-fault output can be VA 0 with no
allocations named. The log said "DRED page fault at GPU VA 0x0;
allocations there: []", which reads as a real fault at VA 0. DRED gives
that when it recorded no fault, but the allocation lists may be empty for
a real fault too. The device state read just before tells the two apart:
- state 7 (PAGEFAULT): a page fault happened; it is logged as a fault at
  VA 0x0, as before (the null-address faults of xcl-dev#2920);
- another known state (3 hung, 6 fault): "no page fault: the device state
  is another removal";
- state 0 (UNKNOWN) or no state: "no fault recorded, or a fault DRED
  could not place".
An address other than 0, or any allocation named, is logged as before.
Here, removals with device state 0 and that output were not GPU page
faults.

DRED device state 0 is UNKNOWN, not "the GPU's work did not fault": it is
now logged as "0 (unknown)" and the comment no longer infers it.

A failed GetPageFaultAllocationOutput was silent. Its HRESULT is now
logged when XCL switched the page-fault output on; without XCL_DRED the
log says it is not switched on (agility::dred_switched_on).

With XCL_DRED=pagefault the breadcrumbs are never switched on, yet the log
said "no list was in flight". It now says they are not switched on; with
them on and no node returned, it says "empty output" instead of inferring
that no list was in flight.

Review by Prime1997 (device state 0 as unknown, the page-fault query
error, VA 0 kept ambiguous, "empty output") and Foniass (the device state
decides VA 0, the output not switched on, tests of the wording).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Raul-Paiva
Raul-Paiva force-pushed the d3d12x/dred-no-fault-at-va0 branch from 1c89197 to efb8790 Compare December 1, 2026 13:45
@github-actions github-actions Bot added the area:tests Unit, integration, e2e tests, or testtitle label Dec 1, 2026
@Raul-Paiva Raul-Paiva changed the title D3D12.X: a removal with no fault recorded is not logged as a fault at VA 0 D3D12.X: DRED's VA 0 output follows the device state it comes with Dec 1, 2026
@Raul-Paiva

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Head is now efb8790 (rebased onto main b2b1f10), with fixes for all three points, squashed into the one commit:

  1. The device state now decides VA 0. dred_unplaced_page_fault takes the state read just above it:
  2. Output not switched on. A failed GetPageFaultAllocationOutput logs its HRESULT only when XCL switched the page-fault output on (agility::dred_switched_on). Without XCL_DRED, the log says it is not switched on and how to switch it on, as the breadcrumbs line already did.
  3. Tests. The wording is now in pure helpers with tests:
    • dred_output_at_va_0_with_no_allocations_follows_the_device_state covers states 0, 3, 6, 7 and none;
    • missing_dred_output_says_whether_it_was_switched_on covers the page-fault and breadcrumb lines: not switched on, an error, and empty output;
    • dred_outputs_are_on_only_when_the_settings_took covers dred_switched_on.

Tested on an RTX 3070 Laptop (driver 621.40): the modules this PR touches (gpu::agility, hle::d3d12x::real), release, serially, gave 185 passed, 0 failed.

The new lines have not been seen in a real removal yet: no removal happened in my runs.

Claude Code (Claude Opus 5.5) helped with the fixes and this reply; I checked each point.

@fromthemoonx

fromthemoonx commented Dec 1, 2026 •

Copy link
Copy Markdown

merge-check
base: 6bfb5c5
head: efb8790
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2907 passed, 0 failed, 51 ignored (base: 2904 passed, 0 failed, 51 ignored); SKIPPED: 25 (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps), the same set as base; failing: none
review: read the whole diff (3 files, +125 -13). No correctness problem found; log wording only.

  • log_device_removed now passes the DRED device state to dred_unplaced_page_fault. VA 0 with no allocations named is still logged as a fault at VA 0 for state 7 (page fault), and gets its own line for 3 / 6 and for 0 / no state.
  • A missing page-fault output or missing breadcrumbs now say whether DRED was switched on. dred_switched_on reads enable_dred_once's result and XCL_DRED.
  • The three new tests (dred_output_at_va_0_with_no_allocations_follows_the_device_state, missing_dred_output_says_whether_it_was_switched_on, dred_outputs_are_on_only_when_the_settings_took): 3 of 3 runs passed.
  • Mutation: the state 3 / 6 branch off (Some(s) if false && ...) fails dred_output_at_va_0_with_no_allocations_follows_the_device_state. Good.
  • Not run here: a real device removal with XCL_DRED=1 / =pagefault. The new lines were checked through the helpers only.
    performance: none: removal path only.
    verdict: safe to merge
    hardware / tool and model: RTX 3060 12 GB (610.88), Ryzen 7 5700X, Windows 11 Pro 26300 / Claude Code (Claude Opus 5.5)

@github-actions github-actions Bot added needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:amd-test Needs a test report or merge-check on an AMD GPU needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) and removed needs-1st-check Passes gates; needs first independent merge-check (#3041) needs:nvidia-test Needs a test report or merge-check on an NVIDIA GPU labels Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up review (head efb8790, since 1c89197, diff read, not a merge-check):

  • The DRED device state is ignored at VA 0: fixed. dred_unplaced_page_fault now takes the state log_device_removed reads (real.rs ~12543-12553): state 7 still logs DRED page fault at GPU VA 0x0 (~12494), states 3 and 6 say "no page fault", and the ambiguous line is only for state 0 or no state (~12497-12499).
  • "Page-fault output not available" on every removal without XCL_DRED: fixed. The HRESULT is logged only when agility::dred_switched_on() says XCL turned the output on; otherwise the line says it is not switched on (real.rs ~12503-12510, ~12557-12560; agility.rs ~405-415).
  • The test checked only the helper and only the state-blind behaviour: fixed. dred_output_at_va_0_with_no_allocations_follows_the_device_state covers states 7, 3, 6, 0 and none plus a non-zero VA and named allocations; missing_dred_output_says_whether_it_was_switched_on and dred_outputs_are_on_only_when_the_settings_took cover the wording and dred_on.

New: none. Open #2131 rewrites the same GetPageFaultAllocationOutput block, so whichever merges second needs a rebase.

Fine: only log lines change, only after a device removal; breadcrumbs are on only with XCL_DRED=1, matching enable_dred_once.

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

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

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:tests Unit, integration, e2e tests, or testtitle gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) needs:amd-test Needs a test report or merge-check on an AMD GPU needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants