rdna2spirv: MUBUF loads to LDS, buffer_load_{dword,ubyte,sbyte,ushort,sshort} ... lds (SHADER-MUBUF-LDS-DMA) #2168
Closed
leonida/mandy
vinceychu wants to merge 0 commits from
shader-mubuf-lds-dma into main
pull from: shader-mubuf-lds-dma
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3323
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!2168
Loading…
Reference in a new issue
No description provided.
Delete branch "shader-mubuf-lds-dma"
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 closed
This pull request cannot be reopened because the branch was deleted.
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
Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly into main. With this PR: test_buffer_load_lds 10 OK and test_buffer_load_sub 10 OK (unittest discover in tests/semantic). test_buffer_load_lds.py against main's translator: 19 errors, so it fails on main and passes with the change. compileall clean.
Not run: the whole semantic suite and the translated / spirv-val counts over a corpus (no game data here).
Note for review: it conflicts with #2164 (tools/rdna2spirv.py and tests/semantic/test_buffer_load_sub.py), so whichever lands later needs a rebase.
AI-assisted: yes (Claude Code)
Tested
462137455on an Apple M3 (macOS 26.5.1) with the three Vulkan drivers there. I ran the fullscripts/run_gpu_tests.pyin auto mode, againstmaina73a57e13, with test programs built frommain.mainLEONIDA_W64_EMULATE=1LEONIDA_W64_EMULATE=1The new
cs_buf_ldspasses on MoltenVK (native and emulated) and on KosmicKrisp, with the same eight words:1592590336 128 4294967168 1592590337 1592590337 129 4294967169 1592590336. llvmpipe skips it (subgroup 4 is narrower than 32 lanes). The failures are the same on both sides, none new:cs_fma_fused(#1724),cs_imgatomic_ext(#1518) andps_ssharp(#1774) on MoltenVK;cs_bvh/cs_bvh32,ps_cndmask_sign_modsandps_valu16_mad_sel(KosmicKrisp's(NAN)constants, #2229) on KosmicKrisp;cs_imgatomic_exton llvmpipe.AI-assisted (Claude Code). No game data.
Rebased onto current
main(it had picked up a conflict inscripts/run_gpu_tests.pywith the newcs_dpp_cmpxentry; both kept). After the rebase:cs_buf_ldspasses on the RTX 5090 (NVIDIA 595.99.02) and the Radeon iGPU (RADV), same eight words;run_semantic_tests.py tests/semantic501 files, 6,383 tests, 0 failed. Thanks @Tauwni and @wavehs for the Apple M3 runs.Generated by Claude Code
#2168 | head
5e7ab21e0b479e363150ff95a0a8efd4d2fe9975|python3 -I tests/semantic/test_buffer_load_lds.py -v,python3 -I tests/semantic/test_buffer_load_sub.py -v,python -I scripts/run_gpu_tests.py --filter cs_buf_lds --require-pass --build <harness-dir> --assembler python --work <scratch>| red: 20 tests, 19 errors, GPU fixture 0/1 (translation failed) | green: 20 passed, GPU fixture 1/1 | Red → green, GPU confirmedThe baseline semantic tests raised Unsupported for the new load forms. The filtered GPU run also stopped at translation on main, then passed the readback on the merged tree. Failure and error counts include subtest events. The merged fixture also passed a separate SPIRV-Tools 2026.1 check with
spirv-val --target-env vulkan1.2.Pinned main
4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4 for CPU tests. Windows 11 Pro, Python 3.12.10, RTX 5070 Ti (NVIDIA 610.74) for the filtered Vulkan run. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.#2168 | head
5e7ab21e0b479e363150ff95a0a8efd4d2fe9975(merged cleanly ontomaind48a957bb9988afce424552a3c0c8d01ef12320f) | Windows 11 (10.0.26200), CPython3.12.10,llvm-mc(gfx1013),spirv-val(1.4.363.1), NVIDIA GeForce RTX 3090 (Vulkan1.4.341, driver610.88,subgroup 32..32,LEONIDA_VK_VALIDATION=1)main(d48a957bb9988afce424552a3c0c8d01ef12320f):tests/semantic/test_buffer_load_lds.py:FAILED (errors=19)(rdna2spirv.Unsupported: buffer_load_dword form/buffer_load_sbyte form).cs_buf_lds.asmtranslation onmain:0 translated(buffer_load_dword form).PR + main:python -I tests/semantic/test_buffer_load_lds.py -v:10/10pass (OK);python -I tests/semantic/test_buffer_load_sub.py -v: pass (OK).python -I scripts/run_gpu_tests.py --filter cs_buf_lds --require-pass(LEONIDA_VK_VALIDATION=1on RTX 3090):PASS cs_buf_lds([0x5EED0000, 0x00000080, 0xFFFFFF80, 0x5EED0001, 0x5EED0001, 0x00000081, 0xFFFFFF81, 0x5EED0000]exact,spirv-valclean,0Khronos validation errors).scripts/check_no_game_data.py,test_docs_encoding.py, andtest_text_write_line_endings.py: pass (0CRLF).Gen.x_memory_orderintools/rdna2spirv.pyand_x_memory_order_accessintools/wave64_emulate_opt.py):buffer_load_*withldsis currently classified only as('mem', True, False)without marking('lds', 'w'), so an intra-wave64buffer_load_dword ... ldsfollowed by a cross-halfds_read_b32withouts_barrierwould omitx_order_barrier()under--wave64-emulate.llvm-mcldslistings:read_before_write_vgprs/reg_reads_writestreata[0]as a writtenvdst(buffer_load_dword v1, s[0:3], s8 offen ldsyieldsrr=set(), ww={1}, and 4-operandv9, v1, ... ldsmarks ignoredv9inww={9}), andtools/shader_meta.py_sgpr_slots(a[2], 4)inspectssoffset(a[2]) rather thansrsrc(a[1]) on 3-operandldsforms (user_sgpr_readsrecordss0..s3as'const32'instead of'vsharp').AI-assisted.
Discord:
.fountainhead.(for the Contributor role check).Generated by Claude Code
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.