shader: name special source operands in disasm_rdna2 #842
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/848"
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 R0Y00/Xbox2Windows. Originally posted by marquezinii on 2026-11-23T12:43:53Z.
Change
decode_s_regintools/disasm_rdna2.pyhad no names for source operand codes 235-239, 248 and 251-254 and printed them ass235..s254. Those SGPRs do not exist (SGPRs end ats105). The codes select hardware values:src_shared_base,src_shared_limit,src_private_base,src_private_limit,src_pops_exiting_wave_id,src_vccz,src_execz,src_sccandsrc_lds_direct. 248 is the 1/(2*pi) inline constant. The decoder now uses the LLVM spellings.decode_s_reg64prints 248 as0.15915494309189532, which is how LLVM spells it for 64-bit operands. Every encoding that goes through these helpers changes: VOP1/VOP2/VOPC/VOP3 sources and SOP1/SOP2/SOPC operands.The wrong names also reached the scanner. In binary mode,
scan_unsupported_shaders.pyclassifies thedisasm_rdna2text, so a read of SCC was counted as a supported SGPR read:Independent problem, no linked issue. No open PR touches
tools/disasm_rdna2.py.AI-assisted.
Verification
Branch on
e97090a. Windows 11 build 26300, Python 3.15.2 (venv) and 3.13.18.disasm_rdna2.decode_instructionwithllvm-mc --disassemble -mcpu=gfx1013(LLVM 21.1.8) on random instruction words in each encoding family. The encodings and spellings in the new vectors come fromllvm-mc -mcpu=gfx1013 -show-encoding. On the branch, the same comparison over 1500 words per family shows no special-operand mismatches.src_lds_directin a scalar slot is the one exception: LLVM prints the same name but adds an "invalid register" comment.python -B tests/rdna2_tools_check.py TestRdna2Disasm.test_golden_vectors: onmainthis fails at the first new vector (eb02007e: gotv_mov_b32_e32 v0, s235, expected... src_shared_base). On the branch it passes.python -B tests/rdna2_tools_check.py:Ran 72 tests ... OK (skipped=1)on 3.15 and 3.13. The skip istest_llvm_comparisonbecauseLLVM_LIBis not set.ctest --preset dev --no-tests=error -E '_hardware$'(dev preset, SPIR-V tools on PATH,-j 4): 309 passed, 2 skipped (bvh_wave64_warpandwave_shuffle_warp, exit 77), and 2 timed out under parallel load (pixel_aot_comparisons_warpandpixel_aot_predicate_rounding_warp). Rerun alone with-j 1, those two passed in 11.5 s and 9.2 s.Not run: the Ubuntu LLVM 15 job. I added six lines to the
test_llvm_comparisonfixture (src_shared_base,src_pops_exiting_wave_id,src_sccandsrc_lds_directasv_mov_b32_e32sources,0.15915494inv_add_f32_e32and0.15915494309189532inv_add_f64). That job compares them with LLVM 15's disassembly. I checked the same lines with LLVM 21 only.Evidence and follow-up
The new vectors are instruction encodings produced by
llvm-mc. No external data is involved.The same comparison found two other disassembler mismatches that this PR does not fix:
v_cvt_u32_f64_e32,v_cvt_i32_f64_e32andv_cvt_f32_f64_e32print the 32-bit destination as a pair (v[66:67]instead ofv66). The e64 forms are correct.v_interp_mov_f32prints its parameter as a VGPR (v0/v1/v2) instead ofp10/p20/p0.Checklist