shader: disasm_rdna2 formats v_readfirstlane_b32 destination as VGPR instead of SGPR #746
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#746
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?
@Ammmae0x on GitHub · 2026-11-23 00:26 UTC · original
Commit or build
fd2486f(upstream/main)Reproduction
Disassemble both the 32-bit VOP1 (
0005047e) and 64-bit VOP3A (020082d500010000) encodings ofv_readfirstlane_b32:Expected behavior
As documented in
VOP1_OPS[0x02](tools/disasm_rdna2.py:249:"Read first active lane into SGPR") and required by the RDNA 2 ISA and downstream lifters (tools/mesh_entry_aot.py:225-229),v_readfirstlane_b32writes an SGPR (sdst), not a VGPR. Both encodings should format the destination viadecode_s_reg(vdst):Acceptance criteria:
tools/disasm_rdna2.py:1237-1241) and VOP3A (tools/disasm_rdna2.py:1706-1707) destination formatting to usedecode_s_reg(vdst)whenop_nameisv_readfirstlane_b32(orv_readfirstlane_b32_e64/v_readfirstlane_b32).v_readfirstlane_b32encodings intests/rdna2_tools_check.py.Observed behavior
decode_instructionunconditionally formatsdst_strasf"v{vdst}"in both VOP1 (tools/disasm_rdna2.py:1237) and VOP3A (tools/disasm_rdna2.py:1706), producing a VGPR destination:Environment
Windows 10 Pro 24H2 (build 26100.7623), Python 3.11.15.
Checklist
AI-assisted.
@R0Y00 on GitHub · 2026-11-23 01:08 UTC · original
Please verify the destination and opcode with the LLVM 15
gfx1013round trip. The plain register form should print an SGPR destination and preserve the source and stream alignment. Only change the VOP3A form if that target actually assembles the same operation there. A following instruction makes a useful alignment control.@FZNull on GitHub · 2026-11-23 01:55 UTC · original
Ran the
gfx1013round trip the issue asks for. Note the assembler here is LLVM 21.1.8 built with the AMDGPU target (-triple=amdgcn--amdpal -mcpu=gfx1013), not the LLVM 15 in CI, so treat it as strong evidence that still wants a CI-side confirmation.VOP1 form, as the issue expects:
The encoding is the same two words the issue disassembles (
0005047e), and the assembler prints an SGPR destination. Sotools/disasm_rdna2.pyshould format the VOP1 destination throughdecode_s_reg(vdst).VOP3A form: this target does not assemble it.
Per the guidance ("only change the VOP3A form if that target actually assembles the same operation there"), the VOP3A destination formatting should stay as it is. Two further probes agree that the operation only exists in one shape on this target:
So on
gfx1013the instruction is VOP1 only, with an SGPR destination and a VGPR source. That also suggests the VOP3A word020082d500010000the issue disassembles as this op is probably not this instruction; it would be worth decoding it against the ISA before the VOP1-formatting change is made on its strength.I have not changed any code. If it helps, I can send the VOP1-only formatting change plus a VOP3A-unchanged regression test.
@Ammmae0x on GitHub · 2026-11-23 01:57 UTC · original
Open PR #765 already updates
tools/disasm_rdna2.pyto formatv_readfirstlane_b32destinations as SGPRs in both VOP1 and VOP3 paths, so holding off on opening a duplicate PR while #765 is in review (noting the maintainer guidance to verify VOP3A encoding and stream alignment via LLVM 15gfx1013round trip).AI-assisted.
@R0Y00 on GitHub · 2026-11-23 02:07 UTC · original
Independent LLVM 15 gfx1013 check: v_readfirstlane_b32 s2, v0 assembles to 0005047e and disassembles back with an SGPR destination, followed by s_endpgm. The explicit _e64 spelling is rejected by the assembler, and 020082d500010000 produces invalid-encoding warnings in the disassembler. The following s_endpgm still decodes.
Please fix the VOP1 SGPR destination and include the following instruction in the regression. For the proposed VOP3A bytes, use a distinct unsupported-encoding diagnostic and preserve the eight-byte record boundary. The check should keep the next instruction visible at offset 8.