[PR #267] fix: lower wide and strided geometry shader LDS accesses #319

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

📋 Pull Request Information

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

Base: main ← Head: old-pr/9996


📝 Commits (1)

  • 167df27 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

Carried over from old PR 9996 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9996, 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.
This branch conflicts with the current main and needs a rebase.
tedin7: 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):

What

Legacy geometry shaders on LDS rings can now use ds_write_b96, ds_write_b128, ds_read2st64_b32 and ds_write2st64_b32. Before, the geometry-shader LDS path (gs_ds) accepted only b32/b64/read2_b32/write2_b32 and raised Unsupported for the rest.

  • b96/b128 writes stage three or four consecutive output dwords from consecutive VGPRs.
  • The st64 pair offsets count 64-dword units, as in compute (shared helper lds_pair_byte_offsets, LDS_WORDS). On reads, one unit advances one synthetic ES input vertex at a fixed component. Writes address the flat staged output slots.
  • Compute LDS lowering now uses the same helper, behaviour unchanged.

Why

The geometry shaders in the corpus are $GS_VoxelizeGeneric permutations on LDS rings. A GS that hits one of these four forms fails translation, so its pipeline cannot be built (PSO / 3D rendering blocked).

Tested

  • pytest tests/test_gs_ds_ring.py: 4 passed (read2st64, write96, write128, write2st64: translate plus spirv-val, entry point Geometry), 1 skipped.
  • Negative control: with tools/rdna2spirv.py restored to origin/main (tests kept), all 4 fail with Unsupported; with the fix they pass.
  • NOT run: test_geometry_lds_rasterization (the vk_harness readback) is skipped because it needs a built vk_harness, and no GPU pod or local Windows build was available. So the vertex mapping is checked by translation and validation only, not by a pixel readback.
  • Neighbours: pytest tests/semantic -k 'lds or ds_ or write2 or read2': 621 passed, 3 skipped, 4494 subtests passed (covers the compute LDS path that now shares the offset helper).

Rebased cleanly on current main (cherry-pick, no conflicts). Coordination: https://github.com/ProjectLeonida/Leonida/issues/9677


🔄 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/267 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/9996` --- ### 📝 Commits (1) - [`167df27`](https://github.com/ubiquitarianism/leonida/commit/167df2770781bf9faa171cd1e4c1172b70833bdc) 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 > Carried over from **old PR 9996** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9996`, 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. > This branch conflicts with the current `main` and needs a rebase. > `tedin7`: 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): ## What Legacy geometry shaders on LDS rings can now use `ds_write_b96`, `ds_write_b128`, `ds_read2st64_b32` and `ds_write2st64_b32`. Before, the geometry-shader LDS path (`gs_ds`) accepted only b32/b64/read2_b32/write2_b32 and raised `Unsupported` for the rest. - b96/b128 writes stage three or four consecutive output dwords from consecutive VGPRs. - The st64 pair offsets count 64-dword units, as in compute (shared helper `lds_pair_byte_offsets`, `LDS_WORDS`). On reads, one unit advances one synthetic ES input vertex at a fixed component. Writes address the flat staged output slots. - Compute LDS lowering now uses the same helper, behaviour unchanged. ## Why The geometry shaders in the corpus are `$GS_VoxelizeGeneric` permutations on LDS rings. A GS that hits one of these four forms fails translation, so its pipeline cannot be built (PSO / 3D rendering blocked). ## Tested - `pytest tests/test_gs_ds_ring.py`: 4 passed (read2st64, write96, write128, write2st64: translate plus spirv-val, entry point Geometry), 1 skipped. - Negative control: with `tools/rdna2spirv.py` restored to origin/main (tests kept), all 4 fail with `Unsupported`; with the fix they pass. - NOT run: `test_geometry_lds_rasterization` (the vk_harness readback) is skipped because it needs a built `vk_harness`, and no GPU pod or local Windows build was available. So the vertex mapping is checked by translation and validation only, not by a pixel readback. - Neighbours: `pytest tests/semantic -k 'lds or ds_ or write2 or read2'`: 621 passed, 3 skipped, 4494 subtests passed (covers the compute LDS path that now shares the offset helper). Rebased cleanly on current main (cherry-pick, no conflicts). Coordination: https://github.com/ProjectLeonida/Leonida/issues/9677 --- <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#319
No description provided.