OLD-9996: rdna2spirv: lower wide and strided geometry shader LDS accesses #1761
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1761"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by potatoe0100 on 2026-11-25T11:37:15Z.
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 currentmainwith the author's commit kept.The legacy (merged ES/GS) geometry shader path in
Gen.gs_dsonly knewds_read_b32/b64/b96/b128,ds_read2_b32,ds_write_b32/b64andds_write2_b32. A GS that stages its output withds_write_b96/ds_write_b128, or walks ES input vertices / output slots with the 64-dword stride formsds_read2st64_b32/ds_write2st64_b32, raisedUnsupported. 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 smalllds_pair_byte_offsetshelper (no behaviour change there). The rule is added to the contract table indocs/design.md.Rebase note: one conflict in
tools/rdna2spirv.py, wheremainaddedds_appendnext 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 needsLEONIDA_VK_HARNESS). Withmain'stools/rdna2spirv.pythe same 4 tests fail withUnsupported, so they cover the change.python -I scripts/run_semantic_tests.py tests/semantic: 488 files, 6,287 tests; 6,286 pass on this branch and onmainalike. The one failure,test_int32_to_f64.test_constant_folded_mrt_words, is the distrospirv-opt(SPIRV-Tools 2025.1) crashing with SIGSEGV, identical onmain.GPUs tested: n/a (the
test_geometry_lds_rasterizationreadback is not run yet; a GPU result can follow)AI-assisted: yes (Claude rebased and tested; the change is tedin7's)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Tyrannys on 2026-11-25T14:44:14Z.
Independent verification of head
ed9459619(Windows 11 Pro 26300, Python 3.14.4, native llvm-mc 21.1.8, Vulkan SDK 1.4.341.0, NVIDIA GeForce RTX 4070 SUPER driver 621.01).tests/test_gs_ds_ring.py(pytest, withLEONIDA_VK_HARNESSset to a localvk_harnessbuild so the readback runs too): 5/5 pass at this head, includingtest_geometry_lds_rasterization(control-1, reference and wide/strided1on all 64 pixels).main'stools/rdna2spirv.py: 5/5 fail (Unsupported: ds_read2st64_b32 in gs,ds_write_b96 in gs, and so on), so the test shows what the PR adds.python -I scripts/run_semantic_tests.py -j 4 tests/semantic: 488 files, 6287 tests, 0 files failed.One note from reading the diff, not blocking: in
gs_dsreads, thevertex_deltafromdivmod(dw, GS_VTX_DW)is only used fords_read2st64_b32.ds_read2_b32 ... offset1:64andds_read_b32 ... offset:256address the same bytes asds_read2st64_b32 ... offset1:1under the "vertex i at dword 64·i" layout, but still wrap to the base vertex (as they did onmain). If a corpus GS ever reaches the next vertex that way it would read the wrong vertex silently; applying the delta to every read form (or refusing a nonzero delta outside st64) would keep the three spellings consistent.No game files. AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:44:58Z.
#1761 | head
ed94596196fadac949db27055e554a7c6bb076ad|python3 -m pytest -q -rA tests/test_gs_ds_ring.py| red: 5 run, 4 failures, 1 skipped | green: 4 passed, 1 skipped | Red → green. Native Vulkan 5/5 passed on AMD and RTXThe WSL run exercised the four geometry translation cases. For the optional rasterization case I reran the whole file with LEONIDA_VK_HARNESS on native Windows on each GPU.
Captured 2 distinct complete SPIR-V module(s) emitted while rerunning test_gs_ds_ring.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand.
With the native Vulkan harness, 5/5 failed on the baseline before rasterization because translation rejected the GS LDS accesses. After merging, 5/5 passed on each adapter, including the 8×8 control, reference and wide/strided readbacks. The initial RTX baseline timed out and the completed repeat gave the five translation failures.
Windows Vulkan adapters: AMD Radeon(TM) Graphics (26.11.2) and NVIDIA GeForce RTX 5070 Ti (610.74).
Additional commands
python -m pytest -q -rA tests/test_gs_ds_ring.py (Windows, LEONIDA_VK_HARNESS set)Base
3bd936ecd98995bca3e1da83d5e28d2343001aefwas merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Native runs used Windows 11, Python 3.12.10. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:53:28Z.
Merged, thank you @potatoe0100! This translator PR (OLD-9996: rdna2spirv: lower wide and strided geometry shader LDS accesses) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.