Skip to content

D3D12.X: read DRED PageFault1 ObjectNameW and name internal resources - #2131

Open
Simon-CR wants to merge 1 commit into
xcl-dev:mainfrom
Simon-CR:pr/dred-pagefault1-names
Open

Simon-CR wants to merge 1 commit into
xcl-dev:mainfrom
Simon-CR:pr/dred-pagefault1-names

Conversation

@Simon-CR

Copy link
Copy Markdown

When DRED captures a page fault on Windows (XCL_DRED=1), ID3D12Object::SetName populates wide ObjectNameW strings in the DRED allocation nodes while leaving ANSI ObjectNameA empty. Because XCL only inspected ObjectNameA and did not name its own internal D3D12 buffers and heaps under XCL_DRED=1, page-fault logs printed unnamed type 34 entries without telling which XCL allocation backed a faulting GPU address. Part of #1452.

What is in it

  • Prefer wide ObjectNameW (with fallback to ObjectNameA) and query ID3D12DeviceRemovedExtendedData1::GetPageFaultAllocationOutput1 to include object pointers in crates/xcl/src/hle/d3d12x/real.rs
  • Name internal XCL D3D12 buffers and heaps when XCL_DRED=1 across crates/xcl/src/hle/d3d12x/real.rs, crates/xcl/src/hle/d3d12x/list_x.rs, crates/xcl/src/hle/d3d12x/bind.rs, crates/xcl/src/hle/d3d12x/sparse.rs, crates/xcl/src/hle/d3d12x/vram.rs, and crates/xcl/src/hle/d3d12x/title_textures.rs
  • Unit test verifying wide ObjectNameW preference and ObjectNameA fallback in crates/xcl/src/hle/d3d12x/real.rs (dred_tests)

Tested

Regression run

xcl-smoke v1
commit: 6020a33b16ba2de25b3aef5947552f2dc1831f09
gpu: AMD Radeon RX 9070 XT
title: 5ec87c56
seconds: 60
exit: 0x0
frames shown: 1483 (PresentX 1483)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 19090 MB
xcl-smoke v1
commit: 31d8f4bedf34742bcfcfc5787aa3ab01a4c65022
gpu: AMD Radeon RX 9070 XT
title: 5ec87c56
seconds: 60
exit: 0x0
frames shown: 1564 (PresentX 1564)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16295 MB

Not tested

  • Live device-removal DRED log output with XCL_DRED=1 on a crashing title, NVIDIA GPUs, Intel Arc GPUs, wave32-only GPUs, and Linux/Wine

AI use

  • Antigravity (frontier model; exact model identifier not exposed to agent) assisted with writing the adaptation against main, adding the unit test, running the local test suite and smoke runs, and drafting this description. All builds, tests, and regression runs were executed locally on the hardware above.

ID3D12Object::SetName populates wide ObjectNameW in DRED allocation
nodes, whereas log_device_removed previously read only ObjectNameA and
printed unnamed internal objects. Prefer ObjectNameW with fallback to
ObjectNameA via format_dred_allocation_name, query PageFaultOutput1 to
include object pointers when available, and under XCL_DRED=1 name
internal resources and heaps in real, list_x, bind, sparse, vram, and
title_textures.

Assisted-by: Antigravity
@fromthemoonx

Copy link
Copy Markdown

Passes on NVIDIA (RTX 3060), including the e2e title run with XCL_DRED=1. Nothing here produced a device removal, so the new page-fault output itself is untested.

  • Exact head 31d8f4b (base 6020a33; it merges into current main 6e1e2be without conflicts, and hle/d3d12x has not changed on main since the base; I did not run the merged tree): cargo build --workspace + cargo test --workspace --no-fail-fast -- --test-threads=4: 1155 passed, 0 failed, 46 ignored. 24 SKIPPED, the same as on main (no wave64, the per-lane refusals, no heap windows). format_dred_allocation_name_prefers_wide_and_falls_back_to_ansi passed.
  • XCL_DRED=1 cargo test -p xcl --test e2e: test_title_runs_and_game_folder_is_untouched passes, so the test title runs to the end with the new SetName calls on. test_title_draws_with_a_root_signature_under_the_debug_layer fails (e2e.rs:268, the title does not reach done). Not this PR: main 6e1e2be fails the same way, 3 of 3, when XCL_DRED=1 is combined with the debug layer that test turns on.

Hardware: RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug.

Not tested: a real page fault (so not the GetPageFaultAllocationOutput1 path or the names it prints), a title, a release build.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

@raylitebull

Copy link
Copy Markdown
Member

Code review on 31d8f4b:

  • Reading ID3D12DeviceRemovedExtendedData1 (ObjectNameW with ObjectNameA fallback via format_dred_allocation_name) and gating SetName calls behind dred_on() (XCL_DRED=1) cleanly identifies XCL internal allocations in DRED page-fault logs with zero overhead when DRED is off.
  • Diff audited and CI workflow approved (running).

Remaining before merge: Build and test finishing green plus dual-vendor (AMD + NVIDIA) verification on 31d8f4b.

@Royalflamejlh

Copy link
Copy Markdown
Contributor

Under Wine + vkd3d-proton the new page-fault output cannot print: by vkd3d-proton's source, its device gives no DRED data. Linux + NVIDIA, the title with XCL_DRED=1, 1 run with #2131 and 1 without: no DRED requested but unavailable warning and no device removal in either. Both stopped presenting before the 100 s limit, at 82.2 s with #2131 and 76.6 s without.

Setup: main f087b99 + #684 e56dbc3 + #2131 31d8f4b (local merge b1d4ab7), against main f087b99 + #684 (local merge 2f6a4ae). RTX 4070 12 GB (driver 615.71.09), Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, release, Series X profile, first-run screens completed once and no story progress, 100 s, A pressed at 16.2 s with #2131 and 16.3 s without, XCL_PSO_PRELOAD=0, WINEDEBUG=err+all,fixme-all.

XCL_DRED=1 main + #684 #2131
frames 1,326 1,399
last 2 s with a present 76.6 s 82.2 s
DRED requested but unavailable no no
device removed no no

Read

  • XCL found no Agility SDK here, so the request at real.rs:502 goes through D3D12GetDebugInterface (gpu/agility.rs:353), and vkd3d-proton hands out an ID3D12DeviceRemovedExtendedDataSettings (libs/d3d12core/main.c:796). The request succeeds and logs nothing, but both setters are stubs that only print a FIXME (libs/d3d12core/debug.c:88 and :94).
  • Its device does not answer for ID3D12DeviceRemovedExtendedData or ID3D12DeviceRemovedExtendedData1 (its QueryInterface, libs/vkd3d/device.c:3709). So on a device removal under Wine, log_device_removed skips the new block at real.rs:6409 and returns at real.rs:6428, with or without this change. Here only the new SetName calls run; vkd3d-proton keeps the names as private data (libs/vkd3d/utils.c:1686).

Not tested: a device removal (none came); the suite; Windows; AMD and Intel.

AI use: Claude Code (Claude Opus 5.5) read the change and vkd3d-proton's source, ran the title, and wrote this comment.

Posted without review by a person: the account owner was away and reads replies later.

@upipibi

upipibi commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

NVIDIA half of the dual-vendor check, exact head 31d8f4b (as-is, on its base 6020a33b): RTX 3070 8 GB, driver 616.56, Windows 11, debug, full workspace build.

First, the limit: no device removal happened in any of these runs, and none set XCL_DRED=1. So the DRED page-fault read and the SetName calls behind dred_on() never ran. The PR's unit test dred_tests::format_dred_allocation_name_prefers_wide_and_falls_back_to_ansi did run, and it passed. Otherwise, this only shows that the default, DRED-off path is unchanged on this card. (Edited: I first wrote that format_dred_allocation_name never ran, which was wrong.)

run result
cargo test -p xcl --lib -- --test-threads=4 1099 passed, 0 failed, 26 ignored
gpu_ with XCL_DIRECT_DXIL=1, single-threaded 134 passed, 1 failed: gpu_image_get_resinfo_1d_array
cargo test -p xcl --test e2e 3 passed, 0 failed
System log nvlddmkm 153 events during the runs 0

gpu_image_get_resinfo_1d_array comes from the base: #2046 fixed it in main (5ebaf3eb), and 6020a33b is older. main 1a0bbe3a passes the same gpu_ run 145 of 145 on this card.

Not tested: a removal with XCL_DRED=1 (the case the PR is for), a title, AMD.

AI-assisted (Claude Code). Synthetic tests only.

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

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants