Skip to content

Tests: check all 16 32-bit MIMG image_atomic_* ops on the GPU - #1712

Open
thiagocalile wants to merge 1 commit into
xcl-dev:mainfrom
thiagocalile:tests-recomp-mimg-image-atomics
Open

thiagocalile wants to merge 1 commit into
xcl-dev:mainfrom
thiagocalile:tests-recomp-mimg-image-atomics

Conversation

@thiagocalile

Copy link
Copy Markdown

Adds GPU execution tests for all 16 32-bit MIMG IMAGE_ATOMIC_* operations across wave64 and wave32, covering integer ALU ops, signed/unsigned min/max, GLC=0 vs GLC=1 return-value behaviour, CAS-loop inc/dec/cmpswap/fcmpswap, float fmin/fmax, multi-lane contention on a single texel, and EXEC masking. No runtime or recompiler source files are changed.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs:
    • gpu_image_atomics_32bit_int_and_glc: tests IMAGE_ATOMIC_ADD, SUB (including 32-bit wrap-around), AND, OR, XOR, SWAP (GLC=1 returning the prior texel value and GLC=0 updating memory while keeping VDATA unchanged), UMIN, UMAX, SMIN, SMAX (signed negative extremes on DXGI_FORMAT_R32_SINT), multi-lane contention on 1×1 UAVs, and EXEC-masked writes on both wave64 and wave32.
    • gpu_image_atomics_32bit_cas_and_float: tests IMAGE_ATOMIC_INC, DEC (including limit wrap-around), CMPSWAP, FCMPSWAP (bitwise -0.0 vs +0.0 discrimination), FMIN, FMAX (per-lane and multi-lane contention across negative and positive floats), GLC=1 return values, and EXEC masking on both wave64 and wave32.

Tested

  • Hardware: AMD Radeon RX 6600 (8146 MiB VRAM, RDNA2, native wave64, driver 32.0.21045.29003; XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11.
  • XCL_ADAPTER=radeon cargo test -p xcl --lib gpu_image_atomics_32bit_ -- --nocapture: 2 passed, 0 failed, 0 ignored (0.30s; both wave64 and wave32 executed on hardware).
  • XCL_ADAPTER=radeon cargo test --workspace --no-fail-fast -- --test-threads=4: 857 passed, 3 failed, 42 ignored (xcl --lib: 808 passed, 3 failed, 22 ignored; integration tests: 49 passed, 0 failed, 20 ignored).
    • The 3 failures are pre-existing on main (c160d86) on this RX 6600 (placed_title_textures_share_vram_and_preserve_pixels: 3D mip subresource mismatch, plus 2 mutex-poison cascades transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory; tracked by D3D12.X: map and unmap 3D texture mips separately #1028).
    • SKIPPED (not counted as coverage): heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows (plus D3D12 debug-layer tests skip because d3d12SDKLayers.dll is not installed).

Not tested

  • NVIDIA / Intel GPUs, D3D12 debug layer, 64-bit DMASK 0x3/0xF image atomics, retail title smoke run (test-only PR; no runtime code changed).

AI use

  • Antigravity (Gemini 4 Neon) wrote the two GPU tests in crates/xcl/src/gpu/recomp/tests.rs, ran the targeted and full workspace test suites on my RX 6600, and drafted this PR description; I reviewed the diff and test output before opening the PR.

Add two GPU tests in crates/xcl/src/gpu/recomp/tests.rs covering all 16
32-bit MIMG IMAGE_ATOMIC_* instructions on both wave64 and wave32:

- gpu_image_atomics_32bit_int_and_glc: per-lane and multi-lane contention
  checks for add, sub (including 32-bit wrap-around), and, or, xor, swap
  (GLC=0 preserving vdata vs GLC=1 returning the prior texel value),
  umin/umax, smin/smax (signed negative extremes), and EXEC masking.
- gpu_image_atomics_32bit_cas_and_float: CAS-loop and float ops — inc/dec
  (including wrap at limit), cmpswap, fcmpswap (bitwise -0.0 vs +0.0),
  per-lane and contention fmin/fmax (negative and positive ordering),
  GLC=1 return values, and EXEC masking.

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

upipibi commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

NVIDIA run, since the PR lists it as not tested: RTX 3070 (Ampere, 32-lane waves only, so the wave64 case goes through the split form), driver 616.56, Windows 11, DXC 1.8.2502.11, bfdefbe.

  • gpu_image_atomics_32bit_int_and_glc and gpu_image_atomics_32bit_cas_and_float pass in 3 of 3 runs under XCL_REQUIRE_GPU=wave64, so neither case is skipped.

Test-only PR, synthetic tests, no game files. AI-assisted (Claude Code).

@mantavisual

Copy link
Copy Markdown

Test report for bfdefbea1fcb89edf0e4e7cb5d679c19ca2687c3. It adds the whole suite on NVIDIA to the run above, and a check of what the tests notice.

Tested

  • RTX 4060 8 GB (driver 616.92, wave32), i5-13600K, 32 GB, Windows 11 Pro 22631, Rust 1.100.0 MSVC, DXC 1.9.2602.17 (SDK 10.0.26100), debug.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 860 passed, 0 failed, 42 ignored. Both new tests ran.
  • Merged locally with main b9b6ea6: 891 passed, 0 failed, 42 ignored.
  • SKIPPED at the head: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

Do the tests notice a broken translator?

  • Gap: with GLC=0 ignored on the CAS-loop image atomics (sub, inc, dec, cmpswap, fmin, fmax), so that the old value is always written back, both tests still pass. VDATA after a GLC=0 operation is only checked for IMAGE_ATOMIC_SWAP. These two lines pass normally and fail with that break: assert_eq!(v[22], lu + 1) in the first test, assert_eq!([v[18], v[19]], [st.vgpr[l][18], st.vgpr[l][19]]) in the second.
  • 6 other breaks were caught.

Not tested: AMD, native wave64, retail title.

AI use: Claude Code (Claude Opus 5.5) ran this on my machine, wrote the report and posted it for me.

@LocranKing

Copy link
Copy Markdown

Independent Windows release GPU test run on NVIDIA Ampere (RTX 3060 Ti, wave32) at bfdefbea1fcb89edf0e4e7cb5d679c19ca2687c3: both new 32-bit MIMG image_atomic_* GPU tests pass.

Setup

  • GPU: NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, Ampere, wave32), driver 32.0.16.2101
  • CPU / RAM: AMD Ryzen 5 5500 (6C/12T), 31.8 GB RAM
  • OS: Windows 11 Home Single Language, build 26200
  • Toolchain: rustc 1.100.0, DXC 1.9.2602.17, --release

Results (cargo test --workspace --release --no-fail-fast -- --test-threads=4)

  • Exit 0: 860 passed, 0 failed, 42 ignored across 20 result blocks (SKIPPED: 2 no wave64, 2 no D3D12 debug layer, heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows).
  • New tests verified on GPU:
    • gpu::recomp::tests::gpu_image_atomics_32bit_int_and_glc — ok
    • gpu::recomp::tests::gpu_image_atomics_32bit_cas_and_float — ok

Not tested: Debug build, AMD / native wave64 hardware.

AI use: Antigravity (Gemini 4 Neon) built and ran the workspace test suite on this hardware and drafted this report from the captured output; reviewed before posting. No game files attached.

@ivall ivall added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 24, 2026
@DavidM1911

Copy link
Copy Markdown
Contributor

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

Tested

Independent Intel Arc A770 run of the two checked-in synthetic fixtures at bfdefbea1fcb89edf0e4e7cb5d679c19ca2687c3, from a clean detached checkout. Arc A770 driver 32.0.101.9175, Ryzen 7 3800X, Windows 11 Enterprise Evaluation 25H2 build 26200.9974, Rust/Cargo 1.100.0 MSVC, DXC 1.9.2609.5 (01b62ad47). Unoptimized test profile.

cargo test --locked -p xcl --lib --no-run --message-format=json
& $exe --exact gpu::recomp::tests::gpu_image_atomics_32bit_int_and_glc --nocapture --test-threads=1
& $exe --exact gpu::recomp::tests::gpu_image_atomics_32bit_cas_and_float --nocapture --test-threads=1

The two invocations used the pinned Cargo-emitted test executable and XCL_ADAPTER=A770 under the lab's Arc mutex. 2 passed, 0 failed, 0 ignored, 0 explicit skips. D3D12 reported 8–32 lanes per wave, so the stock fixtures ran native wave32 through HLSL/DXC. Each checked returned old values and final UAV texels across all 32 lanes. The contention cases checked final shared texels. Swap was the explicit GLC=0 VDATA preservation check.

Not tested

Native or split wave64, direct DXIL, release, other adapters, the full workspace suite, retail smoke, and negative controls.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the fixtures, checked their assertion scope, and drafted this report.

@github-actions

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Nov 28, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head bfdefbe

No open or merged PR adds these GPU tests of the 32-bit image_atomic_* ops. #1778 and #2276 test MIMG parity between direct DXIL and HLSL, which is a different check.
One case now contradicts main. gpu_image_atomics_32bit_cas_and_float expects image_atomic_fcmpswap with +0.0 in memory and -0.0 as the compare value not to swap (FCMP_CASES[1]). Since #2011, float compare-and-swap uses IEEE equality: -0.0 == +0.0 swaps, and main's gpu_float_cas_uses_ieee_equality asserts exactly that for image_atomic_fcmpswap. After a rebase, this case fails on a GPU and needs to expect the swap.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

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

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants