[PR #1289] rdna2spirv: translate FLAT loads and stores as global accesses (OLD-9790) #1321

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

📋 Pull Request Information

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

Base: main ← Head: carry/old-9790-flat-mem


📝 Commits (2)

  • 5199039 rdna2spirv: translate FLAT loads and stores as global accesses
  • 6cf4f2a ab_control_flow: leave flat_atomic out of the A/B sweep too

📊 Changes

4 files changed (+214 additions, -3 deletions)

View changed files

📝 docs/design.md (+1 -0)
➕ tests/semantic/test_flat_mem.py (+168 -0)
📝 tools/ab_control_flow.py (+1 -1)
📝 tools/rdna2spirv.py (+44 -2)

📄 Description

Claimed in the coordination issue as: OLD-9790 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144505947)

What and why

Carries forward old-pr/9790 (draft #65, original commit author tiagonogueiraa-bit preserved across both commits; indexed in #17), rebased cleanly onto current main.

Implements flat_load_* and flat_store_* with 64-bit VGPR addresses in tools/rdna2spirv.py as global memory accesses:

  • Lowers flat_load_* / flat_store_* with a 64-bit VGPR address through the existing Gen.global_mem / Gen.global_sub paths (with off scalar base), while keeping non-zero instruction offsets, FLAT atomics, 32-bit addresses, and aperture base operands (src_shared_base / src_private_base) refused with Unsupported.
  • Updates first-read / liveness analysis (flat_load_* d16 reads vdst, flat_store_* treated like global_store_*) and updates tools/ab_control_flow.py (NEEDS includes flat_store and flat_atomic).
  • Adds tests/semantic/test_flat_mem.py (12 tests covering dword/sub-dword/d16 loads and stores, high address dword, EXEC masking, liveness, and refused forms) and adds the contract row in docs/design.md.

Tested

  • python -m unittest discover -s tests/semantic -p test_flat_mem.py -v: 12 tests, OK.
  • python -I tests/test_docs_links.py: 16 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 472 files, 6,189 tests, 0 files failed.
  • python -I scripts/check_no_game_data.py docs/design.md tools/rdna2spirv.py tools/ab_control_flow.py tests/semantic/test_flat_mem.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.

🔄 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/1289 **Author:** [@ambroseautomation](https://github.com/ambroseautomation) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-9790-flat-mem` --- ### 📝 Commits (2) - [`5199039`](https://github.com/ubiquitarianism/leonida/commit/5199039af63aa83fb5c2be116722ad3602672831) rdna2spirv: translate FLAT loads and stores as global accesses - [`6cf4f2a`](https://github.com/ubiquitarianism/leonida/commit/6cf4f2aabb0788ea0714a86bc2a9eb1c181d7d47) ab_control_flow: leave flat_atomic out of the A/B sweep too ### 📊 Changes **4 files changed** (+214 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) ➕ `tests/semantic/test_flat_mem.py` (+168 -0) 📝 `tools/ab_control_flow.py` (+1 -1) 📝 `tools/rdna2spirv.py` (+44 -2) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9790 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144505947) ### What and why Carries forward `old-pr/9790` (draft #65, original commit author `tiagonogueiraa-bit` preserved across both commits; indexed in #17), rebased cleanly onto current `main`. Implements `flat_load_*` and `flat_store_*` with 64-bit VGPR addresses in `tools/rdna2spirv.py` as global memory accesses: - Lowers `flat_load_*` / `flat_store_*` with a 64-bit VGPR address through the existing `Gen.global_mem` / `Gen.global_sub` paths (with `off` scalar base), while keeping non-zero instruction offsets, FLAT atomics, 32-bit addresses, and aperture base operands (`src_shared_base` / `src_private_base`) refused with `Unsupported`. - Updates first-read / liveness analysis (`flat_load_*` d16 reads `vdst`, `flat_store_*` treated like `global_store_*`) and updates `tools/ab_control_flow.py` (`NEEDS` includes `flat_store` and `flat_atomic`). - Adds `tests/semantic/test_flat_mem.py` (12 tests covering dword/sub-dword/d16 loads and stores, high address dword, EXEC masking, liveness, and refused forms) and adds the contract row in `docs/design.md`. ### Tested - `python -m unittest discover -s tests/semantic -p test_flat_mem.py -v`: 12 tests, OK. - `python -I tests/test_docs_links.py`: 16 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 472 files, 6,189 tests, 0 files failed. - `python -I scripts/check_no_game_data.py docs/design.md tools/rdna2spirv.py tools/ab_control_flow.py tests/semantic/test_flat_mem.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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <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#1321
No description provided.