[PR #1761] OLD-9996: rdna2spirv: lower wide and strided geometry shader LDS accesses #1774

Open
opened 2026-11-26 21:18:54 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1761
Author: @potatoe0100
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: carry/old-9996


📝 Commits (1)

  • ed94596 fix: lower wide and strided geometry shader LDS accesses

📊 Changes

4 files changed (+138 additions, -18 deletions)

View changed files

📝 docs/design.md (+1 -0)
➕ tests/semantic/fixtures/gs_ds_ring.asm (+30 -0)
➕ tests/test_gs_ds_ring.py (+77 -0)
📝 tools/rdna2spirv.py (+30 -18)

📄 Description

Claimed in the coordination issue as: OLD-9996 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161271395)

What and why

Carries on old PR 9996 by @tedin7 (draft #267, branch old-pr/9996, listed in #17), rebased on current main with the author's commit kept.

The legacy (merged ES/GS) geometry shader path in Gen.gs_ds only knew ds_read_b32/b64/b96/b128, ds_read2_b32, ds_write_b32/b64 and ds_write2_b32. A GS that stages its output with ds_write_b96/ds_write_b128, or walks ES input vertices / output slots with the 64-dword stride forms ds_read2st64_b32/ds_write2st64_b32, raised Unsupported. This adds them: wide writes stage 3 or 4 consecutive output dwords from consecutive VGPRs; st64 offsets count 64-dword units, so on reads one unit advances one synthetic ES input vertex and on writes they address the flat staged output slots. The byte-offset arithmetic for read2/write2 is shared with the compute LDS path through a small lds_pair_byte_offsets helper (no behaviour change there). The rule is added to the contract table in docs/design.md.

Rebase note: one conflict in tools/rdna2spirv.py, where main added ds_append next to the new helper; both are kept unchanged.

Tested

  • python -m pytest tests/test_gs_ds_ring.py: 4 passed (translation + spirv-val of each new form), 1 skipped (the Vulkan readback needs LEONIDA_VK_HARNESS). With main's tools/rdna2spirv.py the same 4 tests fail with Unsupported, so they cover the change.
  • Translator suite python -I scripts/run_semantic_tests.py tests/semantic: 488 files, 6,287 tests; 6,286 pass on this branch and on main alike. The one failure, test_int32_to_f64.test_constant_folded_mrt_words, is the distro spirv-opt (SPIRV-Tools 2025.1) crashing with SIGSEGV, identical on main.
  • llvm-mc 18.1.3 (amdgcn, gfx1030), SPIRV-Tools 2025.1, Python 3.13, Linux. No shader corpus count (no game files here).

GPUs tested: n/a (the test_geometry_lds_rasterization readback is not run yet; a GPU result can follow)

AI-assisted: yes (Claude rebased and tested; the change is tedin7's)

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.

🤖 Generated with Claude Code


🔄 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/1761 **Author:** [@potatoe0100](https://github.com/potatoe0100) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-9996` --- ### 📝 Commits (1) - [`ed94596`](https://github.com/ubiquitarianism/leonida/commit/ed94596196fadac949db27055e554a7c6bb076ad) fix: lower wide and strided geometry shader LDS accesses ### 📊 Changes **4 files changed** (+138 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) ➕ `tests/semantic/fixtures/gs_ds_ring.asm` (+30 -0) ➕ `tests/test_gs_ds_ring.py` (+77 -0) 📝 `tools/rdna2spirv.py` (+30 -18) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9996 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161271395) ### What and why Carries on old PR 9996 by @tedin7 (draft #267, branch `old-pr/9996`, listed in #17), rebased on current `main` with the author's commit kept. The legacy (merged ES/GS) geometry shader path in `Gen.gs_ds` only knew `ds_read_b32/b64/b96/b128`, `ds_read2_b32`, `ds_write_b32/b64` and `ds_write2_b32`. A GS that stages its output with `ds_write_b96`/`ds_write_b128`, or walks ES input vertices / output slots with the 64-dword stride forms `ds_read2st64_b32`/`ds_write2st64_b32`, raised `Unsupported`. This adds them: wide writes stage 3 or 4 consecutive output dwords from consecutive VGPRs; st64 offsets count 64-dword units, so on reads one unit advances one synthetic ES input vertex and on writes they address the flat staged output slots. The byte-offset arithmetic for read2/write2 is shared with the compute LDS path through a small `lds_pair_byte_offsets` helper (no behaviour change there). The rule is added to the contract table in `docs/design.md`. Rebase note: one conflict in `tools/rdna2spirv.py`, where `main` added `ds_append` next to the new helper; both are kept unchanged. ### Tested - `python -m pytest tests/test_gs_ds_ring.py`: 4 passed (translation + spirv-val of each new form), 1 skipped (the Vulkan readback needs `LEONIDA_VK_HARNESS`). With `main`'s `tools/rdna2spirv.py` the same 4 tests fail with `Unsupported`, so they cover the change. - Translator suite `python -I scripts/run_semantic_tests.py tests/semantic`: 488 files, 6,287 tests; 6,286 pass on this branch and on `main` alike. The one failure, `test_int32_to_f64.test_constant_folded_mrt_words`, is the distro `spirv-opt` (SPIRV-Tools 2025.1) crashing with SIGSEGV, identical on `main`. - llvm-mc 18.1.3 (amdgcn, gfx1030), SPIRV-Tools 2025.1, Python 3.13, Linux. No shader corpus count (no game files here). GPUs tested: n/a (the `test_geometry_lds_rasterization` readback is not run yet; a GPU result can follow) AI-assisted: yes (Claude rebased and tested; the change is tedin7's) ### 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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#1774
No description provided.