rdna2spirv: order image_sample, image_gather4, image_bvh and ignore ds_nop in --wave64-emulate (OLD-10011) #1175

Open
github-bot wants to merge 1 commit from github-bot/gh-1175 into main AGit
Owner

@⁠ambroseautomation on GitHub · 2026-11-24 19:37 UTC · original
ambroseautomation:carry/old-10011-w64x-image-order → main · +79 −4 · 3 files · 1 commits · open

Claimed in the coordination issue as: OLD-10011 (#14)

What and why

Carries forward old-pr/10011 (draft #282, original commit author totonii preserved; indexed in #17), rebased cleanly onto current main.

Fixes memory-ordering coverage under --wave64-emulate in tools/rdna2spirv.py (Gen.x_memory_order) and tools/wave64_emulate_opt.py (_x_memory_order_access):

  • Counts image_sample*, image_gather4*, and image_bvh* as memory reads so RAW/WAR hazards against earlier or later stores in the same wave trigger an ordering round/barrier across emulated halves.
  • Ignores ds_nop alongside ds_swizzle_b32/ds_bpermute_b32/ds_permute_b32 so it is not misclassified as an LDS write.
  • Adds regression tests in tests/semantic/test_w64x_scalar_load_order.py for image_store -> image_sample_lz (RAW), image_sample_lz -> image_store (WAR), and mirror parity between Gen.x_memory_order and wave64_emulate_opt._x_memory_order_access.

Tested

  • python -m unittest discover -s tests/semantic -p test_w64x_scalar_load_order.py -v: 8 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 470 files, 6,171 tests, 0 files failed.
  • python -m compileall -q make_game.py tools tests: exit 0.
  • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tools/wave64_emulate_opt.py tests/semantic/test_w64x_scalar_load_order.py: exit 0 (no game data).

GPUs tested: n/a (CPU SPIR-V interpreter semantic suite on Windows 11 Pro 64-bit, Python 3.12.10)

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. (n/a — --wave64-emulate memory ordering parity)
**@⁠ambroseautomation** on GitHub · 2026-11-24 19:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1175) `ambroseautomation:carry/old-10011-w64x-image-order` → `main` · +79 −4 · 3 files · 1 commits · open Claimed in the coordination issue as: OLD-10011 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Carries forward `old-pr/10011` (draft #282, original commit author `totonii` preserved; indexed in #17), rebased cleanly onto current `main`. Fixes memory-ordering coverage under `--wave64-emulate` in `tools/rdna2spirv.py` (`Gen.x_memory_order`) and `tools/wave64_emulate_opt.py` (`_x_memory_order_access`): - Counts `image_sample*`, `image_gather4*`, and `image_bvh*` as memory reads so RAW/WAR hazards against earlier or later stores in the same wave trigger an ordering round/barrier across emulated halves. - Ignores `ds_nop` alongside `ds_swizzle_b32`/`ds_bpermute_b32`/`ds_permute_b32` so it is not misclassified as an LDS write. - Adds regression tests in `tests/semantic/test_w64x_scalar_load_order.py` for `image_store -> image_sample_lz` (RAW), `image_sample_lz -> image_store` (WAR), and mirror parity between `Gen.x_memory_order` and `wave64_emulate_opt._x_memory_order_access`. ### Tested - `python -m unittest discover -s tests/semantic -p test_w64x_scalar_load_order.py -v`: 8 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 470 files, 6,171 tests, 0 files failed. - `python -m compileall -q make_game.py tools tests`: exit 0. - `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tools/wave64_emulate_opt.py tests/semantic/test_w64x_scalar_load_order.py`: exit 0 (no game data). GPUs tested: n/a (CPU SPIR-V interpreter semantic suite on Windows 11 Pro 64-bit, Python 3.12.10) 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — `--wave64-emulate` memory ordering parity)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:41:25 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:40 UTC · original · approved these changes

Reviewed and verified. Fixes memory hazard tracking under --wave64-emulate in tools/rdna2spirv.py and tools/wave64_emulate_opt.py by classifying image_sample*, image_gather4*, and image_bvh* as memory reads against RAW/WAR store hazards, and properly ignoring ds_nop from LDS writes. Verified via tests/semantic/test_w64x_scalar_load_order.py (8/8 PASS). 100% clean-room.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1175#pullrequestreview-6046114581) · **approved these changes** Reviewed and verified. Fixes memory hazard tracking under `--wave64-emulate` in `tools/rdna2spirv.py` and `tools/wave64_emulate_opt.py` by classifying `image_sample*`, `image_gather4*`, and `image_bvh*` as memory reads against RAW/WAR store hazards, and properly ignoring `ds_nop` from LDS writes. Verified via `tests/semantic/test_w64x_scalar_load_order.py` (8/8 PASS). 100% clean-room.
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:10 UTC · original

Recommendation: [MERGE]

Reasoning: Carries #282: under --wave64-emulate, image_sample*, image_gather4* and image_bvh* count as memory reads for hazard ordering, and ds_nop is ignored. Tiny translator change (+3/-3 in each tool) with a 75-line test. Missing ordering here could produce RAW/WAR races, so it's a worthwhile fix. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 4/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1175#issuecomment-7143138908) **Recommendation:** [MERGE] **Reasoning:** Carries #282: under `--wave64-emulate`, `image_sample*`, `image_gather4*` and `image_bvh*` count as memory reads for hazard ordering, and `ds_nop` is ignored. Tiny translator change (+3/-3 in each tool) with a 75-line test. Missing ordering here could produce RAW/WAR races, so it's a worthwhile fix. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 4/10
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 20:10 UTC · original

Verified 3a6b0ccd7 on Arch Linux (Python 3.14):

  • PYTHONPATH=tests/semantic python3 -m unittest tests/semantic/test_w64x_scalar_load_order.py: 8 tests passed (0.027 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 20:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1175#issuecomment-7143141768) Verified `3a6b0ccd7` on Arch Linux (Python 3.14): - `PYTHONPATH=tests/semantic python3 -m unittest tests/semantic/test_w64x_scalar_load_order.py`: **8 tests passed** (0.027 s) AI-assisted: yes
Author
Owner

@⁠tiguan26 on GitHub · 2026-11-25 18:23 UTC · original · approved these changes

Approving. Merged into current main (b9320a1) with no conflicts. The new test_w64x_scalar_load_order.py passes, the wave64 tests in tests/test_wave64*.py pass (69 tests), and the full translator suite gives 490 files / 6,295 tests with only test_int32_to_f64 failing, the same baseline failure as main here (Linux, Python 3.13).

The same three prefixes (image_sample, image_gather4, image_bvh) are added to both memory-order classifiers, the one in rdna2spirv.py and the one in wave64_emulate_opt.py, so the emulation and its optimiser agree on which instructions are ordered reads.

AI-assisted (Claude).

**@⁠tiguan26** on GitHub · 2026-11-25 18:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1175#pullrequestreview-6062818048) · **approved these changes** Approving. Merged into current main (b9320a1) with no conflicts. The new `test_w64x_scalar_load_order.py` passes, the wave64 tests in `tests/test_wave64*.py` pass (69 tests), and the full translator suite gives 490 files / 6,295 tests with only `test_int32_to_f64` failing, the same baseline failure as main here (Linux, Python 3.13). The same three prefixes (`image_sample`, `image_gather4`, `image_bvh`) are added to both memory-order classifiers, the one in `rdna2spirv.py` and the one in `wave64_emulate_opt.py`, so the emulation and its optimiser agree on which instructions are ordered reads. AI-assisted (Claude).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1175/head:github-bot/gh-1175'
git switch 'github-bot/gh-1175'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1175'
git switch 'github-bot/gh-1175'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1175'
git switch 'github-bot/gh-1175'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1175'
git switch 'main'
git merge --squash 'github-bot/gh-1175'
git switch 'main'
git merge --ff-only 'github-bot/gh-1175'
git switch 'main'
git merge 'github-bot/gh-1175'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.