tests: GPU fixture cs_w32_atomic_contend for buffer_atomic_inc/dec contention (OLD-9912) #868

Closed
TanmaySatyam wants to merge 3 commits from upstream-pr/868 into main
TanmaySatyam commented 2026-11-24 14:50:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TanmaySatyam on 2026-11-24T14:50:29Z.


Claimed in the coordination issue as: OLD-9912

Summary

Carries forward old-pr/9912 (carried-over draft #178) onto current main (f3e26be7c), preserving the original author's (Luiz Neves) three commits:

  • GPU test cs_w32_atomic_contend: buffer_atomic_inc/dec under contention
  • test_atomic_contend_fixture: runs under python -I
  • cs_w32_atomic_contend: word 2 uses D = 19, so an inc and a dec can't give the same word

Rebase adjustments

  • Resolved append-list conflicts in runtime/test/shaders/check.py and scripts/run_gpu_tests.py against current main.
  • Kept main's dynamic tests/semantic/regen_fixtures.py and added the ; regen_fixtures: this source has a translator fixture in tests/semantic/fixtures/disasm marker line to runtime/test/shaders/cs_w32_atomic_contend.asm.

Testing & Hardware Verification

  • AI-assisted: yes (rebase, conflict resolution, and test execution).
  • Synthetic fixtures only: no game data used (python -I scripts/check_no_game_data.py clean on all touched files).
  • GPU & Driver: NVIDIA GeForce RTX 5070, Driver 591.74, Windows 11 (LEONIDA_VK_VALIDATION=1, VKC_SUBGROUP_SIZE=32).
  • Live GPU run (runtime/test/shaders/build.py + vk_compute_test.exe cs_w32_atomic_contend.spv 1 dump):
    1 shaders: 1 translated, 1 pass spirv-val
    device: NVIDIA GeForce RTX 5070 (subgroup 32..32) (validation on)
    compute subgroup size: 32
    1 groups x 64: 0 mismatches
    out[0..7] = 4008636174 4008636141 11 4008636110 4 4008636173 4008636111 4008636141
    
    Matches expected [0xEEEEEF0E, 0xEEEEEEED, 0xB, 0xEEEEEECE, 0x4, 0xEEEEEF0D, 0xEEEEEECF, 0xEEEEEEED] under real 32-lane hardware CAS contention with 0 mismatches and 0 Vulkan validation errors.
  • CPU / unit tests:
    • python -I tests/semantic/test_atomic_contend_fixture.py -v: 4/4 OK
    • python -I tests/test_regen_fixtures.py: 7/7 OK
    • python -I tests/test_text_write_line_endings.py: 3/3 OK
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474478509 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/868). Originally posted by [TanmaySatyam](https://github.com/TanmaySatyam) on 2026-11-24T14:50:29Z. --- Claimed in the coordination issue as: OLD-9912 ### Summary Carries forward `old-pr/9912` (carried-over draft #178) onto current `main` (`f3e26be7c`), preserving the original author's (`Luiz Neves`) three commits: - `GPU test cs_w32_atomic_contend: buffer_atomic_inc/dec under contention` - `test_atomic_contend_fixture: runs under python -I` - `cs_w32_atomic_contend: word 2 uses D = 19, so an inc and a dec can't give the same word` ### Rebase adjustments - Resolved append-list conflicts in `runtime/test/shaders/check.py` and `scripts/run_gpu_tests.py` against current `main`. - Kept `main`'s dynamic `tests/semantic/regen_fixtures.py` and added the `; regen_fixtures: this source has a translator fixture in tests/semantic/fixtures/disasm` marker line to `runtime/test/shaders/cs_w32_atomic_contend.asm`. ### Testing & Hardware Verification - **AI-assisted:** yes (rebase, conflict resolution, and test execution). - **Synthetic fixtures only:** no game data used (`python -I scripts/check_no_game_data.py` clean on all touched files). - **GPU & Driver:** NVIDIA GeForce RTX 5070, Driver 591.74, Windows 11 (`LEONIDA_VK_VALIDATION=1`, `VKC_SUBGROUP_SIZE=32`). - **Live GPU run (`runtime/test/shaders/build.py` + `vk_compute_test.exe cs_w32_atomic_contend.spv 1 dump`):** ```text 1 shaders: 1 translated, 1 pass spirv-val device: NVIDIA GeForce RTX 5070 (subgroup 32..32) (validation on) compute subgroup size: 32 1 groups x 64: 0 mismatches out[0..7] = 4008636174 4008636141 11 4008636110 4 4008636173 4008636111 4008636141 ``` Matches expected `[0xEEEEEF0E, 0xEEEEEEED, 0xB, 0xEEEEEECE, 0x4, 0xEEEEEF0D, 0xEEEEEECF, 0xEEEEEEED]` under real 32-lane hardware CAS contention with 0 mismatches and 0 Vulkan validation errors. - **CPU / unit tests:** - `python -I tests/semantic/test_atomic_contend_fixture.py -v`: 4/4 OK - `python -I tests/test_regen_fixtures.py`: 7/7 OK - `python -I tests/test_text_write_line_endings.py`: 3/3 OK
abnalstlll-byte commented 2026-11-24 14:52:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:52:37Z.

Review: APPROVED


Audited and verified. Adds synthetic GPU test fixture cs_w32_atomic_contend.asm and companion software unit test ests/semantic/test_atomic_contend_fixture.py testing uffer_atomic_inc/dec compare-exchange loops under 32-lane hardware contention with power-of-two checksum validation for lost updates. Clean-room compliant with zero game data. Approved.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041534732 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/868#pullrequestreview-6041534732). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:52:37Z. **Review:** APPROVED --- Audited and verified. Adds synthetic GPU test fixture cs_w32_atomic_contend.asm and companion software unit test ests/semantic/test_atomic_contend_fixture.py testing uffer_atomic_inc/dec compare-exchange loops under 32-lane hardware contention with power-of-two checksum validation for lost updates. Clean-room compliant with zero game data. Approved.
abnalstlll-byte commented 2026-11-24 14:53:56 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:53:56Z.

Review: APPROVED


Clean-Room Audit & Shader Verification — PR #868 (OLD-9912)

High-concurrency atomic contention validation.

Technical Verification

  1. Contention Loops:
    • Tests buffer_atomic_inc and buffer_atomic_dec with all 32 lanes contending on a single buffer offset, verifying that CAS loops guarantee zero lost updates.
    • Verified clean-room synthetic assembly.

Verdict: APPROVED

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041558806 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/868#pullrequestreview-6041558806). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:53:56Z. **Review:** APPROVED --- ### Clean-Room Audit & Shader Verification — PR #868 (`OLD-9912`) High-concurrency atomic contention validation. #### Technical Verification 1. **Contention Loops**: - Tests `buffer_atomic_inc` and `buffer_atomic_dec` with all 32 lanes contending on a single buffer offset, verifying that CAS loops guarantee zero lost updates. - Verified clean-room synthetic assembly. **Verdict: APPROVED**
Sangonapou commented 2026-11-24 15:44:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Sangonapou on 2026-11-24T15:44:50Z.


Tested b61decad on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: pass

Built at this head with scripts\build_runtime.ps1 (MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0); llvm-mc 23.1.6, SPIRV-Tools 2026.4. No game files.

run_gpu_tests.py --filter cs_w32_atomic_contend --require-pass: PASS native (subgroup 32) and with LEONIDA_W64_EMULATE=1, 4008636174 4008636141 11 4008636110 4 4008636173 4008636111 4008636141 both times.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7136542582 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/868#issuecomment-7136542582). Originally posted by [Sangonapou](https://github.com/Sangonapou) on 2026-11-24T15:44:50Z. --- Tested b61decad on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: pass Built at this head with `scripts\build_runtime.ps1` (MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0); `llvm-mc` 23.1.6, SPIRV-Tools 2026.4. No game files. `run_gpu_tests.py --filter cs_w32_atomic_contend --require-pass`: PASS native (subgroup 32) and with `LEONIDA_W64_EMULATE=1`, `4008636174 4008636141 11 4008636110 4 4008636173 4008636111 4008636141` both times.
CodingRule commented 2026-11-25 12:20:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by CodingRule on 2026-11-25T12:20:15Z.


GPU test on an NVIDIA Ada card, for the record: this passes on an RTX 4090.

  • Tested: this branch's head 34005bd2 merged onto main 0d80bc5d (clean merge), test programs built from that main with scripts\build_runtime.ps1.
  • Command: python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_atomic_contend, once native and once with LEONIDA_W64_EMULATE=1.
  • Result: 1/1 translated and spirv-val clean, 1/1 passed in both modes, with the expected words/pixels from the fixture header. Nothing skipped.
  • Device: NVIDIA GeForce RTX 4090 (Ada / AD102), driver 591.86, Vulkan 1.4.325, subgroup 32..32, Windows 11 Pro build 26200. llvm-mc 21.1.8 (scripts\build_llvm_mc.ps1), SPIRV-Tools v2026.4, MSVC 14.44.35207.

Only the filtered fixture(s) were run for this PR, not the full suite or ctest; the full-suite baseline for this card on main is in #1777. Synthetic fixtures only, no game files. AI-assisted (Claude Code ran the tests and wrote this comment).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7162237243 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/868#issuecomment-7162237243). Originally posted by [CodingRule](https://github.com/CodingRule) on 2026-11-25T12:20:15Z. --- GPU test on an NVIDIA Ada card, for the record: this passes on an **RTX 4090**. - **Tested:** this branch's head `34005bd2` merged onto `main` `0d80bc5d` (clean merge), test programs built from that `main` with `scripts\build_runtime.ps1`. - **Command:** `python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_atomic_contend`, once native and once with `LEONIDA_W64_EMULATE=1`. - **Result:** 1/1 translated and `spirv-val` clean, 1/1 passed in both modes, with the expected words/pixels from the fixture header. Nothing skipped. - **Device:** NVIDIA GeForce RTX 4090 (Ada / AD102), driver 591.86, Vulkan 1.4.325, subgroup 32..32, Windows 11 Pro build 26200. llvm-mc 21.1.8 (`scripts\build_llvm_mc.ps1`), SPIRV-Tools v2026.4, MSVC 14.44.35207. Only the filtered fixture(s) were run for this PR, not the full suite or ctest; the full-suite baseline for this card on `main` is in #1777. Synthetic fixtures only, no game files. AI-assisted (Claude Code ran the tests and wrote this comment).
MoonEyes commented 2026-11-28 02:58:32 +00:00 (Migrated from github.com)

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


Hi @TanmaySatyam, thanks for this pull request. It currently conflicts with main (conflicting file(s): scripts/run_gpu_tests.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:7232712909 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/868#issuecomment-7232712909). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T02:58:32Z. --- Hi @TanmaySatyam, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `scripts/run_gpu_tests.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:44:36 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Conflicts with main in scripts/run_gpu_tests.py, with failing stale CI. Please rebase onto current main to resolve the conflict and trigger a fresh green CI pass.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130565923 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/868#pullrequestreview-6130565923). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:44:36Z. **Review:** CHANGES_REQUESTED --- Conflicts with `main` in `scripts/run_gpu_tests.py`, with failing stale CI. Please rebase onto current `main` to resolve the conflict and trigger a fresh green CI pass. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 16:32:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:32:29Z.


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:7317776711 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/868#issuecomment-7317776711). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:32:29Z. --- 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!868
No description provided.