shader: format the v_readfirstlane_b32 SGPR and reject the VOP3A word #772
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/778"
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 FZNull on 2026-11-23T02:37:48Z.
Summary
tools/disasm_rdna2.pyformatted every VOP1 destination as a VGPR, so the #746 bytes decoded asv_readfirstlane_b32 v2, v0instead ofv_readfirstlane_b32 s2, v0. The VOP1 path now formats that destination throughdecode_s_reg(vdst); the source stays a VGPR.The proposed VOP3A word from the issue also decoded as a valid instruction (
v_readfirstlane_b32 v2, v0). Ongfx1013this operation only exists as the 32-bit VOP1, so the VOP3A path now returns a distinct unsupported-encoding record,v_readfirstlane_b32 <unsupported VOP3A encoding>. It consumes exactly eight bytes and is neither recognized nor supported by the scanner, so no instruction reaches a lowerer. The followings_endpgmstill decodes at +8.Fixes #746. Disassembler and tests only; the
pixel_aotlowering belongs to #765.Maintainer confirmation and how this follows it
R0Y00 on #765: "LLVM 15 on
gfx1013confirmed the VOP1 SGPR destination and rejected the_e64spelling and the proposed VOP3A bytes. Please keep the VOP1 fix and make the invalid VOP3A record consume exactly eight bytes without handing an instruction to the lowerer. Keep a followings_endpgmin both controls."decode_s_regfix, re-verified against LLVM here;s_endpgm, and the VOP3A control shows it at offset 8;LLVM round trip
LLVM 21.1.8 here (
-triple=amdgcn--amdpal -mcpu=gfx1013); R0Y00 confirmed the same with LLVM 15.The alignment stream
assembles to
[0x00,0x05,0x04,0x7e],[0x01,0x03,0x00,0x7e],[0x00,0x00,0x81,0xbf], and disassembling those bytes returns the three instructions at +0/+4/+8.The same target assembles no other shape:
Tests
The skip is the existing
test_llvm_comparison, which needsLLVM_LIB; its fixture list now containsv_readfirstlane_b32 s2, v0, so the LLVM 15gfx1013CI job exercises the same round trip.test_vop1_readfirstlane_b32_destination_is_an_sgprcovers:0005047e->v_readfirstlane_b32 s2, v0(SGPR destination, VGPR source preserved);0005047e 000081bf-> records at +0 and +4, followings_endpgmvisible;0005047e 0103007e 000081bf-> +0/+4/+8;0103047e->v_mov_b32_e32 v2, v1;020082d500010000 000081bf-> distinct unsupported-encoding record at +0, length 8,is_opcode_recognizedandis_instruction_supportedboth false, ands_endpgmat +8.Two mutants were checked: reverting the whole change fails on the VOP1 assertion, and dropping only the VOP3A hunk fails on the unsupported-record assertion.
A passing fixture supports the behavior under test; full-game startup remains unverified.
AI-assisted.