fix: lower wide and strided geometry shader LDS accesses #267

Open
github-bot wants to merge 1 commit from github-bot/gh-267 into main AGit
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:56 UTC · original
ubiquitarianism:old-pr/9996 → main · +138 −18 · 4 files · 1 commits · draft

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

**@⁠Andretuta** on GitHub · 2026-11-24 02:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/267) `ubiquitarianism:old-pr/9996` → `main` · +138 −18 · 4 files · 1 commits · draft > 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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:51:16 +00:00
This pull request has changes conflicting with the target branch.
  • tools/rdna2spirv.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/267/head:github-bot/gh-267'
git switch 'github-bot/gh-267'

Merge

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