mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #674] [MERGED] rdna2spirv: put back the instructions llvm-mc's junk swallowed after a tuple into vcc (SHADER-VCC-TUPLE-RESYNC) #713
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#713
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/674
Author: @DadaCap
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:vcc-tuple-resync📝 Commits (8)
f8d0c75Merge remote-tracking branch 'origin/main' into HEADf605f8ardna2spirv: put back the instructions llvm-mc's junk swallowed after a tuple into vcc6886740test_vcc_tuple_fallback: cover where a resync starts and stops091cd96rdna2spirv: restrict restore_vcc_tuples to reachable offsets and protect branch targets30450e0Merge #596's head (091cd9680); restore_vcc_tuples decodes for the shader's wave sizebc245e5Merge remote-tracking branch 'origin/main' into vcc-tuple-resync686f914Merge main into vcc-tuple-resync: restore_vcc_tuples next to widen_wave64_masksa6b851dMerge origin/main into vcc-tuple-resync: one recovery function for the forms llvm-mc skips📊 Changes
6 files changed (+378 additions, -79 deletions)
View changed files
📝
docs/design.md(+1 -1)📝
docs/shader_library.md(+7 -2)📝
tests/semantic/test_library_compute_forms.py(+4 -3)📝
tests/semantic/test_vcc_tuple_fallback.py(+223 -3)📝
tests/test_rdna2spirv_decode.py(+1 -1)📝
tools/rdna2spirv.py(+142 -69)📄 Description
Claimed in the coordination issue as: SHADER-VCC-TUPLE-RESYNC (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7129901990)
Depends on: #596 (its two commits come first here; this pull request is the last commit)
What and why
llvm-mc rejects a scalar tuple that runs into
vccand prints the tuple's second word as junk. #596 decodes the tuple from the blob and drops the junk. But the junk is often longer than that word (an 8-byteexp, for example), so it also covers the instruction after the tuple: ans_mov_b32, ans_waitcnt, av_fma_f32. Nothing printed that instruction at its own place, so it stayed missing and the program was refused with "fall-through into undecodable words".restore_vcc_tuplesnow decodes the words after a restored tuple from the blob, the same way, until the stream is back at an instruction llvm-mc printed there. A word llvm-mc itself rejected, with no junk printed over it, is not taken for swallowed code and stays refused.Tested
Whole pipeline library (1.0.2.1, own copy), all 2,684 compute programs, llvm-mc 21.1.8,
--wave64-emulate,main+ #596 without and with this commit:spirv-val0 programs lost, and the 1,816 modules are byte-identical. What is left: 80
s_load_dword*with avccbase or destination (#647 has the bases), 18s_flbit_i32_b64and 6s_bitreplicate_b64_b32(#593), 9 that cannot be re-anchored, 3 fall-throughs, 1s_sethalt. The 26,503 main-corpus listings have no undecodable words with this disassembler, so this path does not run on them.tests/semantic/test_vcc_tuple_fallback.py: 7 tests pass; the new case is red without the fix, and a second one checks that a rejected word after a tuple is still refused.test_image_cube_store_glc, which fails here withFileNotFoundErrorstarting an external program, onmaintoo.tests/test_docs_*.pyset,test_text_write_line_endings.py,compileall,check_no_game_data.py: clean.The new modules are checked by
spirv-valonly; none was compared with hardware.GPUs tested: n/a
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.