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

Closed
Andretuta wants to merge 1 commit from upstream-pr/267 into main
Andretuta commented 2026-11-24 02:56:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:56:11Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465212570 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/267). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:56:11Z. --- > 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
MoonEyes commented 2026-11-28 07:08:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T07:08:03Z.


Thanks a lot for this, @Andretuta. We checked and this pull request is a draft for the same fix as #1761, which carries the same commit by the original author, rebased on main (the fixture and the test are the same, byte for byte); the kept one is #1761. To keep the queue clear and avoid reviewing the same change twice, I am closing this one in favour of #1761. If you think this is a mistake, please reopen it and let us know.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7235737632 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/267#issuecomment-7235737632). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T07:08:03Z. --- Thanks a lot for this, @Andretuta. We checked and this pull request is a draft for the same fix as #1761, which carries the same commit by the original author, rebased on main (the fixture and the test are the same, byte for byte); the kept one is #1761. To keep the queue clear and avoid reviewing the same change twice, I am closing this one in favour of #1761. If you think this is a mistake, please reopen it and let us know. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!267
No description provided.