Repository navigation
Conversation
…lvm-mc rejects them llvm-mc 21 and 22 (21.1.8 is scripts/build_llvm_mc.ps1's default) reject SMEM data, MIMG resource/sampler and MUBUF resource tuples that run into vcc (s[100:107], s[104:107], s[92:107]) and then decode the words after them misaligned, so the translator refuses the program with "reachable instruction with normalized encoding". rdna2_decode prints those words as the [s100,...,vcc_lo,vcc_hi] list the translator already reads (as LLVM 23 does): give llvm-mc s_nop words in their place and splice the Python lines back in at the same offsets. llvm-mc keeps every other word.
|
Tested acab5ca merged with main 8575d36 on Linux/Python 3.12.16: pass Commands run (merged worktree,
Diff read: after llvm-mc reports invalid words, the instructions whose Python decode contains |
|
Note: #4843 (tedin7) proposes llvm-mc 23.1.0 as the minimum. LLVM 23 decodes these vcc tuples itself, so if #4843 lands this fallback only matters for anyone still on 21/22 (e.g. a build from an older |
The fallback read each warning's byte offset from its column, which holds only while the program goes to llvm-mc as one line. ItsNotRexed#4210 splits it into short lines; take the offset from the warning's line and column in the text that was sent, so the splice works with either input layout.
|
Pushed 9a15309: the invalid words' offsets now come from each warning's line and column in the text sent to llvm-mc, so this works with #4210's short input lines as well as one line ( |
llvm-mc prints a v_fma_mix* literal cut from its encoding comment (8 bytes shown, 12 read), so counting the printed bytes put every later instruction 4 bytes early and the splice gave up. Where llvm-mc and rdna2_decode name the same instruction at an offset, advance by rdna2_decode's length.
|
Tested
Code read: the splice is conservative — it returns AI-assisted. |
|
Corpus counts: the 1.0.2.1 pipeline library (21,521 programs, default stages), llvm-mc 21.1.8 gfx1013, Windows. Each listing goes through The 3,566 programs that hold a scalar tuple into vcc. I found them by scanning each program's code with
On main, 3,536 of them stop on "fall-through into undecodable words" and 30 on other refusals. Every program that translates passes
Whole library:
0 Two fixes since the first push came out of this run:
The FSSM corpus was not re-run. |
|
Tested b8b2dbc on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass. Ran the test files this PR adds or changes, from a clean checkout of the PR head: AI-assisted (Claude Code). |
|
✅ Automated security review: CLEAN (commit
Scope: static analysis of added diff lines only; no code was executed. Please review findings manually. |
Item: SHADER-1108
llvm-mc 21 and 22 reject scalar register tuples that run into
vcc(SGPRs 106-107): SMEM datas[100:107],s[104:107],s[92:107], and an image's resource or sampler or a buffer's resource on those registers. llvm-mc then decodes the words after them misaligned, and the translator refuses the program with "reachable instruction with normalized encoding" (docs/shader_library.md §5: the largest refusal class in the pipeline-library corpus). 21.1.8 is stillscripts/build_llvm_mc.ps1's default. LLVM 23 decodes these itself (#6813's table: 15,551 vs 16,699 of 21,521 library programs pass, 21.1.8 vs 23.1.5).tools/rdna2_decode.pyalready decodes these words as the[s100,...,vcc_lo,vcc_hi]list thatshader_irparses and the translator reads (design.md, Scalar/buffer memory), the same form LLVM 23 prints. Change inshader_disasm.disasm(used byshader_disasm.py,fspx_unpack.py --disasmandshader_library.py --disasm):vcc_lo,vcc_hi].s_nop 0words, and llvm-mc decodes everything else as before.Tests
tests/test_shader_disasm.py,VccTupleFallbackTest. It uses one synthetic program:s_load_dwordx8intos[100:107],s_load_dwordx4intos[104:107],image_samplewith resources[100:107]and samplers[104:107],buffer_load_dwordwith resources[104:107], thenv_mov_b32ands_endpgm.shader_irparses anslist, and the encodings concatenate back to the input bytes.LLVM_MCis set.main.With llvm-mc 21.1.8 on Windows:
test_shader_disasm(31),test_fspx_unpack,test_shader_library,test_rdna2spirv_decodepass.test_rdna2_decodehas the same one failure onmain(op_selparity with llvm-mc 21).scripts/check_no_game_data.pyis clean on the changed files.Corpus counts for the affected library programs (main vs this branch, llvm-mc 21.1.8) follow as a comment. The FSSM corpus has not been re-run with this change.
AI-assisted.