[PR #413] [MERGED] docs/design.md: name the GPU fixtures of six atomics rows (DOC-GPU-VERIFIED-ATOMICS) #464

Closed
opened 2026-11-26 20:17:58 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/413
Author: @milk4sale
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @ubiquitarianism

Base: main ← Head: docs/gpu-verified-atomics


📝 Commits (3)

  • cf3951e docs/design.md: name the GPU fixtures of six atomics rows (DOC-GPU-VERIFIED-ATOMICS)
  • 457bad1 docs/design.md: match the fcmpswap NaN clause to the current fixture (DOC-GPU-VERIFIED-ATOMICS)
  • 4581d0a Merge main into docs/gpu-verified-atomics

📊 Changes

1 file changed (+6 additions, -6 deletions)

View changed files

📝 docs/design.md (+6 -6)

📄 Description

Claimed in the coordination issue as: DOC-GPU-VERIFIED-ATOMICS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7122360796)

Depends on: #186, #65 - conflicts only; nothing here builds on them. #186 edits the ds_wrxchg_rtn_b64 row, which sits between two rows changed here, and #65 inserts its Flat memory row right after the 8/16-bit global row. Both resolve by keeping both sides.

What and why

Six contract rows in docs/design.md ended with "Not GPU-verified.", but GPU fixtures on main already run them through scripts/run_gpu_tests.py and runtime/test/shaders/check.py, and no row named its fixture. Each row now names its fixture, says which forms and cases it compares and on which GPUs it passed, and keeps a Not GPU-verified: list of what is still unchecked. Docs only: six lines of one file.

Row Fixture Compared Still not GPU-verified
8/16-bit global stores and d16 loads cs_global_mem_ext global_store_short at byte 3 (both dwords), global_load_sbyte_d16_hi the other eight ops, an inactive lane
ds_cmpst_f32, global_/buffer_atomic_fcmpswap cs_w32_fcmpswap ds_cmpst_rtn_f32 −0/+0 match and NaN no-match, ds_cmpst_f32 no-match, buffer_atomic_fcmpswap −0/+0 match with glc and a one-ulp no-match without global_atomic_fcmpswap, the ds_cmpst_f32 match, a NaN in the buffer form, bounds, inactive lanes, contention
ds_mskor_b32/_rtn_b32 cs_lds_atomics_ext both forms, a DATA2 bit outside DATA, the returned word offset:, the 32-lane case
ds_{inc,dec,rsub}_u32, ds_{min,max}_f32 cs_lds_atomics_ext, cs_lds_xchg64_ext ds_inc_rtn_u32 wrap, ds_dec_u32 from 0, ds_rsub_u32 wrap (low byte of each), ds_min_f32 with a qNaN, ds_max_rtn_f32 −0/+0 (as an XOR) five other forms, the non-wrapping cases, offset:, inactive lanes, contention
ds_wrxchg2_rtn_b32 cs_w32_new_ops the first returned word, data1 in LDS the second returned word, data0, st64, one dword twice, aliasing
ds_and/or/xor_b64 cs_lds_atomics_ext, cs_lds_xchg64_ext ds_xor_rtn_b64, ds_and_b64, ds_or_rtn_b64 (the element only) ds_and_rtn_b64, ds_or_b64, ds_xor_b64, offset:, aliasing, contention

The coverage comes from the fixture bodies, not only their headers. Three things the headers don't say:

  • cs_w32_new_ops overwrites the second VGPR of ds_wrxchg2_rtn_b32's vdst with a read before storing it.
  • cs_w32_fcmpswap's NaN buffer_atomic_fcmpswap case stores only the returned word, which is the NaN whether or not it matched.
  • cs_lds_xchg64_ext never stores ds_or_rtn_b64's returned pair, and judges ds_max_rtn_f32 as the word left XOR the returned word.

Row 279 also gets back the opening ** of "Hardware-measured natively on gfx1100", lost in 6b5fc7fc8, so GitHub no longer prints a stray ** there. That row had two "Not GPU-verified" clauses (a later merge added the second); the first goes.

Left out or affected:

  • Global atomics (32-bit) and buffer_atomic_{and,or,xor,swap}_x2: #191 and #174 rewrite those rows. cs_global_mem_ext also covers parts of them (global_atomic_add/cmpswap, global_atomic_or_x2, buffer_atomic_xor_x2), so they can take the same kind of note once those land.
  • If #186 lands, two clauses here go stale ("its returned pair is not read" and "which does not tell the two apart"); whichever of the two merges second should update them.
  • #173 (cs_w32_late_ext, ds_mskor) and #171 (cs_w32_pk_rel_ext, ds_or/xor_b64) add fixtures for two of these rows without editing them; the rows can name those fixtures once they merge.

Tested

On main ece4ba5b3 plus this commit (since rebased on d2cd6c0d9, whose ten new commits change only runtime C++ tests, not the translator, the fixtures or docs/design.md), CachyOS (kernel 7.3.3), llvm-mc 23.1.4, SPIRV-Tools v2026.4, GCC 16.2.1, implicit Vulkan layers off (VK_LOADER_LAYERS_DISABLE=~implicit~). scripts/run_gpu_tests.py --filter <fixture> for each of the five fixtures, with LEONIDA_VK_DEVICE choosing the GPU (checked against vk_compute_test's device: line):

GPU Driver native LEONIDA_W64_EMULATE=1
Radeon 610M, Ryzen 9 7900X iGPU (gfx1036, RDNA2, subgroup 32..64) RADV Mesa 26.2.6 5/5 PASS, every word exact 5/5 PASS
NVIDIA RTX 4070 Ti (Ada, subgroup 32) 620.70.06 5/5 PASS 5/5 PASS

With LEONIDA_W64_EMULATE=1 the translator writes byte-identical SPIR-V for all five (one active lane, no cross-lane operation), so the emulated runs repeat the native test. That is why the rows name only the GPUs.

Also: tests/test_docs_links.py, tests/test_docs_design_rows.py and tests/test_design_contract_rows.py pass; scripts/check_no_game_data.py docs/design.md is clean. The translator suite and ctest were not run, since no code changed.

GPUs tested: AMD Radeon 610M (gfx1036), RADV Mesa 26.2.6, CachyOS Linux; NVIDIA GeForce RTX 4070 Ti, 620.70.06, CachyOS Linux.

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No new rule: this names existing fixtures.)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/413 **Author:** [@milk4sale](https://github.com/milk4sale) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `docs/gpu-verified-atomics` --- ### 📝 Commits (3) - [`cf3951e`](https://github.com/ubiquitarianism/leonida/commit/cf3951e75469388c7c8855b9d56f3e406b9a14ba) docs/design.md: name the GPU fixtures of six atomics rows (DOC-GPU-VERIFIED-ATOMICS) - [`457bad1`](https://github.com/ubiquitarianism/leonida/commit/457bad106548a3ccd7e814370c0fef510e16b487) docs/design.md: match the fcmpswap NaN clause to the current fixture (DOC-GPU-VERIFIED-ATOMICS) - [`4581d0a`](https://github.com/ubiquitarianism/leonida/commit/4581d0ad36e2a51b78d20b45e11c1e0400f4b018) Merge main into docs/gpu-verified-atomics ### 📊 Changes **1 file changed** (+6 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+6 -6) </details> ### 📄 Description Claimed in the coordination issue as: DOC-GPU-VERIFIED-ATOMICS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7122360796) Depends on: #186, #65 - conflicts only; nothing here builds on them. #186 edits the `ds_wrxchg_rtn_b64` row, which sits between two rows changed here, and #65 inserts its Flat memory row right after the 8/16-bit global row. Both resolve by keeping both sides. ### What and why Six contract rows in `docs/design.md` ended with "**Not GPU-verified.**", but GPU fixtures on `main` already run them through `scripts/run_gpu_tests.py` and `runtime/test/shaders/check.py`, and no row named its fixture. Each row now names its fixture, says which forms and cases it compares and on which GPUs it passed, and keeps a **Not GPU-verified:** list of what is still unchecked. Docs only: six lines of one file. | Row | Fixture | Compared | Still not GPU-verified | |---|---|---|---| | 8/16-bit global stores and d16 loads | `cs_global_mem_ext` | `global_store_short` at byte 3 (both dwords), `global_load_sbyte_d16_hi` | the other eight ops, an inactive lane | | `ds_cmpst_f32`, `global_`/`buffer_atomic_fcmpswap` | `cs_w32_fcmpswap` | `ds_cmpst_rtn_f32` −0/+0 match and NaN no-match, `ds_cmpst_f32` no-match, `buffer_atomic_fcmpswap` −0/+0 match with `glc` and a one-ulp no-match without | `global_atomic_fcmpswap`, the `ds_cmpst_f32` match, a NaN in the buffer form, bounds, inactive lanes, contention | | `ds_mskor_b32`/`_rtn_b32` | `cs_lds_atomics_ext` | both forms, a DATA2 bit outside DATA, the returned word | `offset:`, the 32-lane case | | `ds_{inc,dec,rsub}_u32`, `ds_{min,max}_f32` | `cs_lds_atomics_ext`, `cs_lds_xchg64_ext` | `ds_inc_rtn_u32` wrap, `ds_dec_u32` from 0, `ds_rsub_u32` wrap (low byte of each), `ds_min_f32` with a qNaN, `ds_max_rtn_f32` −0/+0 (as an XOR) | five other forms, the non-wrapping cases, `offset:`, inactive lanes, contention | | `ds_wrxchg2_rtn_b32` | `cs_w32_new_ops` | the first returned word, `data1` in LDS | the second returned word, `data0`, `st64`, one dword twice, aliasing | | `ds_and/or/xor_b64` | `cs_lds_atomics_ext`, `cs_lds_xchg64_ext` | `ds_xor_rtn_b64`, `ds_and_b64`, `ds_or_rtn_b64` (the element only) | `ds_and_rtn_b64`, `ds_or_b64`, `ds_xor_b64`, `offset:`, aliasing, contention | The coverage comes from the fixture bodies, not only their headers. Three things the headers don't say: - `cs_w32_new_ops` overwrites the second VGPR of `ds_wrxchg2_rtn_b32`'s `vdst` with a read before storing it. - `cs_w32_fcmpswap`'s NaN `buffer_atomic_fcmpswap` case stores only the returned word, which is the NaN whether or not it matched. - `cs_lds_xchg64_ext` never stores `ds_or_rtn_b64`'s returned pair, and judges `ds_max_rtn_f32` as the word left XOR the returned word. Row 279 also gets back the opening `**` of "**Hardware-measured natively on `gfx1100`**", lost in 6b5fc7fc8, so GitHub no longer prints a stray `**` there. That row had two "Not GPU-verified" clauses (a later merge added the second); the first goes. Left out or affected: - Global atomics (32-bit) and `buffer_atomic_{and,or,xor,swap}_x2`: #191 and #174 rewrite those rows. `cs_global_mem_ext` also covers parts of them (`global_atomic_add`/`cmpswap`, `global_atomic_or_x2`, `buffer_atomic_xor_x2`), so they can take the same kind of note once those land. - If #186 lands, two clauses here go stale ("its returned pair is not read" and "which does not tell the two apart"); whichever of the two merges second should update them. - #173 (`cs_w32_late_ext`, `ds_mskor`) and #171 (`cs_w32_pk_rel_ext`, `ds_or/xor_b64`) add fixtures for two of these rows without editing them; the rows can name those fixtures once they merge. ### Tested On `main` `ece4ba5b3` plus this commit (since rebased on `d2cd6c0d9`, whose ten new commits change only runtime C++ tests, not the translator, the fixtures or `docs/design.md`), CachyOS (kernel 7.3.3), llvm-mc 23.1.4, SPIRV-Tools v2026.4, GCC 16.2.1, implicit Vulkan layers off (`VK_LOADER_LAYERS_DISABLE=~implicit~`). `scripts/run_gpu_tests.py --filter <fixture>` for each of the five fixtures, with `LEONIDA_VK_DEVICE` choosing the GPU (checked against `vk_compute_test`'s `device:` line): | GPU | Driver | native | `LEONIDA_W64_EMULATE=1` | |---|---|---|---| | Radeon 610M, Ryzen 9 7900X iGPU (gfx1036, RDNA2, subgroup 32..64) | RADV Mesa 26.2.6 | 5/5 PASS, every word exact | 5/5 PASS | | NVIDIA RTX 4070 Ti (Ada, subgroup 32) | 620.70.06 | 5/5 PASS | 5/5 PASS | With `LEONIDA_W64_EMULATE=1` the translator writes byte-identical SPIR-V for all five (one active lane, no cross-lane operation), so the emulated runs repeat the native test. That is why the rows name only the GPUs. Also: `tests/test_docs_links.py`, `tests/test_docs_design_rows.py` and `tests/test_design_contract_rows.py` pass; `scripts/check_no_game_data.py docs/design.md` is clean. The translator suite and `ctest` were not run, since no code changed. GPUs tested: AMD Radeon 610M (gfx1036), RADV Mesa 26.2.6, CachyOS Linux; NVIDIA GeForce RTX 4070 Ti, 620.70.06, CachyOS Linux. AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No new rule: this names existing fixtures.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:58 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#464
No description provided.