[PR #282] fix(rdna2spirv): order image_sample, image_gather4, image_bvh and ignore ds_nop in --wave64-emulate #334

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/282
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/10011


📝 Commits (1)

  • 1826e88 fix(rdna2spirv): order image_sample, image_gather4, image_bvh and ignore ds_nop in --wave64-emulate

📊 Changes

3 files changed (+80 additions, -5 deletions)

View changed files

📝 tests/semantic/test_w64x_scalar_load_order.py (+75 -0)
📝 tools/rdna2spirv.py (+4 -4)
📝 tools/wave64_emulate_opt.py (+1 -1)

📄 Description

Carried over from old PR 10011 by totonicpu in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10011, 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.
totonicpu: 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):

Summary

Fixes two memory-ordering gaps in --wave64-emulate (tools/rdna2spirv.py and its mirror tools/wave64_emulate_opt.py):

  1. Order image_sample*, image_gather4*, and image_bvh* as "mem" reads: Both Gen.x_memory_order() (tools/rdna2spirv.py:5717) and _x_memory_order_access() (tools/wave64_emulate_opt.py:777) tracked image_load, image_store, and image_atomic, but omitted image_sample, image_gather4, and image_bvh. Under --wave64-emulate, an image_store/buffer_store followed by image_sample*/image_gather4*/image_bvh* (or vice versa) stayed in the same round without a barrier between the two 32-lane halves.
  2. Sync ds_nop parity: Adds "ds_nop" to Gen.x_memory_order()'s ignore tuple (tools/rdna2spirv.py:5713), matching _x_memory_order_access() (tools/wave64_emulate_opt.py:773) so ds_nop no longer marks LDS read+write dirty.

Testing

  • Fail-first proof: Added RAW (image_store -> image_sample_lz), WAR (image_sample_lz -> image_store), and mirror-parity (image_sample*, image_gather4*, image_bvh*, ds_nop) tests in tests/semantic/test_w64x_scalar_load_order.py. Before the fix, both image_store and image_sample_lz landed in the same round (%blk0) with no separating barrier and _x_memory_order_access("image_sample") returned None.
  • Semantic tests (-W default -W error::ResourceWarning):
    • python -I -W default -W error::ResourceWarning tests/semantic/test_w64x_scalar_load_order.py: 8/8 OK
    • python -I -W default -W error::ResourceWarning tests/semantic/test_wave64_emulate_opt.py: 30/30 OK
  • SPIR-V validation: Assembled and validated both emitted RAW and WAR shaders with spirv-as --target-env vulkan1.2 + spirv-val --target-env vulkan1.2 (0 errors).

🔄 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/282 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/10011` --- ### 📝 Commits (1) - [`1826e88`](https://github.com/ubiquitarianism/leonida/commit/1826e88839fe079d37d107f8efbadb6ddf8d4a38) fix(rdna2spirv): order image_sample, image_gather4, image_bvh and ignore ds_nop in --wave64-emulate ### 📊 Changes **3 files changed** (+80 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_w64x_scalar_load_order.py` (+75 -0) 📝 `tools/rdna2spirv.py` (+4 -4) 📝 `tools/wave64_emulate_opt.py` (+1 -1) </details> ### 📄 Description > Carried over from **old PR 10011** by `totonicpu` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10011`, 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. > `totonicpu`: 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): ## Summary Fixes two memory-ordering gaps in `--wave64-emulate` (`tools/rdna2spirv.py` and its mirror `tools/wave64_emulate_opt.py`): 1. **Order `image_sample*`, `image_gather4*`, and `image_bvh*` as `"mem"` reads:** Both `Gen.x_memory_order()` (`tools/rdna2spirv.py:5717`) and `_x_memory_order_access()` (`tools/wave64_emulate_opt.py:777`) tracked `image_load`, `image_store`, and `image_atomic`, but omitted `image_sample`, `image_gather4`, and `image_bvh`. Under `--wave64-emulate`, an `image_store`/`buffer_store` followed by `image_sample*`/`image_gather4*`/`image_bvh*` (or vice versa) stayed in the same round without a barrier between the two 32-lane halves. 2. **Sync `ds_nop` parity:** Adds `"ds_nop"` to `Gen.x_memory_order()`'s ignore tuple (`tools/rdna2spirv.py:5713`), matching `_x_memory_order_access()` (`tools/wave64_emulate_opt.py:773`) so `ds_nop` no longer marks LDS read+write dirty. ## Testing - **Fail-first proof:** Added RAW (`image_store -> image_sample_lz`), WAR (`image_sample_lz -> image_store`), and mirror-parity (`image_sample*`, `image_gather4*`, `image_bvh*`, `ds_nop`) tests in `tests/semantic/test_w64x_scalar_load_order.py`. Before the fix, both `image_store` and `image_sample_lz` landed in the same round (`%blk0`) with no separating barrier and `_x_memory_order_access("image_sample")` returned `None`. - **Semantic tests (`-W default -W error::ResourceWarning`):** - `python -I -W default -W error::ResourceWarning tests/semantic/test_w64x_scalar_load_order.py`: **8/8 OK** - `python -I -W default -W error::ResourceWarning tests/semantic/test_wave64_emulate_opt.py`: **30/30 OK** - **SPIR-V validation:** Assembled and validated both emitted RAW and WAR shaders with `spirv-as --target-env vulkan1.2` + `spirv-val --target-env vulkan1.2` (0 errors). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#334
No description provided.