Recompiler: 64-bit image atomics keep all 64 bits (#1485) #1533

Open
github-bot wants to merge 1 commit from github-bot/gh-1533 into main AGit
Owner

@⁠enderrr9 on GitHub · 2026-11-24 17:19 UTC · original
enderrr9:recomp-image-atomics-64 → main · +159 −0 · 2 files · 1 commits · open

An image atomic with DMASK 0x3 (0xF for cmpswap) works on 64 bits: VDATA[0:1] against the texel's two dwords. The MIMG atomic arms never read DMASK, so XCL ran these on the low dword only. An add lost its carry, a max ordered by the low dword, and the program still counted as translated. They now run as SM 6.6 64-bit typed atomics on a uint64_t / int64_t view of the R32G32_UINT texel. Fixes #1485.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: a 64-bit arm ahead of the 32-bit atomic arms in mimg, picked by DMASK. It covers add, sub, and, or, xor, swap, umin/umax, smin/smax (int64 view), and cmpswap/fcmpswap (bitwise, compare value in VDATA[2:3]). inc/dec run as a compare-exchange loop. With GLC, the old value comes back in VDATA[0:1]. 64-bit float min/max have no typed HLSL form, so they are refused (image_atomic 64-bit float min/max) instead of mistranslated.
  • crates/xcl/src/gpu/recomp/tests.rs: gpu_image_atomics_64_bit is the test from #1485, written by its author and used unchanged. gpu_image_atomics_64_bit_cmpswap_smin_inc covers cmpswap with GLC (exactly one lane sees the initial texel, and the rest get the swapped one), a signed min decided by the high dwords, and an inc that carries past 2^32 with a limit above 2^32.

Tested

  • NVIDIA GeForce RTX 3050 Laptop GPU (4 GB, driver 621.24, 32-lane waves, so the split wave64 path), AMD Ryzen 5 4600H, Windows 11 build 26300, rustc 1.100.0 (MSVC), DXC 1.8.2502.11, debug build
  • Head 4426781 (rebased onto main 3f27770; only tests.rs conflicted, both sides' new tests kept). cargo test --workspace -- --test-threads=4: 1280 passed, 1 failed, 26 ignored. The failure is lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, which fails the same way on plain main 3f27770 (3 of 3 runs, lower_dxil.rs:1155), so it is not from this PR. 24 SKIPPED, all "no wave64" except three lower_dxil per-lane forms refused for #1426.
  • gpu_image_atomics_64_bit and gpu_image_atomics_64_bit_cmpswap_smin_inc pass on 4426781. Without the emit.rs change (checked on the first head 23d6656), both fail: image_atomic_add 64-bit: 0x00000000ffffffc0, want 0x0000003fffffffc0, image_atomic_umax 64-bit: 0x00000000000003e8, want 0x0000003f000003a9, and image_atomic_cmpswap 64-bit: texel 0x0000000100000000 is no lane's new value.
  • Other people's runs of the first head 23d6656 are in the comments: AMD RX 9070 XT (native wave64), RTX 3060, 3070, 5090, and a smoke run on a retail title.

Regression run
The rebase changed the head commit, so the smoke runs posted for 23d6656 no longer count. I have no title, so a run of 4426781 is needed from someone who has one.

main:

PR:

Not tested

  • any retail title (no smoke run, see above), so which 64-bit atomic programs a title reaches, and whether its picture changes, is unknown
  • AMD / native wave64, and Intel
  • a host without AtomicInt64OnTypedResourceSupported / AtomicInt64OnDescriptorHeapResourceSupported: the translation doesn't check these caps, and I haven't checked how such a host handles the pipeline
  • the and / or / xor / swap / sub / smax / dec / fcmpswap forms on the GPU (they are emitted but not exercised by the tests)

AI use

  • Claude Code with Claude Opus 5.5: wrote the emit.rs change, the second test and this description, and ran the tests above. The first test is from the issue.
**@⁠enderrr9** on GitHub · 2026-11-24 17:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533) `enderrr9:recomp-image-atomics-64` → `main` · +159 −0 · 2 files · 1 commits · open An image atomic with DMASK 0x3 (0xF for cmpswap) works on 64 bits: VDATA[0:1] against the texel's two dwords. The MIMG atomic arms never read DMASK, so XCL ran these on the low dword only. An add lost its carry, a max ordered by the low dword, and the program still counted as translated. They now run as SM 6.6 64-bit typed atomics on a `uint64_t` / `int64_t` view of the R32G32_UINT texel. Fixes #1485. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: a 64-bit arm ahead of the 32-bit atomic arms in `mimg`, picked by DMASK. It covers add, sub, and, or, xor, swap, umin/umax, smin/smax (int64 view), and cmpswap/fcmpswap (bitwise, compare value in VDATA[2:3]). inc/dec run as a compare-exchange loop. With GLC, the old value comes back in VDATA[0:1]. 64-bit float min/max have no typed HLSL form, so they are refused (`image_atomic 64-bit float min/max`) instead of mistranslated. - `crates/xcl/src/gpu/recomp/tests.rs`: `gpu_image_atomics_64_bit` is the test from #1485, written by its author and used unchanged. `gpu_image_atomics_64_bit_cmpswap_smin_inc` covers cmpswap with GLC (exactly one lane sees the initial texel, and the rest get the swapped one), a signed min decided by the high dwords, and an inc that carries past 2^32 with a limit above 2^32. **Tested** - NVIDIA GeForce RTX 3050 Laptop GPU (4 GB, driver 621.24, 32-lane waves, so the split wave64 path), AMD Ryzen 5 4600H, Windows 11 build 26300, rustc 1.100.0 (MSVC), DXC 1.8.2502.11, debug build - Head `4426781` (rebased onto `main` `3f27770`; only `tests.rs` conflicted, both sides' new tests kept). `cargo test --workspace -- --test-threads=4`: 1280 passed, 1 failed, 26 ignored. The failure is `lower_dxil::tests::a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier`, which fails the same way on plain `main` `3f27770` (3 of 3 runs, `lower_dxil.rs:1155`), so it is not from this PR. 24 SKIPPED, all "no wave64" except three `lower_dxil` per-lane forms refused for #1426. - `gpu_image_atomics_64_bit` and `gpu_image_atomics_64_bit_cmpswap_smin_inc` pass on `4426781`. Without the `emit.rs` change (checked on the first head `23d6656`), both fail: `image_atomic_add 64-bit: 0x00000000ffffffc0, want 0x0000003fffffffc0`, `image_atomic_umax 64-bit: 0x00000000000003e8, want 0x0000003f000003a9`, and `image_atomic_cmpswap 64-bit: texel 0x0000000100000000 is no lane's new value`. - Other people's runs of the first head `23d6656` are in the comments: AMD RX 9070 XT (native wave64), RTX 3060, 3070, 5090, and a smoke run on a retail title. **Regression run** The rebase changed the head commit, so the smoke runs posted for `23d6656` no longer count. I have no title, so a run of `4426781` is needed from someone who has one. main: PR: **Not tested** - any retail title (no smoke run, see above), so which 64-bit atomic programs a title reaches, and whether its picture changes, is unknown - AMD / native wave64, and Intel - a host without `AtomicInt64OnTypedResourceSupported` / `AtomicInt64OnDescriptorHeapResourceSupported`: the translation doesn't check these caps, and I haven't checked how such a host handles the pipeline - the and / or / xor / swap / sub / smax / dec / fcmpswap forms on the GPU (they are emitted but not exercised by the tests) **AI use** - Claude Code with Claude Opus 5.5: wrote the `emit.rs` change, the second test and this description, and ran the tests above. The first test is from the issue.
An MIMG image atomic with DMASK 0x3 (0xF for cmpswap) works on the
texel's two dwords, VDATA[0:1] (cmpswap: compare value in VDATA[2:3]).
The atomic arms never read DMASK and ran a 32-bit atomic on the low
dword: an add lost the carry and a max ordered by the low dword.

They now run as SM 6.6 64-bit typed atomics on a uint64_t / int64_t
view of the R32G32_UINT texel (add, sub, and, or, xor, swap, u/s min,
u/s max, cmpswap, fcmpswap bitwise; inc / dec as a compare-exchange
loop), with GLC returning the old value in VDATA[0:1]. 64-bit float
min / max have no typed form and are refused.

Tests: gpu_image_atomics_64_bit (the issue's test, by
13hourstilliland) and gpu_image_atomics_64_bit_cmpswap_smin_inc. Both
fail on main and pass with the change on an RTX 3050 Laptop GPU.

Fixes #1485

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:56:44 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 17:24 UTC · original

Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on main@9e3831e (baseline 776 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
778 passed; 0 failed; 41 ignored   (exit 0)

Two more passing tests than the baseline; keeping all 64 bits in 64-bit image atomics ships its cases and they run green.

Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

**@⁠dcastell1** on GitHub · 2026-11-24 17:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7139147909) Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on `main@9e3831e` (baseline **776 passed, 0 failed, 41 ignored** on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 778 passed; 0 failed; 41 ignored (exit 0) ``` Two more passing tests than the baseline; keeping all 64 bits in 64-bit image atomics ships its cases and they run green. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 17:34 UTC · original

Checked on NVIDIA at head 23d6656: pass.

Tested

  • RTX 3070, driver 616.56 (32-lane waves, so the split form), Windows 11 Pro 26100, Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug.
  • cargo test -p xcl --lib -- image_atomic --test-threads=1: gpu_image_atomics_64_bit and gpu_image_atomics_64_bit_cmpswap_smin_inc pass.
  • An extra test of my own, added locally (not part of this PR), also passes. It has a 64-bit add with GLC (each lane gets a distinct earlier sum), umax, smin over negative values, and cmpswap with GLC (exactly one lane sees the initial texel; the others get the winner's value). It also puts a 32-bit image_atomic_cmpswap (DMASK 0x3) in the same program, and that one must leave the texel's high dword alone. Test: https://github.com/upipibi/xcl/blob/fix/image-atomic-64/crates/xcl/src/gpu/recomp/tests.rs (gpu_image_atomics_64_bit there).

Not tested: the whole suite, AMD, a retail run.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment.

**@⁠upipibi** on GitHub · 2026-11-24 17:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7139403027) Checked on NVIDIA at head `23d6656`: pass. **Tested** - RTX 3070, driver 616.56 (32-lane waves, so the split form), Windows 11 Pro 26100, Rust 1.100.0 MSVC, DXC 1.8.2502.11, debug. - `cargo test -p xcl --lib -- image_atomic --test-threads=1`: `gpu_image_atomics_64_bit` and `gpu_image_atomics_64_bit_cmpswap_smin_inc` pass. - An extra test of my own, added locally (not part of this PR), also passes. It has a 64-bit add with GLC (each lane gets a distinct earlier sum), umax, smin over negative values, and cmpswap with GLC (exactly one lane sees the initial texel; the others get the winner's value). It also puts a 32-bit `image_atomic_cmpswap` (DMASK 0x3) in the same program, and that one must leave the texel's high dword alone. Test: https://github.com/upipibi/xcl/blob/fix/image-atomic-64/crates/xcl/src/gpu/recomp/tests.rs (`gpu_image_atomics_64_bit` there). **Not tested**: the whole suite, AMD, a retail run. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment.
Author
Owner

@⁠eizispark on GitHub · 2026-11-24 17:55 UTC · original

Hardware test report — commit 23d6656

Checked 23d6656744935901eff8cc85ce3593da600ae82c (based on main 9e3831e1f570d3646e53ab753b19ec07eb8f1485): pass.

Tested

  • Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profile
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 778 passed, 0 failed, 41 ignored (1 skipped: heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows)
  • cargo test -p xcl --lib image_atomics_64_bit -- --nocapture: 2 passed, 0 failed, 0 ignored, 0 skipped (gpu::recomp::tests::gpu_image_atomics_64_bit and gpu::recomp::tests::gpu_image_atomics_64_bit_cmpswap_smin_inc executed natively in wave32 and wave64 on AMD RDNA4 RWTexture2D<uint64_t> over R32G32_UINT)

Regression run
main (9e3831e):

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14728 MB

PR (23d6656):

xcl-smoke v1
commit: 23d6656744935901eff8cc85ce3593da600ae82c
gpu: AMD Radeon RX 9070 XT
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1677 (PresentX 1677)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14863 MB

Not tested

  • adapters without AtomicInt64OnTypedResourceSupported / AtomicInt64OnDescriptorHeapResourceSupported, NVIDIA/Intel GPUs, Wine/vkd3d-proton, XCL_SAMPLE_*

AI use

  • Antigravity (Google DeepMind, Gemini 4 Carbon) — ran the workspace test suite and 60 s retail smoke run on this commit and formatted the report.
**@⁠eizispark** on GitHub · 2026-11-24 17:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7139906990) ### Hardware test report — commit `23d6656` Checked `23d6656744935901eff8cc85ce3593da600ae82c` (based on `main` `9e3831e1f570d3646e53ab753b19ec07eb8f1485`): **pass**. **Tested** - Hardware: Windows 11 x64, AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RDNA4, native wave32 + wave64, driver 32.0.32015.16001), 32 GB RAM, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, release + test profile - `cargo test --workspace --no-fail-fast -- --test-threads=4`: `778 passed, 0 failed, 41 ignored` (`1` skipped: `heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows`) - `cargo test -p xcl --lib image_atomics_64_bit -- --nocapture`: `2 passed, 0 failed, 0 ignored, 0 skipped` (`gpu::recomp::tests::gpu_image_atomics_64_bit` and `gpu::recomp::tests::gpu_image_atomics_64_bit_cmpswap_smin_inc` executed natively in wave32 and wave64 on AMD RDNA4 `RWTexture2D<uint64_t>` over `R32G32_UINT`) **Regression run** `main` (`9e3831e`): ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1677 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14728 MB ``` PR (`23d6656`): ``` xcl-smoke v1 commit: 23d6656744935901eff8cc85ce3593da600ae82c gpu: AMD Radeon RX 9070 XT title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1677 (PresentX 1677) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14863 MB ``` **Not tested** - adapters without `AtomicInt64OnTypedResourceSupported` / `AtomicInt64OnDescriptorHeapResourceSupported`, NVIDIA/Intel GPUs, Wine/vkd3d-proton, `XCL_SAMPLE_*` **AI use** - Antigravity (Google DeepMind, Gemini 4 Carbon) — ran the workspace test suite and 60 s retail smoke run on this commit and formatted the report.
Author
Owner

@⁠vitor127wt on GitHub · 2026-11-24 18:23 UTC · original

I ran the retail smoke comparison requested in #1243 on Proton. Both runs used the same Xbox title for 60 seconds, with fresh Proton prefixes and XCL caches.

Tested

  • Ryzen 7 9700X, 32 GB DDR5 and NVIDIA GeForce RTX 5070 Ti with driver 620.73.04 on CachyOS (kernel 7.3.5-2-cachyos).
  • Proton Experimental 11.0 (experimental-11.0-20261112-x86_64), vkd3d-proton ec207194 with the XCL patch from #257, DXC 1.9.2609.5 and VKD3D_CONFIG=ignore_shared_fence.
  • Windows MSVC release builds from clean checkouts using cargo xwin build --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --bin xcl. Ran scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 60 from #257 with XCL_EXE pointing to the matching build.
  • Built the release test executable with cargo xwin test --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --lib --no-run. Ran wine <xcl-test.exe> gpu_image_atomics_64_bit --test-threads=1 --nocapture with Proton's Wine on the RTX 5070 Ti. 2 passed, 0 failed, 0 ignored, 0 skipped.

Regression run

The title field omits a local folder suffix. All measurements are as emitted by the script.

main

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1193 (PresentX 1193)
presents per 2 s (last 3): 60 60 57
device removals: 0
crashes: 0
peak commit: 0 MB

PR head

xcl-smoke v1
commit: 23d6656744935901eff8cc85ce3593da600ae82c
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1192 (PresentX 1192)
presents per 2 s (last 3): 60 58 60
device removals: 0
crashes: 0
peak commit: 0 MB

Not tested

Native Windows with scripts/smoke.ps1 and the full workspace suite. Wine reported peak commit: 0 MB in both runs, so these blocks provide no usable peak memory comparison.

AI use

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

**@⁠vitor127wt** on GitHub · 2026-11-24 18:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7140567390) I ran the retail smoke comparison requested in [#1243](https://git.gtahub.st/github/xcl-dev--xcl/issues/1243) on Proton. Both runs used the same Xbox title for 60 seconds, with fresh Proton prefixes and XCL caches. **Tested** - Ryzen 7 9700X, 32 GB DDR5 and NVIDIA GeForce RTX 5070 Ti with driver 620.73.04 on CachyOS (kernel `7.3.5-2-cachyos`). - Proton Experimental 11.0 (`experimental-11.0-20261112-x86_64`), vkd3d-proton `ec207194` with the XCL patch from #257, DXC 1.9.2609.5 and `VKD3D_CONFIG=ignore_shared_fence`. - Windows MSVC release builds from clean checkouts using `cargo xwin build --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --bin xcl`. Ran `scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 60` from #257 with `XCL_EXE` pointing to the matching build. - Built the release test executable with `cargo xwin test --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --lib --no-run`. Ran `wine <xcl-test.exe> gpu_image_atomics_64_bit --test-threads=1 --nocapture` with Proton's Wine on the RTX 5070 Ti. **2 passed, 0 failed, 0 ignored, 0 skipped.** **Regression run** The `title` field omits a local folder suffix. All measurements are as emitted by the script. `main` ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1193 (PresentX 1193) presents per 2 s (last 3): 60 60 57 device removals: 0 crashes: 0 peak commit: 0 MB ``` PR head ``` xcl-smoke v1 commit: 23d6656744935901eff8cc85ce3593da600ae82c gpu: NVIDIA GeForce RTX 5070 Ti title: GTA6.Xbox.v1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1192 (PresentX 1192) presents per 2 s (last 3): 60 58 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` **Not tested** Native Windows with `scripts/smoke.ps1` and the full workspace suite. Wine reported `peak commit: 0 MB` in both runs, so these blocks provide no usable peak memory comparison. **AI use** OpenAI Codex (GPT-6, exact variant unavailable) ran the tests and prepared this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 19:05 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 19:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7141593553) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. Thanks!
Author
Owner

@⁠throny on GitHub · 2026-11-24 19:55 UTC · original

Two contributors checked independently and found that #1541 #1551 solves the same problem (for #1485) in a different way: #1607, group D9. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

**@⁠throny** on GitHub · 2026-11-24 19:55 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7142780614) <!-- xcl-1607-hint:D9 --> Two contributors checked independently and found that #1541 #1551 solves the same problem (for #1485) in a different way: #1607, group D9. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint, not a request from the maintainers; nobody from the project has adopted #1607 so far. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Author
Owner

@⁠enderrr9 on GitHub · 2026-11-25 18:50 UTC · original

Thanks, everyone, for the test runs (AMD RX 9070 XT native wave64, RTX 3060 / 3070 / 5070 Ti / 5090, and the two smoke runs).

I rebased onto main 3f27770 to fix the merge conflict (only tests.rs; both sides' new tests are kept), so the head is now 4426781 and the smoke runs of 23d6656 no longer count. If someone with a title can rerun it on the new head, please paste both blocks here:

git fetch origin main pull/1533/head:pr-1533
git checkout origin/main;  cargo build --release -p xcl;  .\scripts\smoke.ps1 -Game '<your game folder>'
git checkout 4426781;      cargo build --release -p xcl;  .\scripts\smoke.ps1 -Game '<your game folder>'

The full suite on the new head is in the description. Its one failure, a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier, fails on plain main 3f27770 too.

On the overlap hint: #1541 and #1551 were opened after this PR and fix the same issue, #1485. I'm happy for the maintainer to pick whichever fits best.

(Posted with Claude Code, Claude Opus 5.5.)

**@⁠enderrr9** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7171463808) Thanks, everyone, for the test runs (AMD RX 9070 XT native wave64, RTX 3060 / 3070 / 5070 Ti / 5090, and the two smoke runs). I rebased onto `main` `3f27770` to fix the merge conflict (only `tests.rs`; both sides' new tests are kept), so the head is now **`4426781`** and the smoke runs of `23d6656` no longer count. If someone with a title can rerun it on the new head, please paste both blocks here: ```powershell git fetch origin main pull/1533/head:pr-1533 git checkout origin/main; cargo build --release -p xcl; .\scripts\smoke.ps1 -Game '<your game folder>' git checkout 4426781; cargo build --release -p xcl; .\scripts\smoke.ps1 -Game '<your game folder>' ``` The full suite on the new head is in the description. Its one failure, `a_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrier`, fails on plain `main` `3f27770` too. On the overlap hint: #1541 and #1551 were opened after this PR and fix the same issue, #1485. I'm happy for the maintainer to pick whichever fits best. (Posted with Claude Code, Claude Opus 5.5.)
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-24 17:28 UTC · original · edited 2026-11-25 19:04 UTC

Update for head 4426781: same result. Applied on main 2898511, gpu_image_atomics_64_bit and gpu_image_atomics_64_bit_cmpswap_smin_inc pass on the RX 9070 XT (native wave64) and the RTX 3060. Whole gpu:: filter: RX 9070 XT 694 passed, 2 failed (the AMD fuzz seeds tracked in #2115, same on main); RTX 3060 696 passed, 0 failed.


AMD run with 64-lane waves, which this PR lists as not tested (the other report here is NVIDIA).

Tested: pass, head 23d6656 applied on its base main 9e3831e, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17.
cargo test -p xcl --lib -- gpu::recomp --test-threads=4:

  • AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 194 passed, 0 failed, 18 ignored, 0 SKIPPED. gpu_image_atomics_64_bit and gpu_image_atomics_64_bit_cmpswap_smin_inc ok.
  • NVIDIA RTX 3060, driver 32.0.16.1088: 194 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). Both ok.

Not tested: Intel; a host without 64-bit image atomics; the whole workspace suite; a title.

AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-24 17:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7139256199) · edited 2026-11-25 19:04 UTC **Update for head `4426781`:** same result. Applied on `main` `2898511`, `gpu_image_atomics_64_bit` and `gpu_image_atomics_64_bit_cmpswap_smin_inc` pass on the RX 9070 XT (native wave64) and the RTX 3060. Whole `gpu::` filter: RX 9070 XT 694 passed, 2 failed (the AMD fuzz seeds tracked in #2115, same on `main`); RTX 3060 696 passed, 0 failed. --- AMD run with 64-lane waves, which this PR lists as not tested (the other report here is NVIDIA). **Tested:** pass, head `23d6656` applied on its base `main` `9e3831e`, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, DXC 1.9.2602.17. `cargo test -p xcl --lib -- gpu::recomp --test-threads=4`: - AMD RX 9070 XT (RDNA4), driver 32.0.32029.2010, native wave64: 194 passed, 0 failed, 18 ignored, 0 SKIPPED. `gpu_image_atomics_64_bit` and `gpu_image_atomics_64_bit_cmpswap_smin_inc` ok. - NVIDIA RTX 3060, driver 32.0.16.1088: 194 passed, 0 failed, 18 ignored, 2 SKIPPED (no wave64). Both ok. **Not tested:** Intel; a host without 64-bit image atomics; the whole workspace suite; a title. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@ -2984,0 +3000,4 @@
self.line(&format!("{vt} {t}_old = 0;"));
let texel = format!("{t}_U[{icoord}]");
let cas = |new: &str| {
format!("uint64_t {t}_c = 0; [allow_uav_condition] for (uint {t}_i = 0u; {t}_i < 4096u; {t}_i++) {{ uint64_t {t}_n = {new}; uint64_t {t}_p = 0; InterlockedCompareExchange({texel}, {t}_c, {t}_n, {t}_p); if ({t}_p == {t}_c) break; {t}_c = {t}_p; }} {t}_old = {t}_c;")
Author
Owner

@⁠gut0to on GitHub · 2026-11-24 17:22 UTC · original

If every compare-exchange attempt loses to concurrent updates, this loop exits after 4096 iterations and then assigns _old = _c without recording whether any exchange succeeded. That silently drops the 64-bit inc or dec operation under contention. Please retry until the compare-exchange succeeds, or handle exhaustion as a failure. AI-assisted review: I checked the generated loop and its post-loop success handling.

**@⁠gut0to** on GitHub · 2026-11-24 17:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#discussion_r4683872867) If every compare-exchange attempt loses to concurrent updates, this loop exits after 4096 iterations and then assigns `_old = _c` without recording whether any exchange succeeded. That silently drops the 64-bit `inc` or `dec` operation under contention. Please retry until the compare-exchange succeeds, or handle exhaustion as a failure. AI-assisted review: I checked the generated loop and its post-loop success handling.
@ -2984,0 +3000,4 @@
self.line(&format!("{vt} {t}_old = 0;"));
let texel = format!("{t}_U[{icoord}]");
let cas = |new: &str| {
format!("uint64_t {t}_c = 0; [allow_uav_condition] for (uint {t}_i = 0u; {t}_i < 4096u; {t}_i++) {{ uint64_t {t}_n = {new}; uint64_t {t}_p = 0; InterlockedCompareExchange({texel}, {t}_c, {t}_n, {t}_p); if ({t}_p == {t}_c) break; {t}_c = {t}_p; }} {t}_old = {t}_c;")
Author
Owner

@⁠enderrr9 on GitHub · 2026-11-25 18:50 UTC · original

Thanks for checking the loop. The bound is deliberate and matches every compare-exchange loop the recompiler already emits: the 32- and 64-bit buffer, flat and LDS loops in rmw32 / rmw64 all stop after 4096 attempts (HANDOFF: "a bounded CAS loop (4096)"). An unbounded loop that a lane never leaves would hang the GPU and remove the device, which is worse than a dropped inc / dec. With at most 64 lanes of a wave on one texel, each round lets at least one lane win, so 4096 is only reached under contention far beyond that. Changing this policy for all of the loops (retry until success, or report exhaustion) would be its own PR, so I'd keep this one consistent with the others.

(Reply written with Claude Code, Claude Opus 5.5, after checking the existing loops.)

**@⁠enderrr9** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#discussion_r4699414280) Thanks for checking the loop. The bound is deliberate and matches every compare-exchange loop the recompiler already emits: the 32- and 64-bit buffer, flat and LDS loops in `rmw32` / `rmw64` all stop after 4096 attempts (HANDOFF: "a bounded CAS loop (4096)"). An unbounded loop that a lane never leaves would hang the GPU and remove the device, which is worse than a dropped inc / dec. With at most 64 lanes of a wave on one texel, each round lets at least one lane win, so 4096 is only reached under contention far beyond that. Changing this policy for all of the loops (retry until success, or report exhaustion) would be its own PR, so I'd keep this one consistent with the others. (Reply written with Claude Code, Claude Opus 5.5, after checking the existing loops.)
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 05:40 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 05:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#issuecomment-7183701699) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Author
Owner

@⁠gut0to on GitHub · 2026-11-24 17:22 UTC · original · reviewed

AI-assisted review (GPT-6): I verified the exhaustion path in the generated compare-exchange loop.

**@⁠gut0to** on GitHub · 2026-11-24 17:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1533#pullrequestreview-6044100597) · **reviewed** AI-assisted review (GPT-6): I verified the exhaustion path in the generated compare-exchange loop.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1533/head:github-bot/gh-1533'
git switch 'github-bot/gh-1533'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1533'
git switch 'github-bot/gh-1533'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1533'
git switch 'github-bot/gh-1533'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1533'
git switch 'main'
git merge --squash 'github-bot/gh-1533'
git switch 'main'
git merge --ff-only 'github-bot/gh-1533'
git switch 'main'
git merge 'github-bot/gh-1533'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.