Skip to content

Tests: verify 64-bit typed IMAGE_ATOMIC_* direct DXIL ops on the GPU - #2488

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

microwave805 wants to merge 1 commit into
xcl-dev:mainfrom
microwave805:tests-gpu-image-atomic64-e2e

Conversation

@microwave805

Copy link
Copy Markdown

Part of #1269

PR #1948 added SM 6.6 64-bit typed IMAGE_ATOMIC_* lowering in gpu/dxil/lower_image.rs (mimg_atomic64, texel_cas64, texel_fcas64), which was previously checked only by DXIL validation (ops_tests::direct_image_atomic_64bit_validates) without executing on a GPU.

What is in it

  • Adds crates/xcl/tests/gpu_image_atomic64_e2e.rs with three end-to-end GPU tests running all 16 64-bit typed MIMG atomic ops on DXGI_FORMAT_R32G32_UINT Texture2D and Texture2DArray UAVs in both wave32 and wave64 (native or split) kernels:
    • gpu_image_atomic64_integer_and_bitwise_ops_on_d2_and_d2array: contended 64-bit ADD, SUB, AND, OR, XOR, UMIN, UMAX, SMIN, SMAX, and SWAP across 32-bit carry/borrow boundaries and signed vs unsigned ordering, checking GLC=1 returned old-value histories, GLC=0 non-clobbering, and EXEC=0 inactive-lane preservation.
    • gpu_image_atomic64_inc_dec_and_fmin_fmax_cas_loops: 64-bit CAS-loop INC, DEC (64-bit carry/borrow and threshold wraparound), and FMIN/FMAX (f64 values beyond f32 range plus NaN).
    • gpu_image_atomic64_cmpswap_fcmpswap_and_32bit_control: 64-bit CMPSWAP vs FCMPSWAP (DMASK=0xF) across IEEE-754 edge cases (-0.0 == +0.0, qNaN, sNaN, subnormal, -inf, high-32-bit mismatch), plus a 32-bit IMAGE_ATOMIC_CMPSWAP (DMASK=0x3) regression control.
    • Queries D3D12_OPTIONS9::AtomicInt64OnTypedResourceSupported and D3D12_OPTIONS11::AtomicInt64OnDescriptorHeapResourceSupported, calling runner::skip_test cleanly when unsupported.

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 + 64-bit typed/heap integer atomics, 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 2e5d510baa78.
  • cargo test -p xcl --test gpu_image_atomic64_e2e -- --nocapture: 3 passed, 0 failed, 0 ignored (also verified with XCL_D3D12_DEBUG=1: 3 passed, 0 D3D12 debug layer errors).
  • .\scripts\test.ps1 (with XCL_DXIL_CACHE=%TEMP%\xcl-test-dxil-cache): 1420 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 ran the wave64 mode in split wave64 form) and adapters without OPTIONS9/OPTIONS11 64-bit typed heap atomics.
  • 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_image_atomic64_e2e.rs, ran the targeted (with and without XCL_D3D12_DEBUG=1) and full workspace test suites on commit 2e5d510baa78, and drafted this PR description.

PR xcl-dev#1948 added SM 6.6 64-bit typed `IMAGE_ATOMIC_*` lowering in
`gpu/dxil/lower_image.rs` (`mimg_atomic64`, `texel_cas64`,
`texel_fcas64`), previously covered only by DXIL validation in
`ops_tests::direct_image_atomic_64bit_validates`.

Adds `crates/xcl/tests/gpu_image_atomic64_e2e.rs` (Part of xcl-dev#1269)
executing all 16 64-bit typed ops on `DXGI_FORMAT_R32G32_UINT`
`Texture2D` and `Texture2DArray` UAVs in both wave32 and wave64
(native or split) kernels:
- Contended 64-bit `ADD`, `SUB`, `AND`, `OR`, `XOR`, `UMIN`, `UMAX`,
  `SMIN`, `SMAX`, and `SWAP` across 32-bit carry/borrow boundaries and
  signed vs unsigned ordering, checking `GLC=1` returned old-value
  histories, `GLC=0` non-clobbering, and `EXEC=0` lane preservation.
- 64-bit CAS-loop `INC`, `DEC` (carry/borrow and threshold wraparound),
  and `FMIN`/`FMAX` (`f64` values beyond `f32` range plus `NaN`).
- 64-bit `CMPSWAP` vs `FCMPSWAP` (`DMASK=0xF`) across IEEE-754 edge
  cases (`-0.0 == +0.0`, `qNaN`, `sNaN`, subnormal, `-inf`, high-32-bit
  mismatch) plus a 32-bit `IMAGE_ATOMIC_CMPSWAP` (`DMASK=0x3`) control.
- Skips via `runner::skip_test` when the adapter lacks SM 6.6 64-bit
  typed or descriptor-heap integer atomics (`OPTIONS9` / `OPTIONS11`).

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

Copy link
Copy Markdown
Contributor

Focused AMD verification of exact PR head 2e5d510baa78c8ab969e36beb6905f0614a9dbef in a clean detached worktree.

Tested

  • AMD Radeon RX 6800M (RDNA2, 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_image_atomic64_e2e -- --test-threads=1 --show-output: 3 passed, 0 failed, 0 ignored, 0 skipped. The log confirmed XCL selected the real RX 6800M D3D12 backend. All three tests executed, including integer/bitwise operations, increment/decrement and min/max/CAS loops, and compare-swap/float compare-swap.

Not tested

  • Full workspace suite or retail titles.

AI use

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

@emirduran707

Copy link
Copy Markdown
Contributor

Independent AMD RDNA4 (native wave64) test report on exact head 2e5d510baa78c8ab969e36beb6905f0614a9dbef (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: 1418 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).
    • All 3 new integration GPU tests in tests/gpu_image_atomic64_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: 2e5d510baa78c8ab969e36beb6905f0614a9dbef
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1612 (PresentX 1612)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14538 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

Native wave64 run (listed as untested), plus an RTX 3060: all 3 new tests pass on both cards, with no skips.

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

  • cargo test -p xcl --test gpu_image_atomic64_e2e -- --nocapture: 3 passed, 0 failed, with no SKIPPED line, so both cards report the OPTIONS9/OPTIONS11 64-bit typed heap atomics. That holds on the RX 9070 XT (RDNA4, driver 32.0.32029.2010; XCL_SPLIT_WAVE64 unset, so supported_modes() takes the native split = false wave64 mode there) and on the RTX 3060 (driver 32.0.16.1088).
  • cargo test -p xcl --lib -- gpu::: RTX 3060 700 passed, 0 failed; RX 9070 XT 698 passed, 2 failed. The 2 failures are the AMD fuzz seeds tracked in DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115, the same on main.

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. As far as I can see these tests have only been run on native Windows drivers so far; this is the Wine lane, where the DXIL goes through vkd3d-proton and dxil-spirv before the AMD Vulkan driver. 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 2e5d510 on base main 6d12f58 (clean checkout, no changes to tracked files; the diff only adds crates/xcl/tests/gpu_image_atomic64_e2e.rs, so there is no runtime tree to compare).
  • Build: RUSTFLAGS="-C target-feature=+crt-static" cargo xwin test -p xcl --release --locked --target x86_64-pc-windows-msvc --test gpu_image_atomic64_e2e --no-run; run under Wine with --test-threads=1 --nocapture.

Result — two runs, identical:

test gpu_image_atomic64_cmpswap_fcmpswap_and_32bit_control ... ok
test gpu_image_atomic64_inc_dec_and_fmin_fmax_cas_loops ... ok
test gpu_image_atomic64_integer_and_bitwise_ops_on_d2_and_d2array ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.90s

There is no SKIPPED line: on this device vkd3d-proton answers D3D12_OPTIONS9/OPTIONS11 with 64-bit typed heap atomics, so the tests take the real path and all 16 IMAGE_ATOMIC_* forms compare equal.

As a check that the GPU really executed them, a run with VKD3D_SHADER_DUMP_PATH set wrote 6 SPIR-V modules that hold OpImageTexelPointer %_ptr_Image_ulong and 64-bit OpAtomic* instructions, from the compute shaders XCL emitted (the run logs xcl: [SHADER] cs ... format dxil). So these ops survive dxil-spirv and RADV unchanged.

Not tested

  • Native Windows drivers (covered by the reports above), NVIDIA, Intel.
  • A title run: none was done for this, so this says the lowering is right on this driver, not how it behaves in a title.

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