rdna2spirv: add --int64-atomics option for 64-bit OpAtomicExchange on *_atomic_swap_x2 (SHADER-868) #251

Closed
kotekompotek wants to merge 1 commit from upstream-pr/251 into main
kotekompotek commented 2026-11-24 02:53:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T02:53:34Z.


Claimed in the coordination issue as: SHADER-868 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149)

What and why

  • Addressed @ubiquitarianism's review feedback on this opt-in feature PR (ds_wrxchg_rtn_b64 is untouched).
  • Added --int64-atomics flag forwarding in make_game.py (FALLBACK_FLAGS and CLI parser) alongside tools/rdna2spirv.py and runtime/test/shaders/build.py (LEONIDA_INT64_ATOMICS=1).
  • Updated the Global atomics and buffer_atomic_{and,or,xor,swap}_x2 rows in docs/design.md to document opt-in --int64-atomics vs the default 32-bit dword-pair approximation.
  • Added GPU shader fixture runtime/test/shaders/cs_atomic_swap_x2_int64.asm, registered it in runtime/test/shaders/check.py, scripts/run_gpu_tests.py, and tests/semantic/regen_fixtures.py (tests/semantic/fixtures/disasm/cs_atomic_swap_x2_int64.s).
  • Updated in commit 14eaf6052: enabled shaderBufferInt64Atomics on VkPhysicalDeviceVulkan12Features in runtime/shims/d3d12_vulkan_device.cpp (recorded in runtime/shims/d3d12_com.h, asserted in runtime/test/d3d12_vulkan_device_test.cpp), replaced the single-thread cs_atomic_swap_x2_int64.asm fixture with a 64-thread tearing check, and added dedicated --int64-atomics runner pass in scripts/run_gpu_tests.py.

Tested

On commit 14eaf6052:

  • python -I tests/semantic/regen_fixtures.py --check (OK)
  • python -I tests/semantic/test_atomic_swap_x2_int64.py (6/6 OK via spirv_mini_interp.run_workgroup, 64 threads + 14 = OpAtomicExchange %ulong)
  • tests/semantic/test_fixtures.py & tests/semantic/test_regen_fixtures.py (OK)
  • All 12 tests/test_docs_*.py (OK)
  • compileall (OK)
  • MSVC /W4 compile-check of runtime/shims/d3d12_vulkan_device.cpp & runtime/test/d3d12_vulkan_device_test.cpp (OK)
  • Note: live RDNA2/Vulkan hardware execution of the 64-thread tearing fixture not available locally.

GPUs tested: n/a

AI-assisted: yes

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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465186559 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/251). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-24T02:53:34Z. --- Claimed in the coordination issue as: SHADER-868 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149) ### What and why - Addressed @ubiquitarianism's review feedback on this opt-in feature PR (`ds_wrxchg_rtn_b64` is untouched). - Added `--int64-atomics` flag forwarding in `make_game.py` (`FALLBACK_FLAGS` and CLI parser) alongside `tools/rdna2spirv.py` and `runtime/test/shaders/build.py` (`LEONIDA_INT64_ATOMICS=1`). - Updated the `Global atomics` and `buffer_atomic_{and,or,xor,swap}_x2` rows in `docs/design.md` to document opt-in `--int64-atomics` vs the default 32-bit dword-pair approximation. - Added GPU shader fixture `runtime/test/shaders/cs_atomic_swap_x2_int64.asm`, registered it in `runtime/test/shaders/check.py`, `scripts/run_gpu_tests.py`, and `tests/semantic/regen_fixtures.py` (`tests/semantic/fixtures/disasm/cs_atomic_swap_x2_int64.s`). - Updated in commit `14eaf6052`: enabled `shaderBufferInt64Atomics` on `VkPhysicalDeviceVulkan12Features` in `runtime/shims/d3d12_vulkan_device.cpp` (recorded in `runtime/shims/d3d12_com.h`, asserted in `runtime/test/d3d12_vulkan_device_test.cpp`), replaced the single-thread `cs_atomic_swap_x2_int64.asm` fixture with a 64-thread tearing check, and added dedicated `--int64-atomics` runner pass in `scripts/run_gpu_tests.py`. ### Tested On commit `14eaf6052`: - `python -I tests/semantic/regen_fixtures.py --check` (`OK`) - `python -I tests/semantic/test_atomic_swap_x2_int64.py` (`6/6 OK` via `spirv_mini_interp.run_workgroup`, 64 threads + 14 `= OpAtomicExchange %ulong`) - `tests/semantic/test_fixtures.py` & `tests/semantic/test_regen_fixtures.py` (`OK`) - All 12 `tests/test_docs_*.py` (`OK`) - `compileall` (`OK`) - MSVC `/W4` compile-check of `runtime/shims/d3d12_vulkan_device.cpp` & `runtime/test/d3d12_vulkan_device_test.cpp` (`OK`) - Note: live RDNA2/Vulkan hardware execution of the 64-thread tearing fixture not available locally. GPUs tested: n/a AI-assisted: yes ### 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.
Mouad-Scriptz-0 commented 2026-11-24 03:00:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Mouad-Scriptz-0 on 2026-11-24T03:00:54Z.


I tested this on a GPU. The 64-bit path works, and it fixes a real tearing problem. Some suggestions to help it land are at the end.

Hardware: Intel Meteor Lake graphics (ANV, Mesa 26.2.7, Fedora 45, shaderBufferInt64Atomics = true). I used vk_compute_test from main 84347bbb6 and this branch at 06de9fea0.

1. Single thread, exact. This is a temporary variant of cs_global_mem_ext (one thread) that does global_atomic_swap_x2 … glc and buffer_atomic_swap_x2 … offen glc, then reads back the old values and the memory. main, this PR without the flag and this PR with LEONIDA_INT64_ATOMICS=1 all give the expected 0xF 0xF00000 0xAAAA0001 0xBBBB0002 0x12345678 0x9ABCDEF0 0xCCCC0003 0xDDDD0004. With the flag, spirv-dis shows OpAtomicExchange %ulong twice and OpCapability Int64Atomics, and the module passes spirv-val.

2. Contention. Here 40 groups × 64 threads each swap {x, ~x} (with x unique per thread) into the same 8 bytes using buffer_atomic_swap_x2 glc. A returned old pair is counted as torn when hi != ~lo; the 0xEEEEEEEE fill is excluded. Results over 8 runs of 2560 threads each:

translator torn old pairs per run
main 2455–2494 (~96%)
this PR, default (flag off) 2455–2490
this PR, LEONIDA_INT64_ATOMICS=1 0, 8 of 8 runs

On RDNA2 these instructions are single 64-bit atomics, so the returned old value never tears. Two 32-bit atomics per element (what main emits) tear almost every time under contention. With the flag on, this PR gets that right.

The contention fixture (hand-written, no game data). It replaces cs_global_mem_ext.asm to reuse its FSSM header and run line: vk_compute_test <spv> 40 dump
; out[0] - 0xEEEEEEEE = torn count, out[1] - 0xEEEEEEEE = threads that ran (2560), out[2..3] = final pair
v_lshl_add_u32 v1, s4, 6, v0
v_add_nc_u32_e32 v1, 1, v1
v_not_b32_e32 v2, v1
v_mov_b32_e32 v3, 8
buffer_atomic_swap_x2 v[1:2], v3, s[0:3], 0 offen glc
s_waitcnt vmcnt(0)
v_not_b32_e32 v4, v1
v_xor_b32_e32 v5, v4, v2
v_xor_b32_e32 v6, v1, v2
v_min_u32_e32 v5, 1, v5
v_min_u32_e32 v6, 1, v6
v_and_b32_e32 v5, v5, v6
v_mov_b32_e32 v7, 0
buffer_atomic_add v5, v7, s[0:3], 0 offen
v_mov_b32_e32 v8, 1
v_mov_b32_e32 v9, 4
buffer_atomic_add v8, v9, s[0:3], 0 offen
s_waitcnt vmcnt(0)
s_endpgm

Suggestions:

  • The fix never runs as wired. --int64-atomics is off by default, and only build.py turns it on, through LEONIDA_INT64_ATOMICS. make_game.py and scripts/run_gpu_tests.py never pass it, so no game shader and no CI or GPU-suite run uses the 64-bit path. One option is to turn it on by default: the module already records shaderBufferInt64Atomics in its metadata, so pipeline creation can refuse it on a device without the feature. The other is to have make_game.py pass it when the device reports the feature.
  • The title doesn't match the diff. It names ds_wrxchg_rtn_b64 (LDS), but the diff changes only global_atomic_swap_x2 and buffer_atomic_swap_x2. Retitling it, for example to "rdna2spirv: 64-bit OpAtomicExchange for global/buffer_atomic_swap_x2 (SHADER-868)", would avoid confusion. Note that ds_wrxchg_rtn_b64 would need shaderSharedInt64Atomics, which this Intel GPU reports as false.
  • Project process. CONTRIBUTING.md and AGENTS.md ask for three things this PR doesn't have yet:
    • a claim in #14 (the commit message says SHADER-868, an ID from the old repository);
    • a row in the docs/design.md contract table saying how the rule was confirmed;
    • a GPU fixture. The contention fixture above could become one, with the stress check in scripts/run_gpu_tests.py.

No game files. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120690010 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/251#issuecomment-7120690010). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-11-24T03:00:54Z. --- I tested this on a GPU. The 64-bit path works, and it fixes a real tearing problem. Some suggestions to help it land are at the end. **Hardware:** Intel Meteor Lake graphics (ANV, Mesa 26.2.7, Fedora 45, `shaderBufferInt64Atomics = true`). I used `vk_compute_test` from `main` `84347bbb6` and this branch at `06de9fea0`. **1. Single thread, exact.** This is a temporary variant of `cs_global_mem_ext` (one thread) that does `global_atomic_swap_x2 … glc` and `buffer_atomic_swap_x2 … offen glc`, then reads back the old values and the memory. `main`, this PR without the flag and this PR with `LEONIDA_INT64_ATOMICS=1` all give the expected `0xF 0xF00000 0xAAAA0001 0xBBBB0002 0x12345678 0x9ABCDEF0 0xCCCC0003 0xDDDD0004`. With the flag, `spirv-dis` shows `OpAtomicExchange %ulong` twice and `OpCapability Int64Atomics`, and the module passes `spirv-val`. **2. Contention.** Here 40 groups × 64 threads each swap `{x, ~x}` (with `x` unique per thread) into the same 8 bytes using `buffer_atomic_swap_x2 glc`. A returned old pair is counted as torn when `hi != ~lo`; the `0xEEEEEEEE` fill is excluded. Results over 8 runs of 2560 threads each: | translator | torn old pairs per run | |---|---| | `main` | 2455–2494 (~96%) | | this PR, default (flag off) | 2455–2490 | | this PR, `LEONIDA_INT64_ATOMICS=1` | **0, 8 of 8 runs** | On RDNA2 these instructions are single 64-bit atomics, so the returned old value never tears. Two 32-bit atomics per element (what `main` emits) tear almost every time under contention. With the flag on, this PR gets that right. <details><summary>The contention fixture (hand-written, no game data). It replaces <code>cs_global_mem_ext.asm</code> to reuse its FSSM header and run line: <code>vk_compute_test &lt;spv&gt; 40 dump</code></summary> ```asm ; out[0] - 0xEEEEEEEE = torn count, out[1] - 0xEEEEEEEE = threads that ran (2560), out[2..3] = final pair v_lshl_add_u32 v1, s4, 6, v0 v_add_nc_u32_e32 v1, 1, v1 v_not_b32_e32 v2, v1 v_mov_b32_e32 v3, 8 buffer_atomic_swap_x2 v[1:2], v3, s[0:3], 0 offen glc s_waitcnt vmcnt(0) v_not_b32_e32 v4, v1 v_xor_b32_e32 v5, v4, v2 v_xor_b32_e32 v6, v1, v2 v_min_u32_e32 v5, 1, v5 v_min_u32_e32 v6, 1, v6 v_and_b32_e32 v5, v5, v6 v_mov_b32_e32 v7, 0 buffer_atomic_add v5, v7, s[0:3], 0 offen v_mov_b32_e32 v8, 1 v_mov_b32_e32 v9, 4 buffer_atomic_add v8, v9, s[0:3], 0 offen s_waitcnt vmcnt(0) s_endpgm ``` </details> **Suggestions:** - **The fix never runs as wired.** `--int64-atomics` is off by default, and only `build.py` turns it on, through `LEONIDA_INT64_ATOMICS`. `make_game.py` and `scripts/run_gpu_tests.py` never pass it, so no game shader and no CI or GPU-suite run uses the 64-bit path. One option is to turn it on by default: the module already records `shaderBufferInt64Atomics` in its metadata, so pipeline creation can refuse it on a device without the feature. The other is to have `make_game.py` pass it when the device reports the feature. - **The title doesn't match the diff.** It names `ds_wrxchg_rtn_b64` (LDS), but the diff changes only `global_atomic_swap_x2` and `buffer_atomic_swap_x2`. Retitling it, for example to "rdna2spirv: 64-bit OpAtomicExchange for global/buffer_atomic_swap_x2 (SHADER-868)", would avoid confusion. Note that `ds_wrxchg_rtn_b64` would need `shaderSharedInt64Atomics`, which this Intel GPU reports as `false`. - **Project process.** [CONTRIBUTING.md](https://github.com/ubiquitarianism/leonida/blob/main/CONTRIBUTING.md) and [AGENTS.md](https://github.com/ubiquitarianism/leonida/blob/main/AGENTS.md) ask for three things this PR doesn't have yet: - a claim in #14 (the commit message says SHADER-868, an ID from the old repository); - a row in the `docs/design.md` contract table saying how the rule was confirmed; - a GPU fixture. The contention fixture above could become one, with the stress check in `scripts/run_gpu_tests.py`. No game files. AI-assisted (Claude Code).
ubiquitarianism commented 2026-11-24 03:14:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ubiquitarianism on 2026-11-24T03:14:41Z.


Not merging yet. This adds an opt-in feature rather than fixing a bug, and ds_wrxchg_rtn_b64 isn't touched. Please:

  • retitle it;
  • update the buffer_atomic_{and,or,xor,swap}_x2 row in docs/design.md, which currently calls the dword-wise tearing an accepted approximation;
  • add a GPU fixture under runtime/test/shaders, built with LEONIDA_INT64_ATOMICS=1, and say which device and driver ran it;
  • pass the flag through make_game.py; today only build.py reads it.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7120907058 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/251#issuecomment-7120907058). Originally posted by [ubiquitarianism](https://github.com/ubiquitarianism) on 2026-11-24T03:14:41Z. --- Not merging yet. This adds an opt-in feature rather than fixing a bug, and `ds_wrxchg_rtn_b64` isn't touched. Please: - retitle it; - update the `buffer_atomic_{and,or,xor,swap}_x2` row in `docs/design.md`, which currently calls the dword-wise tearing an accepted approximation; - add a GPU fixture under `runtime/test/shaders`, built with `LEONIDA_INT64_ATOMICS=1`, and say which device and driver ran it; - pass the flag through `make_game.py`; today only `build.py` reads it.
Sangonapou commented 2026-11-24 05:06:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Sangonapou on 2026-11-24T05:06:09Z.


Tested a48dc6e7 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, regression check

Runtime built at this head with scripts\build_runtime.ps1 (MSVC 19.51, VS Build Tools 2026); llvm-mc 23.1.6 (conda-forge), SPIRV-Tools 2026.4, Vulkan SDK 1.4.363.0. No game files. This PR adds no GPU fixture, so this checks the translator change on the GPU suite.

  • Full run_gpu_tests.py: 257 shaders, 257 translated, 257 pass spirv-val; native 197/248 passed, 49 skipped; LEONIDA_W64_EMULATE=1 229/248 passed, 17 skipped, the same counts as main ece4ba5b. The only failures, cs_imgload_tfe and cs_imgload_d16_tfe, fail identically on main ece4ba5b on this card (main: native 197/248, emulated 229/248), the same pair as #31 / #336.
  • CPU: tests/semantic/test_atomic_swap_x2_int64.py 4 OK.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7122625016 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/251#issuecomment-7122625016). Originally posted by [Sangonapou](https://github.com/Sangonapou) on 2026-11-24T05:06:09Z. --- Tested a48dc6e7 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, regression check Runtime built at this head with `scripts\build_runtime.ps1` (MSVC 19.51, VS Build Tools 2026); `llvm-mc` 23.1.6 (conda-forge), SPIRV-Tools 2026.4, Vulkan SDK 1.4.363.0. No game files. This PR adds no GPU fixture, so this checks the translator change on the GPU suite. - Full `run_gpu_tests.py`: 257 shaders, 257 translated, 257 pass spirv-val; native 197/248 passed, 49 skipped; `LEONIDA_W64_EMULATE=1` 229/248 passed, 17 skipped, the same counts as `main` `ece4ba5b`. The only failures, `cs_imgload_tfe` and `cs_imgload_d16_tfe`, fail identically on `main` `ece4ba5b` on this card (main: native 197/248, emulated 229/248), the same pair as #31 / #336. - CPU: `tests/semantic/test_atomic_swap_x2_int64.py` 4 OK.
kotekompotek commented 2026-11-24 15:35:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T15:35:31Z.


Updated per feedback and rebased cleanly onto current main as a single commit (8435a8069):

  1. Retitled to reflect opt-in --int64-atomics on buffer_atomic_swap_x2 / global_atomic_swap_x2 (ds_wrxchg_rtn_b64 untouched).
  2. Updated the Global atomics and buffer_atomic_{and,or,xor,swap}_x2 rows in docs/design.md.
  3. Added runtime/test/shaders/cs_atomic_swap_x2_int64.asm (wired into build.py via LEONIDA_INT64_ATOMICS=1, check.py, run_gpu_tests.py, and tests/semantic/regen_fixtures.py). Note: llvm-mc/spirv-as are not installed locally, so physical GPU execution could not be run on this host; CPU verification via spirv_mini_interp and all translator/doc/CI tests pass.
  4. Forwarded --int64-atomics through make_game.py (FALLBACK_FLAGS and CLI parser, tested in test_atomic_swap_x2_int64.py and test_docs_cli_flags.py).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7136284722 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/251#issuecomment-7136284722). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-24T15:35:31Z. --- Updated per feedback and rebased cleanly onto current `main` as a single commit (`8435a8069`): 1. Retitled to reflect opt-in `--int64-atomics` on `buffer_atomic_swap_x2` / `global_atomic_swap_x2` (`ds_wrxchg_rtn_b64` untouched). 2. Updated the `Global atomics` and `buffer_atomic_{and,or,xor,swap}_x2` rows in `docs/design.md`. 3. Added `runtime/test/shaders/cs_atomic_swap_x2_int64.asm` (wired into `build.py` via `LEONIDA_INT64_ATOMICS=1`, `check.py`, `run_gpu_tests.py`, and `tests/semantic/regen_fixtures.py`). Note: `llvm-mc`/`spirv-as` are not installed locally, so physical GPU execution could not be run on this host; CPU verification via `spirv_mini_interp` and all translator/doc/CI tests pass. 4. Forwarded `--int64-atomics` through `make_game.py` (`FALLBACK_FLAGS` and CLI parser, tested in `test_atomic_swap_x2_int64.py` and `test_docs_cli_flags.py`).
aslan2142 commented 2026-11-24 16:05:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T16:05:56Z.


I ran 8435a8069 merged onto main a28927849 on two AMD GPUs, Mesa 26.3.1 RADV on Linux, with the validation layer on. Both report shaderBufferInt64Atomics = true:

  • AMD Ryzen 9 7950X3D iGPU (RDNA2, gfx1036);
  • AMD Radeon RX 7900 XTX (RDNA3).

The 64-bit path does fix tearing. I used Mouad-Scriptz-0's contention test: 2,560 threads swapping {x, ~x} into one element with glc, 8 runs.

GPU default, buffer / global --int64-atomics, buffer / global
7950X3D iGPU 8 / 8 torn per run 0 / 0
RX 7900 XTX 235–423 / 303–436 torn per run 0 / 0

No regressions.

  • Full run_gpu_tests.py: main 231/249, this PR 232/250 (+ the new fixture) on both GPUs.
  • Semantic suite: 0 failed.
  • A 2,000-shader corpus slice is byte-identical with and without the flag. No game shader uses *_atomic_swap_x2.

Still open from Mouad-Scriptz-0's review: the claim in #14, run_gpu_tests.py passing the flag, and a multi-thread fixture. The new fixture passes with and without the flag here, because a single thread can't tear.

Two more points:

  • The game runtime doesn't enable shaderBufferInt64Atomics on its device (runtime/shims/d3d12_vulkan_device.cpp:9565-9593). make_game.py --int64-atomics output would use a feature the device wasn't created with.
  • docs/design.md:289 and :497 still end with "Not GPU-verified", and the Global atomics row keeps the old unconditional tearing sentence. The docstrings at tools/rdna2spirv.py:3011 and :3156 describe the old behaviour.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7137114728 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/251#issuecomment-7137114728). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T16:05:56Z. --- I ran `8435a8069` merged onto `main` `a28927849` on two AMD GPUs, Mesa 26.3.1 RADV on Linux, with the validation layer on. Both report `shaderBufferInt64Atomics = true`: - AMD Ryzen 9 7950X3D iGPU (RDNA2, gfx1036); - AMD Radeon RX 7900 XTX (RDNA3). **The 64-bit path does fix tearing.** I used Mouad-Scriptz-0's contention test: 2,560 threads swapping `{x, ~x}` into one element with `glc`, 8 runs. | GPU | default, buffer / global | `--int64-atomics`, buffer / global | |---|---|---| | 7950X3D iGPU | 8 / 8 torn per run | 0 / 0 | | RX 7900 XTX | 235–423 / 303–436 torn per run | 0 / 0 | **No regressions.** - Full `run_gpu_tests.py`: `main` 231/249, this PR 232/250 (+ the new fixture) on both GPUs. - Semantic suite: 0 failed. - A 2,000-shader corpus slice is byte-identical with and without the flag. No game shader uses `*_atomic_swap_x2`. **Still open from Mouad-Scriptz-0's review:** the claim in #14, `run_gpu_tests.py` passing the flag, and a multi-thread fixture. The new fixture passes with and without the flag here, because a single thread can't tear. **Two more points:** - The game runtime doesn't enable `shaderBufferInt64Atomics` on its device (`runtime/shims/d3d12_vulkan_device.cpp:9565-9593`). `make_game.py --int64-atomics` output would use a feature the device wasn't created with. - `docs/design.md:289` and `:497` still end with "Not GPU-verified", and the Global atomics row keeps the old unconditional tearing sentence. The docstrings at `tools/rdna2spirv.py:3011` and `:3156` describe the old behaviour. AI-assisted (Claude Code, Claude Opus 5.5).
kotekompotek commented 2026-11-24 18:31:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-24T18:31:24Z.


@aslan2142 @Mouad-Scriptz-0 Updated in commit 14eaf6052:

  1. Enabled shaderBufferInt64Atomics on VkPhysicalDeviceVulkan12Features in runtime/shims/d3d12_vulkan_device.cpp, recorded shader_buffer_int64_atomics in runtime/shims/d3d12_com.h, and asserted it in runtime/test/d3d12_vulkan_device_test.cpp.
  2. Replaced the single-thread cs_atomic_swap_x2_int64.asm fixture (and regenerated .s via regen_fixtures.py) with a 64-thread (2 wave32 waves, 4 rounds = 256 buffer_atomic_swap_x2 + 256 global_atomic_swap_x2 via s_barrier and Device-scope atomics) tearing check (EXPECTED_FIXTURE = [0, 0, 256, 256, 1, 1, 0xDEAD0001, 0x9ABCDEF0]).
  3. Updated runtime/test/shaders/build.py, runtime/test/shaders/check.py, scripts/run_gpu_tests.py (int64_atomics() helper + dedicated --int64-atomics pass merging its index.json entry without clobbering 32-bit defaults), tests/semantic/test_atomic_swap_x2_int64.py, tools/rdna2spirv.py docstrings, and docs/design.md.
  4. Verified locally on 14eaf6052: regen_fixtures.py --check OK, test_atomic_swap_x2_int64.py (6/6 OK), test_fixtures.py & test_regen_fixtures.py OK, all 12 test_docs_*.py OK, compileall OK, MSVC /W4 compile-check of d3d12_vulkan_device.cpp & d3d12_vulkan_device_test.cpp OK. (llvm-mc, CTest Vulkan run, and RDNA2 hardware are not present on this Windows GTX 1050 host, so CI / hardware GPU run on the updated fixture is pending.)
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7140762506 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/251#issuecomment-7140762506). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-24T18:31:24Z. --- @aslan2142 @Mouad-Scriptz-0 Updated in commit `14eaf6052`: 1) Enabled `shaderBufferInt64Atomics` on `VkPhysicalDeviceVulkan12Features` in `runtime/shims/d3d12_vulkan_device.cpp`, recorded `shader_buffer_int64_atomics` in `runtime/shims/d3d12_com.h`, and asserted it in `runtime/test/d3d12_vulkan_device_test.cpp`. 2) Replaced the single-thread `cs_atomic_swap_x2_int64.asm` fixture (and regenerated `.s` via `regen_fixtures.py`) with a 64-thread (2 wave32 waves, 4 rounds = 256 `buffer_atomic_swap_x2` + 256 `global_atomic_swap_x2` via `s_barrier` and Device-scope atomics) tearing check (`EXPECTED_FIXTURE = [0, 0, 256, 256, 1, 1, 0xDEAD0001, 0x9ABCDEF0]`). 3) Updated `runtime/test/shaders/build.py`, `runtime/test/shaders/check.py`, `scripts/run_gpu_tests.py` (`int64_atomics()` helper + dedicated `--int64-atomics` pass merging its `index.json` entry without clobbering 32-bit defaults), `tests/semantic/test_atomic_swap_x2_int64.py`, `tools/rdna2spirv.py` docstrings, and `docs/design.md`. 4) Verified locally on `14eaf6052`: `regen_fixtures.py --check` OK, `test_atomic_swap_x2_int64.py` (6/6 OK), `test_fixtures.py` & `test_regen_fixtures.py` OK, all 12 `test_docs_*.py` OK, `compileall` OK, MSVC `/W4` compile-check of `d3d12_vulkan_device.cpp` & `d3d12_vulkan_device_test.cpp` OK. (`llvm-mc`, CTest Vulkan run, and RDNA2 hardware are not present on this Windows GTX 1050 host, so CI / hardware GPU run on the updated fixture is pending.)
kotekompotek commented 2026-11-25 07:44:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kotekompotek on 2026-11-25T07:44:58Z.


Rebased on current ubi/main (3f81d46ac) and pushed. Conflicts resolved against the newer main changes; test suite for the touched area passes locally (xs_proxy_mock_test PASS on Windows; the int64-atomics semantic tests 6/6 and test_rdna2_decode 21/21 where applicable).

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7156208558 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/251#issuecomment-7156208558). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T07:44:58Z. --- Rebased on current ubi/main (3f81d46ac) and pushed. Conflicts resolved against the newer main changes; test suite for the touched area passes locally (xs_proxy_mock_test PASS on Windows; the int64-atomics semantic tests 6/6 and test_rdna2_decode 21/21 where applicable). AI-assisted: yes
MoonEyes commented 2026-11-28 17:58:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T17:58:37Z.


Hi @kotekompotek, thanks for this pull request. It currently conflicts with main (conflicting file(s): make_game.py, runtime/test/shaders/build.py, tools/rdna2spirv.py), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243432272 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/251#issuecomment-7243432272). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T17:58:37Z. --- Hi @kotekompotek, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `make_game.py`, `runtime/test/shaders/build.py`, `tools/rdna2spirv.py`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 11:52:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:52:37Z.

Review: CHANGES_REQUESTED


Keeping #251 over closed competing variant #865 for SHADER-868: the opt-in --int64-atomics design preserves default 2x32-bit portability on devices without shaderBufferInt64Atomics, records "Int64Atomics": "shaderBufferInt64Atomics" in shader_meta(), enables shaderBufferInt64Atomics on the Vulkan device (runtime/shims/d3d12_vulkan_device.cpp), and adds the 64-thread contention tearing fixture (cs_atomic_swap_x2_int64.asm, verified 0 torn swaps on RDNA2 and RDNA3).

Please rebase onto current main (preserving main's self.host_addr(..., 'rmw', 8) and guard_zero handling in global_atomic_x2 / buffer_atomic_x2) so CI can run cleanly.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130705818 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/251#pullrequestreview-6130705818). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:52:37Z. **Review:** CHANGES_REQUESTED --- Keeping **#251** over closed competing variant **#865** for `SHADER-868`: the opt-in `--int64-atomics` design preserves default 2x32-bit portability on devices without `shaderBufferInt64Atomics`, records `"Int64Atomics": "shaderBufferInt64Atomics"` in `shader_meta()`, enables `shaderBufferInt64Atomics` on the Vulkan device (`runtime/shims/d3d12_vulkan_device.cpp`), and adds the 64-thread contention tearing fixture (`cs_atomic_swap_x2_int64.asm`, verified 0 torn swaps on RDNA2 and RDNA3). Please rebase onto current `main` (preserving `main`'s `self.host_addr(..., 'rmw', 8)` and `guard_zero` handling in `global_atomic_x2` / `buffer_atomic_x2`) so CI can run cleanly. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:20:35 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:20:35Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319146234 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/251#issuecomment-7319146234). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:20:35Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!251
No description provided.