Skip to content

rdna2spirv: global_atomic_add/sub_x2 and buffer_atomic_add/sub_x2 - #174

Closed
Andretuta wants to merge 5 commits into
mainfrom
old-pr/9909
Closed

Andretuta wants to merge 5 commits into
mainfrom
old-pr/9909

Conversation

@Andretuta

Copy link
Copy Markdown
Collaborator

Carried over from old PR 9909 by LouisRiverstone in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9909, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
LouisRiverstone: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

global_atomic_add_x2/sub_x2 and buffer_atomic_add_x2/sub_x2 raised Unsupported. This is the global and buffer counterpart of #2738, which does the same for ds_add/sub_u64. The global and buffer _x2 paths weren't in #2738, and no one had claimed them.

Re-submission of #3065. #3065 was closed unmerged during the 2026-11-23 22:45 UTC cleanup, along with the other open PRs. This is the same branch, now merged with current main.

Checked on #3065 by: TheMrBeez (the GPU), bobcatchris (Pro V540), zzEmmazz (main 1628210), theswiss24 (RTX 2060 SUPER), DenRakEiw (Windows 11), kapitche (native Windows), DavidM1911 (two Vulkan devices), tylerstraub (RTX 5090), GustawMatuszewski (two devices. Ubuntu 26.04.1), Sangonapou (RTX 3080 Ti Laptop), YordiLorenzo (RTX 5090), leonidassupporter (RTX 3060 Ti) and 2 more.

No game files.

AI-assisted (Claude Code): I reviewed the change and re-ran its tests on the merge with main.

Both pairs raised Unsupported. A 64-bit add/sub is exact with two 32-bit
atomics: the low dword's atomic returns its old value, which gives this op's
own carry (borrow), and the high dword then takes DATA.hi + carry. Addition
commutes, so memory is exact under contention; only the returned high dword
can be torn. x2_atomic_words holds both the carry pair and the per-dword
bitwise/swap ops; the global and buffer _x2 paths (with main's alignment
guard) call it.

Tests: test_global_atomics_x2.py / test_buffer_atomics_x2.py add the carry
and borrow cases and 32 lanes adding to one element; test_global_atomics.py's
rejected list uses smin_x2. docs/design.md rows updated.
# Conflicts:
#	tools/rdna2spirv.py
milk4sale added a commit to milk4sale/leonida that referenced this pull request Nov 24, 2026
…RIFIED-ATOMICS)

Six contract rows ended with "Not GPU-verified" although fixtures on main
already run them through scripts/run_gpu_tests.py and check.py:
cs_lds_atomics_ext, cs_lds_xchg64_ext, cs_global_mem_ext, cs_w32_fcmpswap
and cs_w32_new_ops. Each row now names its fixture, the forms and cases it
compares, the GPUs it passed on (Radeon 610M, RADV Mesa 26.2.6; RTX 4070 Ti,
620.70.06), and what stays unchecked.

Rows: 8/16-bit global stores and d16 loads, ds_cmpst_f32 / fcmpswap,
ds_mskor, ds_{inc,dec,rsub}_u32 / ds_{min,max}_f32, ds_wrxchg2_rtn_b32,
ds_and/or/xor_b64. Row 279 also gets back the opening ** of its
"Hardware-measured natively on gfx1100" note.

Left out: Global atomics (32-bit) and buffer_atomic_{and,or,xor,swap}_x2,
which open pull requests ProjectLeonida#191 and ProjectLeonida#174 rewrite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
milk4sale added a commit to milk4sale/leonida that referenced this pull request Nov 24, 2026
…RIFIED-ATOMICS)

Six contract rows ended with "Not GPU-verified" although fixtures on main
already run them through scripts/run_gpu_tests.py and check.py:
cs_lds_atomics_ext, cs_lds_xchg64_ext, cs_global_mem_ext, cs_w32_fcmpswap
and cs_w32_new_ops. Each row now names its fixture, the forms and cases it
compares, the GPUs it passed on (Radeon 610M, RADV Mesa 26.2.6; RTX 4070 Ti,
620.70.06), and what stays unchecked.

Rows: 8/16-bit global stores and d16 loads, ds_cmpst_f32 / fcmpswap,
ds_mskor, ds_{inc,dec,rsub}_u32 / ds_{min,max}_f32, ds_wrxchg2_rtn_b32,
ds_and/or/xor_b64. Row 279 also gets back the opening ** of its
"Hardware-measured natively on gfx1100" note.

Left out: Global atomics (32-bit) and buffer_atomic_{and,or,xor,swap}_x2,
which open pull requests ProjectLeonida#191 and ProjectLeonida#174 rewrite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aslan2142

Copy link
Copy Markdown
Collaborator

Thanks for carrying this over, and thanks to the original author for the work. I'm closing this draft in favour of #865 (#865):

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

@aslan2142 aslan2142 closed this Nov 24, 2026
milk4sale pushed a commit to milk4sale/leonida that referenced this pull request Nov 27, 2026
…wait-reserves-tick

GPU: a frame wait takes its tick before it sleeps
@aslan2142
aslan2142 deleted the old-pr/9909 branch December 1, 2026 16:59
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.

3 participants