mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:00:52 +01:00
[PR #2168] rdna2spirv: MUBUF loads to LDS, buffer_load_{dword,ubyte,sbyte,ushort,sshort} ... lds (SHADER-MUBUF-LDS-DMA) #2173
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2173
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2168
Author: @vinceychu
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:shader-mubuf-lds-dma📝 Commits (1)
5e7ab21rdna2spirv: MUBUF loads to LDS, buffer_load_{dword,ubyte,sbyte,ushort,sshort} ... lds (SHADER-MUBUF-LDS-DMA)📊 Changes
7 files changed (+357 additions, -10 deletions)
View changed files
📝
docs/design.md(+1 -0)📝
runtime/test/shaders/check.py(+8 -3)➕
runtime/test/shaders/cs_buf_lds.asm(+53 -0)📝
scripts/run_gpu_tests.py(+6 -2)➕
tests/semantic/test_buffer_load_lds.py(+215 -0)📝
tests/semantic/test_buffer_load_sub.py(+1 -2)📝
tools/rdna2spirv.py(+73 -3)📄 Description
Claimed in the coordination issue as: SHADER-MUBUF-LDS-DMA (#1608)
What and why
The translator refused the
ldsmodifier on MUBUF loads (raise Unsupported(op + " form")). With it, RDNA2 loads gostraight to LDS ("Memory Buffer Load to LDS", RDNA2 ISA 8.1.9), the way compilers stage data into shared memory.
buffer_load_dword,buffer_load_ubyte,buffer_load_sbyte,buffer_load_ushort,buffer_load_sshortwith
lds, in compute and mesh shaders.LDS_BASE + M0[15:0] + inst_offset + TIDinWave*4(the ISA figure; TIDinWaveis added on the LDS path whatever the V#'s ADD_TID_ENABLE says). The VDATA field names the M# and is ignored; the
llvm-mc spelling omits it, so a three-operand listing is accepted too.
buffer_address's, bounds-checked exactly like the VGPR forms; an out-of-range read supplies 0,which is what the lane writes. Sub-dword values are zero- or sign-extended to the stored dword (the byte/short read
is shared with
buffer_load_subthrough a newbuffer_sub_valuehelper).lds_access, so it is dropped outside the wave's LDSallocation (RSRC2 LDS_SIZE for compute), like the
ds_*stores.buffer_load_dwordxN ... lds(not in the ISA's lds subset),buffer_load_format_* ... lds,tfewithlds, and other stages.Tested
runtime/test/shaders/cs_buf_lds.asm(registered incheck.pyandrun_gpu_tests.py): 32 lanesload a dword, a ubyte and an sbyte into three M0-based LDS regions,
s_waitcnt+s_barrier, then read backtheir own and their neighbour's (
t^1) slots.run_gpu_tests.py --filter cs_buf_lds: PASS on an RTX 5090(NVIDIA 595.99.02, Ubuntu 26.04) and on the Ryzen 9 9950X's Radeon iGPU (RADV, Mesa 26.0.8).
tests/semantic/test_buffer_load_lds.py(10 tests throughspirv_mini_interp): per-lane slots,offset:andM0[15:0], the three-operand form, u/s byte/short extension, out of range -> 0, inactive lanes write nothing, theout-of-allocation drop, the refused forms.
python -I scripts/run_semantic_tests.py tests/semantic: 496 files, 6,343 tests, 0 failed.pytest tests/test_translate.py: 714 passed; the 2 failures arecs_dpp_cmp.asmwith LLVM 21, failing on main too(#1375).
python -m compileall,tests/test_ci_registration.py: clean.tools/hw_oracle) — the only RDNA2 GPU here drives a display.GPUs tested: NVIDIA GeForce RTX 5090 (595.99.02, Ubuntu 26.04.1); AMD Radeon iGPU of the Ryzen 9 9950X (RADV, Mesa 26.0.8)
AI-assisted: yes (Claude Code, with a Devin draft reviewed against the ISA, rebased and GPU-tested)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🤖 Generated with Claude Code
https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.