Recompiler: enable D3D12 debug layer before device creation in GPU test runner #2140
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2150"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by saurabhbhoir456 on 2026-11-25T06:23:02Z.
Fixes #2016: XCL_D3D12_DEBUG=1 removes the GPU test runner's device once a test starts the D3D12.X backend.
The GPU test runner creates its D3D12 device in runner::init(), but the debug layer was being enabled in the D3D12.X backend after the device already existed. The debug layer must be enabled before any device is created.
Enable the debug layer in runner::init() when XCL_D3D12_DEBUG is set, before adapter selection and device creation.
Tested
AI use
Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T06:44:19Z.
A run under Wine on Linux with vkd3d-proton as the host D3D12. vkd3d-proton has no debug layer, and the GPU is lost in this group with or without
XCL_D3D12_DEBUG=1. So this setup cannot show the ordering #2016 is about. One result differs with this PR: with the variable set, the run hangs.Tested
RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release lib test binaries, cross-built for
x86_64-pc-windows-gnu:ce03bebas it is (based on6ea813a) andmain568e7db, no uncommitted changes.libtest gpu::recomp::tests --test-threads=1, one Wine process per run, 600 s cap:XCL_D3D12_DEBUGXCL_D3D12_DEBUG=1mainOn
mainwith the variable set, the backend logsxcl: D3D12: debug layer requested but unavailable: 0x887A002D(DXGI_ERROR_SDK_COMPONENT_MISSING).In the three runs that finish, the first
0x887A0005comes ingpu_sparse_vram_descriptors_buffers_and_xmem(UMA import check: check not run: queue: 0x887A0005,sparse windows: 0x887A0005). The later failures arekernel dispatch: D3D12 device removed. This happens without the variable too, so under vkd3d-proton something in that test removes the device whatever the debug-layer order.In the PR's run with the variable set, 75 tests reported
okand 3FAILED:gpu_more_atomics_sub_dword_scratch_valu,gpu_nonfused_mad_and_mac_prevent_fma_contractionandgpu_packed_math_dots_movrel, the same three that fail by that point in the other runs. The process then stayed ingpu_permlane16_wqm_and_lds_stride64until the cap. I ran it once and have not checked where it waits.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T07:04:45Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-25T07:13:36Z.
It fixes #2016's repro on NVIDIA. But with the debug layer now on the runner's device from the start, the whole
XCL_D3D12_DEBUG=1suite does not finish here: the lib test binary aborts, and one integration test that passes onmainfails.Tested (exact head
ce03beb, base6ea813a; RTX 3060 12 GB, driver 610.88, Graphics Tools installed, Windows 11 Pro 26300, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug):main568e7dbXCL_D3D12_DEBUG=1 cargo test -p xcl --lib gpu::recomp -- --test-threads=1(#2016's repro)0x887A0005)cargo test --workspace --no-fail-fast -- --test-threads=4(no variable)XCL_D3D12_DEBUG=1 cargo test --workspace --no-fail-fast -- --test-threads=4gpu::recomp, the removed device); the lib binary finishes--test-threads=1)On this PR, with
XCL_D3D12_DEBUG=1:hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsis the last test started before the lib binary exits with 2173. It passes alone, on the PR and onmain.gpu::texture::tests::gpu_large_mixed_upload_keeps_tight_staging_and_exact_pixelsfails in the full lib run and passes alone. Onmainit printedSKIPPED …: no GPUin the same run, because the device was already removed, so it never really ran under the debug layer before.gpu_compute_e2e::offline_compute_pipeline_is_reused_by_a_second_processfails 2 of 2 (gpu_compute_e2e.rs:107): thexcl shaders --precompile --pipelineschild printspipelines made on the GPU 0, refused 1. Onmainwith the same variable it passes 2 of 2, because the child's device has no debug layer there.So the device is no longer removed, and the debug layer now reaches tests that used to skip, which exposes more problems. The issue's "23 failures" become an abort plus a new refused pipeline.
Not tested: AMD, a title (no smoke run here), which debug-layer message the refused pipeline gets.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T20:18:58Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:29:20Z.
Triage (#1607) – head
ce03bebMain already fixes #2016: commit
8921c36(#2022) enables the D3D12 debug layer inrunner::initbefore the runner creates its device. It goes throughagility::enable_debug_layer, whichreal.rsuses as well, so the layer is enabled once per process. #2016 is closed. This PR adds the same early enable inrunner.rs, butreal::initstill callsEnableDebugLayera second time.Recommendation: close (superseded by main commit
8921c36).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T15:59:37Z.
Closing as superseded: this change is already on
main(8921c36f). From Foniass's rechecked close list on #1607, checked again by script just now. If something here is still missing, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5).
Pull request closed