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

@microwave805 microwave805 commented Nov 25, 2026 •

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 crossing the 32-bit boundary and threshold wraparound, checking returned old values), 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 ffede12270d9.
  • cargo test -p xcl --test gpu_image_atomic64_e2e -- --nocapture: 3 passed, 0 failed, 0 ignored.
  • .\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; independent reviewers verified native wave64 on AMD RDNA2/RDNA4) 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, updated INC_INIT per review feedback, ran the targeted and full workspace test suites on commit ffede12270d9, and updated this PR description.

@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

DarkPanda69 commented Nov 25, 2026 •

Copy link
Copy Markdown

Update for head ffede12: same result. Applied on main 8b957be, cargo test -p xcl --test gpu_image_atomic64_e2e -- --nocapture: 3 passed, 0 failed, no SKIPPED on both the RX 9070 XT (XCL_SPLIT_WAVE64 unset) and the RTX 3060.

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.

@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Source review of head 2e5d510, no run. In gpu_image_atomic64_inc_dec_and_fmin_fmax_cas_loops, the non-wrapping INC case asserts "INC 64-bit carry", but INC_INIT 0x0000_0001_FFFF_FFF8 plus 5 increments ends at 0x0000_0001_FFFF_FFFD. The low dword never wraps, so a lowering that dropped the carry into the high dword would still pass. The DEC case does cross (0x2_0000_0004 - 5 = 0x1_FFFF_FFFF). Starting INC at 0x0000_0001_FFFF_FFFC (still below INC_LIM) would end at 0x0000_0002_0000_0001 and test the carry. texel_cas64 uses a 64-bit add today, so this is about test coverage, not a current bug.

AI-assisted (Claude Code, Claude Opus 5.5).

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)
@microwave805
microwave805 force-pushed the tests-gpu-image-atomic64-e2e branch from 2e5d510 to ffede12 Compare November 26, 2026 23:32
@microwave805

Copy link
Copy Markdown
Author

@upipibi Good catch — updated INC_INIT to 0x0000_0001_FFFF_FFFC so the 5 increments now cross the 32-bit boundary to 0x0000_0002_0000_0001, and also asserted the sorted GLC=1 old values across the carry (ffede12270d9). Re-ran cargo test -p xcl --test gpu_image_atomic64_e2e (3 passed, 0 failed) and full .\scripts\test.ps1 (1420 passed, 0 failed, 46 ignored, 26 SKIPPED on RTX 3070) and updated Tested in the description.

(AI use: Antigravity (Gemini 4 Neon) applied the edit, ran the tests, and drafted this comment.)

@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

@microwave805 thanks. Checked at ffede122 by reading: INC_INIT 0x0000_0001_FFFF_FFFC plus 5 ends at 0x0000_0002_0000_0001 (gpu_image_atomic64_e2e.rs:335, :377), so the low dword now wraps and the carry into the high dword is tested. The GLC=1 old values across the carry are asserted at :380, and INC_LIM (:336) stays above the end value, so the wrap-to-zero path isn't hit. My review point is resolved. I didn't re-run it, since your 3070 run covers the same card.

AI-assisted (Claude Code, Claude Opus 5.5).

@JJAutoCompare

Copy link
Copy Markdown

Tested: Clean ffede12270d9d5ce31bac0bda8fac26246bbb95e, Windows 11 build 26200, Ryzen 7 3800X, Intel Arc A770 driver 32.0.101.9175, Rust 1.100.0 MSVC, debug. cargo test --locked -j 2 -p xcl --lib --test gpu_image_atomic64_e2e --no-run; ran the integration test executable with XCL_ADAPTER=A770 --test-threads=1 --nocapture (where the adapter was set in the environment). All three tests emitted SKIPPED … no 64-bit typed heap atomics. Libtest counts were 3 passed, 0 failed, 0 ignored, with 3 capability skips and zero GPU shader-execution passes.

Not tested: Typed image atomic execution and the 32-bit control inside the skipped test, full suite or retail smoke.

AI use: T3 Code / Codex (gpt-6.2-sol) ran and reran the checks 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.

9 participants