Repository navigation
Conversation
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 xcl-dev#1485 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gut0to
left a comment
There was a problem hiding this comment.
AI-assisted review (GPT-6): I verified the exhaustion path in the generated compare-exchange loop.
| 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;") |
There was a problem hiding this comment.
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.
|
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 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. |
|
AMD run with 64-lane waves, which this PR lists as not tested (the other report here is NVIDIA). Tested: pass, head
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. |
|
Checked on NVIDIA at head Tested
Not tested: the whole suite, AMD, a retail run. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment. |
Hardware test report — commit
|
|
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
Regression run The
PR head Not tested Native Windows with AI use OpenAI Codex (GPT-6, exact variant unavailable) ran the tests and prepared this report. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Adapt xcl-dev#1541 and the signed views and contention fixtures from xcl-dev#1533. Key translation caches on the device capability. Five independent operations failed on the baseline and passed on the RTX 5070. Co-authored-by: enderrr9 <178652333+enderrr9@users.noreply.github.com> Assisted-by: OpenCode (Gemini 4 Neon) Assisted-by: T3 Code (gpt-6.2-astra)
|
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. |
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_tview 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 inmimg, 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_bitis the test from Recompiler: 64-bit image atomics (DMASK 0x3) run as 32-bit atomics on the low dword #1485, written by its author and used unchanged.gpu_image_atomics_64_bit_cmpswap_smin_inccovers 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
cargo test --workspace -- --test-threads=4: 778 passed, 0 failed, 41 ignored. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows). This ran on the tree before one comment-only wording change inemit.rs. On the head commit 23d6656,cargo test -p xcl --lib gpu_image -- --test-threads=1gives 5 passed, 0 failed.emit.rschange, both new tests fail. The first fails with the issue's numbers:image_atomic_add 64-bit: 0x00000000ffffffc0, want 0x0000003fffffffc0andimage_atomic_umax 64-bit: 0x00000000000003e8, want 0x0000003f000003a9. The second fails withimage_atomic_cmpswap 64-bit: texel 0x0000000100000000 is no lane's new value.Regression run
I have no title, so there is no smoke run. If someone with a title can run
scripts/smoke.ps1onmainand on 23d6656, I'll add both blocks here.main:
PR:
Not tested
AtomicInt64OnTypedResourceSupported/AtomicInt64OnDescriptorHeapResourceSupported: the translation doesn't check these caps, and I haven't checked how such a host handles the pipelineAI use
emit.rschange, the second test and this description, and ran the tests above. The first test is from the issue.