Skip to content

Tests: add end-to-end GPU tests for direct compute dispatch splitting - #2487

Open
microwave805 wants to merge 1 commit into
xcl-dev:mainfrom
microwave805:tests-gpu-dispatch-split-e2e
Open

microwave805 wants to merge 1 commit into
xcl-dev:mainfrom
microwave805:tests-gpu-dispatch-split-e2e

Conversation

@microwave805

Copy link
Copy Markdown

Part of #1269

Direct DXIL compute dispatch splitting (gpu/dxil/module/split.rs and hle/d3d12x/real/dispatch_chain.rs) was covered by unit tests on hand-built IR modules, but had no end-to-end GPU tests running real RDNA2 compute programs through kernel::translate_compute or exercising the D3D12.X CreateComputePipelineState -> dispatch_chain::build -> console Dispatch -> ID3D12CommandAllocator::Reset lifecycle.

What is in it

  • Adds crates/xcl/tests/gpu_dispatch_split_e2e.rs with two end-to-end GPU tests (dedicated test binary so XCL_DIRECT_DXIL=1, XCL_DIRECT_SPLIT_INSTRUCTIONS=80, XCL_SPLIT_SCRATCH_MB=1, XCL_UMA_MB=64 stay isolated):
    • direct_compute_dispatch_split_matches_unsplit_across_wave32_and_wave64: translates real RDNA2 wave32 ([32, 1, 1]) and split wave64 ([64, 1, 1] with v_readlane_b32 inter-half exchanges) programs containing a scalar loop SCC, a uniform forward skip over intermediate split pieces, lane-divergent selection, and a persistent value kept live across all pieces; validates every piece (>= 3 pieces) and checks exact equality against both unsplit DXIL and a CPU oracle across [2, 3, 2] grids and slab limits most = 1, 2, 3, 7, 12.
    • console_split_compute_pso_dispatches_through_d3d12x_hook_and_reuses_scratch: wraps both wave32 (flags = 0x20) and wave64 (flags = 0) programs in retail console containers (DXBC -> DXIL/XDAT -> XBCH -> FSSM), compiles through real::create_device -> CreateComputePipelineState, verifies the dedicated dispatch_chain root signature, executes two back-to-back chained dispatches on the same command list (reusing SHARED scratch with an inter-dispatch UAV barrier), resets the command allocator, runs a third pass, and verifies every output dword in UMA.

Tested

  • Hardware / toolchain: Windows 11 Pro (build 22631), AMD Ryzen 5 5600X, NVIDIA GeForce RTX 3070 (Ampere, 8 GB, driver 32.0.16.1742, wave32 + SM 6.6 + mesh shaders, no native wave64), DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), debug profile, tested on commit 627e3ce06ff7.
  • cargo test -p xcl --test gpu_dispatch_split_e2e -- --nocapture: 2 passed, 0 failed, 0 ignored.
  • .\scripts\test.ps1 (with XCL_DXIL_CACHE=%TEMP%\xcl-test-dxil-cache): 1419 passed, 0 failed, 46 ignored (26 SKIPPED lines on this adapter: 21 no wave64, 3 per-lane wave32 unsupported-op skips, 1 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode is required)).

Regression run
Not needed: test-only change under crates/xcl/tests/ (no runtime files modified).

Not tested

  • Native wave64 GPU hardware (RTX 3070 has wave32 only, so the wave64 console case ran in split wave64 mode).
  • XCL_SAMPLE_* game-data tests (no unpacked Xbox Series game files available).

AI use

  • Tool and model: Antigravity (Gemini 4 Neon).
  • What it did: authored crates/xcl/tests/gpu_dispatch_split_e2e.rs, ran the targeted and full workspace test suites on commit 627e3ce06ff7, and drafted this PR description.

Direct DXIL compute dispatch splitting (xcl-dev#1269) had unit tests covering
hand-constructed IR modules, but no integration tests exercising real
RDNA2 compute programs through `kernel::translate_compute` or through the
D3D12.X `CreateComputePipelineState` -> `dispatch_chain::build` ->
console `Dispatch` -> `ID3D12CommandAllocator::Reset` runtime path.

Adds `crates/xcl/tests/gpu_dispatch_split_e2e.rs` (Part of xcl-dev#1269) with:
- Real RDNA2 wave32 (`[32, 1, 1]`) and split wave64 (`[64, 1, 1]`, with
  `v_readlane_b32` inter-half exchanges) programs containing a scalar
  loop SCC, a uniform forward skip over intermediate split pieces,
  lane-divergent selection, and a persistent value kept live across all
  pieces; validates every piece and checks exact equality against unsplit
  DXIL and a CPU oracle across `[2, 3, 2]` grids and slab limits
  `most = 1, 2, 3, 7, 12`.
- End-to-end D3D12.X console container tests (`DXBC -> DXIL/XDAT -> XBCH
  -> FSSM`) verifying dedicated `dispatch_chain` root signature creation,
  back-to-back chained dispatches reusing `SHARED` scratch on the same
  command list, and post-`CommandAllocator::Reset` execution in UMA.

Assisted-by: Antigravity (Gemini 4 Neon)
@luckyteagirl

Copy link
Copy Markdown
Contributor

Focused AMD run of exact PR head 627e3ce06ff7e655368b53acd80705c0b1fb3b63 from a clean detached worktree.

Tested

  • AMD Radeon RX 6800M (11,987 MiB VRAM), driver 30.0.13002.13003; Windows 11 build 26200; Rust 1.99.0 (stable-x86_64-pc-windows-msvc); DXC/DXIL 1.8.2502.11.
  • XCL_ADAPTER=6800M cargo test --locked -p xcl --test gpu_dispatch_split_e2e -- --test-threads=1 --show-output and each of the two tests rerun individually with --exact --test-threads=1 --nocapture.
  • Both tests terminated the process with 0xc0000005 (STATUS_ACCESS_VIOLATION) after XCL initialized the real RX 6800M D3D12 backend. The file-level run also terminated this way. The process exited before libtest produced a final passed/failed/ignored summary; no SKIPPED lines appeared.
  • The focused binary compiled. Compilation emitted three existing warnings: two deprecated fetch_update uses and one unread heaps field.

Not tested

  • Full workspace suite or retail titles.

AI use

  • OpenAI Codex (GPT-6; exact variant unavailable) ran the focused tests and prepared this report.

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) test report on exact head 627e3ce06ff7e655368b53acd80705c0b1fb3b63 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1417 passed, 2 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record).
    • Both new integration GPU tests in tests/gpu_dispatch_split_e2e.rs ran and passed on AMD RDNA4 with zero skips.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: 627e3ce06ff7e655368b53acd80705c0b1fb3b63
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1583 (PresentX 1583)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14661 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.

@SlopTart

Copy link
Copy Markdown

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, and the promoted-UAV-clear driver gap, PR #2490); none caused by this PR. Note gpu_depth_buffer_created_for_unordered_access_is_placed is green on main now, #2466 did its job on this lane.

@DarkPanda69

Copy link
Copy Markdown

Ran on an AMD RX 9070 XT (RDNA4, native wave64) and an RTX 3060. Both new tests pass on both cards.

Diff applied on main 6d12f58, debug, Windows 11 Pro 26200, card chosen with XCL_ADAPTER:

One note on the "native wave64" gap: direct_compute_dispatch_split_matches_unsplit_across_wave32_and_wave64 translates the wave64 case with split: wave64, so even on the RX 9070 XT it runs the split form. This run doesn't cover the native (split = false) wave64 path either.

Not tested: XCL_SAMPLE_* game-data tests (no game files).
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@pablogonz12

Copy link
Copy Markdown
Contributor

Test report from Linux + Wine on AMD RADV, and a caveat with it: on this lane both new tests abort the test binary before any test result line, and main aborts the same way on the same box, so this is the lane, not your diff. Prepared with AI assistance (DeepSeek V4.1 Flash in OpenCode ran the commands and wrote this); no code was written or changed.

Setup

  • CachyOS (Arch), kernel 7.3.6-1-cachyos-eevdf, Mesa 26.3.1-arch3.5 (RADV GFX1201), AMD Radeon RX 9070 XT 16 GB (RDNA4, native wave64), Ryzen 9 9900X.
  • GE-Proton11-14 (Wine 11.0 staging) with vkd3d-proton 3.2.0: WINEDLLOVERRIDES="d3d12,d3d12core,dxgi,d3d11,d3d10core=n,b", VKD3D_CONFIG=ignore_shared_fence, WINEDEBUG=-all, DXC 1.9.2609.5.
  • Exact head 627e3ce on base main 6d12f58 (clean checkout, no changes to tracked files). RUSTFLAGS="-C target-feature=+crt-static" cargo xwin test -p xcl --release --locked --target x86_64-pc-windows-msvc --test gpu_dispatch_split_e2e --no-run, then under Wine.

Result at this head

run result
whole binary, --test-threads=1 exit 5, no test result line
--exact direct_compute_dispatch_split_matches_unsplit_across_wave32_and_wave64 exit 5, no test result line
--exact console_split_compute_pso_dispatches_through_d3d12x_hook_and_reuses_scratch exit 5, no test result line

Each run gets as far as compiling its compute shader (xcl: [SHADER] cs ... format dxil), creating the device on RADV and the UMA windows; the process then exits with status 5 and prints no panic message. It runs twice with the same result (the whole binary plus each test alone).

Same box, main 6d12f58, no PR applied

So on this lane the split/dispatch-chain compute path already fails on main, before this PR. For contrast, the lane does run other GPU code: on #2488's head the 64-bit typed IMAGE_ATOMIC_* e2e tests pass 3/3 with no SKIPPED on the same prefix and driver.

Not tested

  • Native Windows drivers, NVIDIA, Intel.
  • A title run: none was done, so this says nothing about the dispatch split inside a title.

AI use

  • DeepSeek V4.1 Flash (OpenCode) built the head and main, ran the commands above and wrote this report.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants