shader_meta: handle short v_*_co_ci_u32, SMEM atomics, buffer_load lds, and VGPR swap/rel vscale (SHADER-META-OPERANDS-AND-LDS) #2018
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2018"
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 ShotTechOp on 2026-11-25T18:14:28Z.
Claimed in #1608 as
SHADER-META-OPERANDS-AND-LDS.What and why
Fixes four static-analysis bugs in
tools/shader_meta.py:v_*_co_ci_u32short forms (v_add_co_ci_u32 vD, src0, src1andsub/subrevvariants with implicit VCC):_split_operandspreviously treateda[1]as a written carry-out SGPR regardless of arity, dropping a user SGPR insrc0fromreadsand marking it written. Carry-outa[1]is now treated as a write only whenlen(a) >= 4.s_atomic_*,s_buffer_atomic_*):_split_operandspreviously placeda[0]inwritesonly, missing it as a read-before-write operand and falsely clobbering it whenglcis absent._step_statenow also classifiesa[1]asptr64/ptr32_lo(s_atomic_*) orvsharp(s_buffer_atomic_*).buffer_load*/tbuffer_load*withlds): these omitvdata, placingsrsrc(V#) ata[1]instead ofa[2]._step_statenow inspectsa[1]whenldsis present so user-SGPR V#s are classified asvsharp.vscaletracking acrossv_swap_b32andv_movreld_b32/v_movrelsd_b32/v_movrelsd_2_b32/v_swaprel_b32:v_swap_b32now swapsvscalebetween both operands instead of only clearinga[0], and relative VGPR writes clearvscaleentries at or above the base VGPR.Testing
tests/test_shader_meta_split_and_lds.py.origin/main:tests/test_shader_meta_split_and_lds.pyfails withFAILED (failures=9)across all 4 test methods onorigin/main.python -I tests/test_shader_meta_split_and_lds.py -v(4/4 OK)python -I tests/test_shader_meta.py(28/28 OK)python -I tests/test_shader_meta_operands.py(5/5 OK)python -I tests/test_text_write_line_endings.py(3/3 OK)python -m compileall -q tools/shader_meta.py tests/test_shader_meta_split_and_lds.pypython -I scripts/check_no_game_data.py tools/shader_meta.py tests/test_shader_meta_split_and_lds.pygit diff --checkImported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-28T05:35:05Z.
#2018 | head 92c174d7b28fa501c6cb622761dd47932301fd97 | python -I tests/test_shader_meta_split_and_lds.py | red: FAILED (failures=9, AssertionError) | green: 4/4 OK (0.001s) | full suite: 514/522 stdlib passed, 0 new failures vs main 8994000b08 | Windows 11, Python 3.14.7, no game files | AI-assisted: yes, Antigravity (Gemini)Details:
tests/test_shader_meta_split_and_lds.pyonupstream/main8994000b08):Ran 4 tests in 0.004s — FAILED (failures=9)(9AssertionErrorfailures covering shortv_*_co_ci_u32operand reads, SMEM atomics,buffer/tbuffer_load_* ldsV# detection, andv_swap_b32vscaletracking).upstream/main8994000b08):Ran 4 tests in 0.001s — OK.scripts/check_no_game_data.py->0;python -m compileall -q tools scripts tests->0;node --test tests/test_viewer_streaming.cjs->0; standalone stdlibtests/test_*.py->514/522 passed(33skipped pytest/helper files;0new failures vs8994000b08, same 8 pre-existing failures).Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T13:01:07Z.
#2018 | head
92c174d7b28fa501c6cb622761dd47932301fd97(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/test_shader_meta_split_and_lds.pyfails onmain(FAILED (failures=9): shortv_*_co_ci_u32treatssrc0user SGPR as a carry-out write, SMEM atomics withoutglcclobbera[0], 3-operandbuffer_load* ... ldsmissesvsharpata[1], andv_swap_b32/v_movreld_b32leave stalevscale).PR + main:python -I tests/test_shader_meta_split_and_lds.py -v,python -I tests/test_shader_meta.py -v, andpython -I tests/test_shader_meta_operands.py -v: all pass (OK).llvm-mc+rdna2spirv.py+ RTX 3090vk_compute_test(LEONIDA_VK_VALIDATION=1,spirv-valclean) onv_swap_b32+v_readfirstlane_b32:out[0..1] = 0x77 0x0exact (0Khronos validation errors).scripts/check_no_game_data.pyandtest_text_write_line_endings.py: pass (0CRLF).#2168/tools/rdna2_decode.py):srsrc_idx = 1 if (op.startswith(("buffer_load", "tbuffer_load")) and "lds" in ins.get("mods", ())) else 2assumes the 3-operandllvm-mcspelling(vaddr, srsrc, soffset).tools/rdna2_decode.py(--backend python, supported by#2168) prints all 4 operands(vdata, vaddr, srsrc, soffset)onldsforms, wheresrsrcis stilla[2](len(a) == 3disambiguates both).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T17:58:36Z.
Red/green: tests/test_shader_meta_split_and_lds.py fails 9 assertions on main (short v_*_co_ci_u32 carry write, SMEM atomics without glc, buffer_load lds V# slot, v_swap/v_movrel vscale) and passes with the PR.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
cb7a239ccin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)