Skip to content

Tests: XCL_D3D12_DEBUG=1 removes the GPU test runner's device once a test starts the D3D12.X backend (23 failures) #2016

Backlog

Description

@cindertheblue

With XCL_D3D12_DEBUG=1, cargo test --workspace loses the GPU partway through: 23 tests fail and 11 more skip with no GPU. The cause is the order in which the tests create D3D12 devices, not the tests that fail.

Cause. real::init() enables the debug layer (crates/xcl/src/hle/d3d12x/real.rs:478–483, EnableDebugLayer) when the D3D12.X backend first starts. In the test binary the GPU test runner (gpu::recomp::runner::init) has made its own device by then. Enabling the debug layer after a device exists removes that device (the documented behaviour of ID3D12Debug::EnableDebugLayer). From then on every test that uses the runner's device gets 0x887A0005 (CreateComputePipelineState / CreateRootSignature / CreateCommittedResource: "The GPU device instance has been suspended").

In the lib tests the backend is first started by gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem (and gpu_uma_import_check_at_init calls real::init() too). In a single-threaded run the log shows xcl: D3D12: debug layer enabled inside that test, and the first 0x887A0005 comes in the next test.

On main 6567c5f, AMD Radeon RX 7600 XT, driver 32.0.31041.1004, Windows 11 Home 26200.9974, rustc 1.99.1, debug, Graphics Tools installed:

run passed failed ignored
cargo test --workspace --no-fail-fast -- --test-threads=4 995 2 45
the same with XCL_D3D12_DEBUG=1 974 23 45
XCL_D3D12_DEBUG=1 cargo test -p xcl --lib gpu::recomp -- --test-threads=1 248 19 18
the same with --skip gpu_sparse_vram_descriptors_buffers_and_xmem --skip gpu_uma_import_check_at_init 265 0 18

The same 19 gpu::recomp tests fail in each of my three single-threaded runs (two on 20cf130, one on 6567c5f), all with 0x887A0005. The 2 failures without the variable are unrelated to this.

Possible fixes (not tried):

  • The runner enables the debug layer itself, before it makes its device, when XCL_D3D12_DEBUG is set, so the backend's later call finds it already on.
  • Or the GPU tests share one device with the backend.

Both change crates/xcl/src outside tests, so I am reporting it rather than opening a PR.

Separately: with the debug layer on, gpu_sparse_vram_descriptors_buffers_and_xmem itself logs error 1419 (SetComputeRootSignature before SetDescriptorHeaps with the *_HEAP_DIRECTLY_INDEXED ABI root signature). That test-only fix is #2017; it does not change the device removal above.

AI use: Claude Code (Claude Opus 5.5) found the cause, ran the tests and wrote this issue from the real output.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions