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

Open
github-bot wants to merge 2 commits from github-bot/gh-1289 into main AGit
Owner

@⁠ambroseautomation on GitHub · 2026-11-24 21:18 UTC · original
ambroseautomation:carry/old-9790-flat-mem → main · +214 −3 · 4 files · 2 commits · open

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

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.
**@⁠ambroseautomation** on GitHub · 2026-11-24 21:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1289) `ambroseautomation:carry/old-9790-flat-mem` → `main` · +214 −3 · 4 files · 2 commits · open Claimed in the coordination issue as: OLD-9790 (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### 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.
flat_load_* / flat_store_* with a 64-bit VGPR address emit the global_*
code with `off` (Gen.global_mem / Gen.global_sub). An address outside the
LDS and private apertures is a global access on RDNA2; the aperture bases
(src_shared_base / src_private_base) are refused, so no translated program
builds an aperture address from them. A non-zero instruction offset, the
FLAT atomics and a 32-bit address stay Unsupported. The first-read analysis
counts a FLAT d16 load's vdst, the interp copy analysis and ab_control_flow
treat flat_store like global_store.

CPU-checked by tests/semantic/test_flat_mem.py; contract row in
docs/design.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review on #8823 (wavehs): NEEDS listed flat_store but not flat_atomic, which
writes memory as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:46:12 +00:00
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/1289/head:github-bot/gh-1289'
git switch 'github-bot/gh-1289'

Merge

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