mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:00:52 +01:00
[PR #327] [CLOSED] fix: rdna2spirv decodes scalar, image and buffer tuples that run into vcc, so the pipeline-library shaders translate #379
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#379
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/327
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:old-pr/10062📝 Commits (1)
063f14dfix: rdna2spirv decodes scalar, image and buffer tuples that run into vcc from the blob when llvm-mc rejects them📊 Changes
3 files changed (+190 additions, -3 deletions)
View changed files
📝
docs/shader_library.md(+5 -3)➕
tests/semantic/test_vcc_tuple_fallback.py(+149 -0)📝
tools/rdna2spirv.py(+36 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):What
tools/rdna2spirv.py: a scalar-memory, image or buffer instruction whose register tuple runs intovcc(SGPRs 106 and 107) is now decoded from the shader blob when llvm-mc rejects it. Newrestore_vcc_tuplesreads the blob dwords of the code range that no matched instruction covers with the existing pure-Pythonrdna2_decode, keeps an instruction only if one of its operands is a[s100,...,vcc_lo,vcc_hi]list (the form the translator already takes), and drops the junk instructions llvm-mc printed inside its two words. Every other undecodable word behaves as before.Why
docs/shader_library.mdsection 5 lists this as the largest refusal in the pipeline library: "reachable instruction with normalized encoding",s_load_dwordx8/x4/x16intos[100:107]/s[104:107]/s[92:107], and image or buffer resources in those tuples (about 2,533 programs per that document; I cannot measure the realshaders.rpfand did not try). llvm-mc skips the first word as invalid and prints the second as junk, sotranslate()refused the shader, or, when the junk matched the blob, translated it with the load silently missing.Tested
Synthetic words only, no game files.
tests/semantic/test_vcc_tuple_fallback.py(new): llvm-mc 19 encodings with the register field patched into vcc, run on the CPU interpreter. Three shapes, each with the three ways the listing can show the rejected words (both invalid, second word printed as a matching junk instruction, second word printed with another encoding):s_buffer_load_dwordx8 [s100..s105,vcc_lo,vcc_hi]: the store of s100, s105, vcc_lo, vcc_hi gives the four expected words (9 sub-cases across the file, 4 tests).[s104,s105,vcc_lo,vcc_hi]read bys_buffer_load_dwordand bybuffer_load_dword: loads 0xCAFE1234 and 0xBEEF5678.image_loadwith the T# in[s100..vcc_hi]: translates through the descriptor lookup.Results: the new file 4 tests, 9 translations also pass
spirv-as+spirv-val --target-env vulkan1.2(0 errors). Neighbours:test_fspx_rules.py9 OK,test_printed_encoding.py7 OK,tests/test_rdna2spirv_decode.py25 OK,tests/test_rdna2_decode.py17 OK (1 skipped),test_fma_mix_literal.py18 OK,tests/test_shader_library.py13 OK, fivetest_docs_*files OK.Negative control: with the one-line call to
restore_vcc_tuplesremoved (that is the behaviour of main), 9 sub-cases fail: "fall-through into undecodable words" for the two listings with no or matching junk and "reachable instruction with normalized encoding" for the third, the message the doc reports.Not verified: llvm-mc 23 is not available here (only 19, which rejects these words as invalid), so a listing where llvm-mc 23 prints the tuple one lower with another encoding (not "invalid") goes through
check_printed_encodingsand is not covered by this PR. The translated shaders were not run on a GPU. The real library counts were not re-measured.Lane:
tools/rdna2spirv.pyand a doc sentence only.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.