Tests: enable D3D12 debug layer before GPU runner device #2012

Merged
luckyteagirl merged 1 commit from upstream-pr/2022 into main 2026-11-25 10:37:37 +00:00
luckyteagirl commented 2026-11-25 00:55:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-25T00:55:41Z.


Addresses #2016.

XCL_D3D12_DEBUG=1 currently lets the GPU test runner create a D3D12 device before D3D12.X enables the debug layer. Enabling the layer after that removes the runner's device. This change enables the layer before the runner creates a device and makes both paths share one process-wide initialization, so the backend does not enable it again later.

What is in it

  • gpu::agility::enable_debug_layer() retrieves the active Agility SDK or inbox debug interface and calls EnableDebugLayer at most once.
  • The GPU recompiler test runner requests it before device creation when the config or XCL_D3D12_DEBUG asks for it.
  • D3D12.X uses the same initializer and retains its existing success/unavailable log messages.

Tested

  • Head 8921c36fd3f719bee619e040a0b802fbb22391ba on main 6567c5ffa38fbc7039b2d6bf520154689cc1f482. Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver 30.0.13002.13003, Rust 1.99.0 MSVC, DXC/DXIL 1.9.2609.5, debug build.
  • git diff --check and cargo build --locked --workspace -j 2 passed.
  • With XCL_ADAPTER=6800M, XCL_REQUIRE_GPU=1, and XCL_D3D12_DEBUG=1, cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output completed across 20 test binaries: 854 passed, 143 failed, 45 ignored. Six explicit SKIPPED tests are included in the passed count: gpu_raw_window_view_reaches_its_top (no GPU), pso_measurement_compiles_an_exact_synthetic_record (device error), placed_title_textures_share_vram_and_preserve_pixels (no reserved cube with mips), test_title_draws_with_a_root_signature_under_the_debug_layer (missing d3d12SDKLayers.dll), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows), and uploads_start_from_each_subresources_state (no D3D12 debug layer). The GPU device was suspended (0x887A0005), followed by many GPU test failures.
  • The serial gpu::recomp subset exited with 0xC0000005 at gpu_bvh64_intersect_ray_across_memory_windows_and_grazing. The isolated gpu_sparse_vram_descriptors_buffers_and_xmem test also exited with 0xC0000005, both with and without XCL_D3D12_DEBUG=1.
  • This machine reports the debug layer unavailable (0x887A002D), so the specific device-removal fix needs validation on a system with Graphics Tools installed. The code path compiled and the flag was exercised, but the layer was not actually enabled here.
  • Release cargo build --locked --release -p xcl -j 2 passed. A locally owned title ran for 7 seconds on this head and main 400e638869ee8e8f8238079db3b70fce2abd3c2b: each showed one frame, no crash, and no device removal. Peak process commit was 6,998 MB on this head versus 7,069 MB on main.

Regression run

main:

xcl-smoke v1
commit: 400e638869ee8e8f8238079db3b70fce2abd3c2b
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 7069 MB

PR head:

xcl-smoke v1
commit: 8921c36fd3f719bee619e040a0b802fbb22391ba
gpu: AMD Radeon RX 6800M
title: 2ef5fd64
seconds: 7
exit: 0x0
frames shown: 1 (PresentX 1)
presents per 2 s (last 3): 0 0 1
device removals: 0
crashes: 0
peak commit: 6998 MB

Not tested

The 7-second title run did not request the D3D12 debug layer. This machine lacks d3d12SDKLayers.dll, so enabling the layer and validating the reported device-removal fix remain untested; longer title runs, other adapters, and newer AMD drivers are also untested.

AI use

OpenAI Codex (GPT-6, exact variant not exposed in this session) implemented the fix, ran the checks, reviewed the diff, and drafted this description.

<!-- greyfinch-sync:ivall/xcl:issue:6594620874 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2022). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-25T00:55:41Z. --- Addresses #2016. `XCL_D3D12_DEBUG=1` currently lets the GPU test runner create a D3D12 device before D3D12.X enables the debug layer. Enabling the layer after that removes the runner's device. This change enables the layer before the runner creates a device and makes both paths share one process-wide initialization, so the backend does not enable it again later. **What is in it** - `gpu::agility::enable_debug_layer()` retrieves the active Agility SDK or inbox debug interface and calls `EnableDebugLayer` at most once. - The GPU recompiler test runner requests it before device creation when the config or `XCL_D3D12_DEBUG` asks for it. - D3D12.X uses the same initializer and retains its existing success/unavailable log messages. **Tested** - Head `8921c36fd3f719bee619e040a0b802fbb22391ba` on `main` `6567c5ffa38fbc7039b2d6bf520154689cc1f482`. Windows 11 build 26200, Ryzen 9 5980HX, Radeon RX 6800M driver `30.0.13002.13003`, Rust 1.99.0 MSVC, DXC/DXIL `1.9.2609.5`, debug build. - `git diff --check` and `cargo build --locked --workspace -j 2` passed. - With `XCL_ADAPTER=6800M`, `XCL_REQUIRE_GPU=1`, and `XCL_D3D12_DEBUG=1`, `cargo test --locked --workspace --no-fail-fast -j 2 -- --test-threads=4 --show-output` completed across 20 test binaries: 854 passed, 143 failed, 45 ignored. Six explicit `SKIPPED` tests are included in the passed count: `gpu_raw_window_view_reaches_its_top` (no GPU), `pso_measurement_compiles_an_exact_synthetic_record` (device error), `placed_title_textures_share_vram_and_preserve_pixels` (no reserved cube with mips), `test_title_draws_with_a_root_signature_under_the_debug_layer` (missing `d3d12SDKLayers.dll`), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows), and `uploads_start_from_each_subresources_state` (no D3D12 debug layer). The GPU device was suspended (`0x887A0005`), followed by many GPU test failures. - The serial `gpu::recomp` subset exited with `0xC0000005` at `gpu_bvh64_intersect_ray_across_memory_windows_and_grazing`. The isolated `gpu_sparse_vram_descriptors_buffers_and_xmem` test also exited with `0xC0000005`, both with and without `XCL_D3D12_DEBUG=1`. - This machine reports the debug layer unavailable (`0x887A002D`), so the specific device-removal fix needs validation on a system with Graphics Tools installed. The code path compiled and the flag was exercised, but the layer was not actually enabled here. - Release `cargo build --locked --release -p xcl -j 2` passed. A locally owned title ran for 7 seconds on this head and main `400e638869ee8e8f8238079db3b70fce2abd3c2b`: each showed one frame, no crash, and no device removal. Peak process commit was 6,998 MB on this head versus 7,069 MB on main. **Regression run** main: ``` xcl-smoke v1 commit: 400e638869ee8e8f8238079db3b70fce2abd3c2b gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 1 device removals: 0 crashes: 0 peak commit: 7069 MB ``` PR head: ``` xcl-smoke v1 commit: 8921c36fd3f719bee619e040a0b802fbb22391ba gpu: AMD Radeon RX 6800M title: 2ef5fd64 seconds: 7 exit: 0x0 frames shown: 1 (PresentX 1) presents per 2 s (last 3): 0 0 1 device removals: 0 crashes: 0 peak commit: 6998 MB ``` **Not tested** The 7-second title run did not request the D3D12 debug layer. This machine lacks `d3d12SDKLayers.dll`, so enabling the layer and validating the reported device-removal fix remain untested; longer title runs, other adapters, and newer AMD drivers are also untested. **AI use** OpenAI Codex (GPT-6, exact variant not exposed in this session) implemented the fix, ran the checks, reviewed the diff, and drafted this description.
raylitebull commented 2026-11-25 02:08:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:25:47Z.


Code review on 8921c36:

  • Moving debug-layer initialization behind gpu::agility::enable_debug_layer() (OnceLock) and invoking it before device creation in gpu::recomp::runner::init cleanly prevents hle::d3d12x::real::init from calling EnableDebugLayer after a runner device already exists.
  • Diff audited and CI workflow approved (currently running).

Remaining before merge:

  1. Fix the failing PR description check.
  2. Confirm Build and test (Windows, no GPU) finishes green.
  3. AMD and NVIDIA verification on 8921c36.
<!-- greyfinch-sync:ivall/xcl:comment:7149536481 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2022#issuecomment-7149536481). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:25:47Z. --- Code review on `8921c36`: - Moving debug-layer initialization behind `gpu::agility::enable_debug_layer()` (`OnceLock`) and invoking it before device creation in `gpu::recomp::runner::init` cleanly prevents `hle::d3d12x::real::init` from calling `EnableDebugLayer` after a runner device already exists. - Diff audited and `CI` workflow approved (currently running). **Remaining before merge:** 1. Fix the failing `PR description` check. 2. Confirm `Build and test (Windows, no GPU)` finishes green. 3. **AMD** and **NVIDIA** verification on `8921c36`.
nnonno91 commented 2026-11-25 02:08:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T01:33:21Z.


Tested

Independent Graphics Tools check on exact head 8921c36fd3f719bee619e040a0b802fbb22391ba and parent 6567c5ffa38fbc7039b2d6bf520154689cc1f482. Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62) and RTX 5090 (32.0.16.1742). Inbox D3D12 with d3d12SDKLayers.dll 10.0.26100.9818, Rust 1.100.0 x64 MSVC, DXC/DXIL 1.8.2502.11, unoptimized dev/test profiles with debug info off.

  • cargo build --workspace --locked passed on the clean PR head.
  • cargo test --locked -p xcl --lib gpu::recomp::runner::debug_layer_initialization_order_probe -- --exact --test-threads=1 --nocapture. The temporary probe created the GPU runner device, checked whether ID3D12InfoQueue1 was present, dispatched a 64-lane shader, called d3d12x::real::init(), then checked the original runner device and dispatched again. Separate processes for both devices, both revisions, and with XCL_D3D12_DEBUG unset or set to 1. All eight final probe runs passed their assertions (1 passed, 0 failed, 0 ignored, 0 skipped per run), with the debug-enabled parent runs explicitly asserting the expected device loss.
  • Parent, debug on: Both GPUs returned all 64 expected values before D3D12.X init. The runner initially had no debug queue. D3D12.X logged that it enabled the layer, the original device then reported 0x887A0007, and the second dispatch failed at CreateComputePipelineState with 0x887A0005, matching #2016. The backend selected WARP on the AMD run.
  • PR head, debug on: The runner already exposed the debug queue before D3D12.X init. The backend kept the selected hardware adapter, the runner reported no removal, and both GPUs returned all 64 expected values before and after init.
  • With the flag unset, both revisions completed both dispatches on both adapters.

Not tested

Agility SDK builds, the full workspace test suite with the debug layer, and real-title smoke runs. The probe covers the runner-first initialization order from #2016.

AI use

OpenAI Codex (GPT-6 family, exact variant unavailable) prepared and ran the temporary probe, checked the logs, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7149681963 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2022#issuecomment-7149681963). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-25T01:33:21Z. --- **Tested** Independent Graphics Tools check on exact head `8921c36fd3f719bee619e040a0b802fbb22391ba` and parent `6567c5ffa38fbc7039b2d6bf520154689cc1f482`. Windows 11 25H2 (26200.9974), Ryzen 7 9800X3D, AMD Radeon(TM) Graphics (32.0.21042.62) and RTX 5090 (32.0.16.1742). Inbox D3D12 with `d3d12SDKLayers.dll` 10.0.26100.9818, Rust 1.100.0 x64 MSVC, DXC/DXIL 1.8.2502.11, unoptimized dev/test profiles with debug info off. - `cargo build --workspace --locked` passed on the clean PR head. - `cargo test --locked -p xcl --lib gpu::recomp::runner::debug_layer_initialization_order_probe -- --exact --test-threads=1 --nocapture`. The temporary probe created the GPU runner device, checked whether `ID3D12InfoQueue1` was present, dispatched a 64-lane shader, called `d3d12x::real::init()`, then checked the original runner device and dispatched again. Separate processes for both devices, both revisions, and with `XCL_D3D12_DEBUG` unset or set to `1`. All eight final probe runs passed their assertions (1 passed, 0 failed, 0 ignored, 0 skipped per run), with the debug-enabled parent runs explicitly asserting the expected device loss. - **Parent, debug on:** Both GPUs returned all 64 expected values before D3D12.X init. The runner initially had no debug queue. D3D12.X logged that it enabled the layer, the original device then reported `0x887A0007`, and the second dispatch failed at `CreateComputePipelineState` with `0x887A0005`, matching #2016. The backend selected WARP on the AMD run. - **PR head, debug on:** The runner already exposed the debug queue before D3D12.X init. The backend kept the selected hardware adapter, the runner reported no removal, and both GPUs returned all 64 expected values before and after init. - With the flag unset, both revisions completed both dispatches on both adapters. **Not tested** Agility SDK builds, the full workspace test suite with the debug layer, and real-title smoke runs. The probe covers the runner-first initialization order from #2016. **AI use** OpenAI Codex (GPT-6 family, exact variant unavailable) prepared and ran the temporary probe, checked the logs, and drafted this report.
raylitebull commented 2026-11-25 02:08:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:43:51Z.


Update on 8921c36:

  • Build and test (Windows, no GPU) is now green, and @nnonno91 verified exact head 8921c36 across both AMD Radeon Graphics and RTX 5090 with d3d12SDKLayers.dll (confirming the runner retains its debug queue and hardware adapter instead of hitting 0x887A0007/0x887A0005).

Remaining before merge: Fixing the failing PR description check (and if needed, confirming a full suite pass on the head).

<!-- greyfinch-sync:ivall/xcl:comment:7149889276 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2022#issuecomment-7149889276). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:43:51Z. --- Update on `8921c36`: - `Build and test (Windows, no GPU)` is now green, and `@nnonno91` verified exact head `8921c36` across both **AMD Radeon Graphics** and **RTX 5090** with `d3d12SDKLayers.dll` (confirming the runner retains its debug queue and hardware adapter instead of hitting `0x887A0007`/`0x887A0005`). **Remaining before merge:** Fixing the failing `PR description` check (and if needed, confirming a full suite pass on the head).
raylitebull commented 2026-11-25 02:09:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T01:54:16Z.


@luckyteagirl — 8921c36 now passes every check (CLEAN, Build and test + PR description both SUCCESS, and verified on both AMD RX 6800M / Radeon iGPU and NVIDIA RTX 5090). This PR is currently marked Draft; once marked Ready for review, it is ready to merge!

<!-- greyfinch-sync:ivall/xcl:comment:7150094069 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2022#issuecomment-7150094069). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T01:54:16Z. --- `@luckyteagirl` — `8921c36` now passes every check (`CLEAN`, `Build and test` + `PR description` both `SUCCESS`, and verified on both **AMD RX 6800M / Radeon iGPU** and **NVIDIA RTX 5090**). This PR is currently marked **Draft**; once marked **Ready for review**, it is ready to merge!
DavidM1911 commented 2026-11-25 05:08:11 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T04:12:10Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7152624629 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2022#issuecomment-7152624629). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T04:12:10Z. --- 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!
upstream-sync closed this pull request 2026-11-25 11:07:55 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2012
No description provided.