tooling: decode v_permlane16_b32 and v_permlanex16_b32 in disasm_rdna2 #1315
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1322"
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 MasterDomino on 2026-11-24T08:00:09Z.
Fixes #1298
tools/disasm_rdna2.pyprinted VOP3 0x377 and 0x378 asv_vop3_377/v_vop3_378. It now decodes them asv_permlane16_b32andv_permlanex16_b32. Decoder only: the scanner and translators are unchanged.Behaviour
Following the scope on #1298:
vdst, src0, src1, src2with a two-elementop_sel:[fi,bound_ctrl](w0 bits 11 and 12), printed only when a flag is set.src0, and SGPRs,vcc,ttmp,m0,null,exec, the special sources and inline constants in the lane selects.v_permlane{,x}16_b32_unsupportedwith<unsupported VOP3A encoding>and keep their record length, 12 bytes with a literal. That covers abs, neg,op_sel[2:3], clamp, omod, a non-VGPRsrc0, a VGPR lane select, the reserved codes 209–234, 249, 250, LDS direct and a literal. LLVM 15's disassembler prints some of these words but silently drops the modifier bits, or uses operands the assembler rejects.Tests (
tests/rdna2_tools_check.py)test_vop3_permlane_golden_vectors: 14 llvm-mc 15.0.7 encodings: both plain opcodes,v255/s105,vcc_lo/vcc_hi/exec_lo/exec_hi/m0/null/ttmp0, integer and float inline constants,op_sel:[1,0],[0,1],[1,1].test_vop3_permlane_llvm_round_trip: assembling the vectors gives the same bytes, LLVM disassembles them to the same strings as this decoder, and the decoded text reassembles to the same bytes.test_vop3_permlane_fields_and_neighbours_differ: flipping the opcode, vdst, fi or bound_ctrl bit changes the text; 0x376 and 0x379 keep their names.test_vop3_permlane_refuses_forms_the_llvm_15_assembler_cannot_produce: 16 refused forms plus both literal lane selects. Each is followed bys_endpgmto check the 8- or 12-byte boundary, plus a truncated literal.test_vop3_permlane_modifier_and_source_grid_matches_the_llvm_15_assembler: each w0 bit 8–15 combined with each w1 bit 27–31 on both opcodes. Only fi/bound_ctrl alone decode, and they decode as LLVM prints them. Where LLVM still prints a refused word, its text is the word with abs/neg/op_sel[2:3]removed.form_coverage_check,shader_census_check,shader_corpus_report_check,shader_probe_check,pso_readiness_check,docs_links_checkandbidi_controls_checkalso pass.Negative control: with
tools/disasm_rdna2.pyrestored to main, all five new tests fail (131 subtest failures), showing thev_vop3_377/v_vop3_378placeholders and the three-elementop_sel:[1,0,0].Sweep (local script, not committed): 23,108 synthetic words over both opcodes: every value of each source field, every modifier bit, and 20,000 random words.
Inventory change, recognition only
One local input (12,101 PS records, the same population as #711), scanned with
tools/scan_unsupported_shaders.py --llvm <LLVM-C.dll>. Basef5d83c31against this branch on the same base. The rebase onto4d7509aachanges none of the decoder, scanner or translator files.All 3,185
v_vop3_378occurrences, in 1,361 records, now decode asv_permlanex16_b32. None is refused. The input has no 0x377. The translator verdict and its reason are identical for all 12,101 records, becausepixel_aotdoes not lower either instruction.Environment
Windows 11 26H2 (build 26300.9974), Python 3.13.1, LLVM 15.0.7 (
LLVM-C.dll,llvm-mc,llvm-objcopy).AI-assisted.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:07:16Z.
Review: COMMENTED
Reviewed and verified PR #1322 at commit
3437253a51d8d5dc5bc355b44f06c24000beaa3f(looks good; no blockers).Linux Checks (
/tmp/rev-x2w-1322)git diff --check origin/main...HEAD: passed/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (16 Markdown files, 290 links)/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (1094 tracked files)/root/.local/share/x2w-rev-venv/bin/python -B tests/rdna2_tools_check.py: 138 tests ran, OK (skipped=18withoutLLVM_LIB, since onlyllvm-19is installed on this host while the suite's round-trip/grid tests target LLVM 15).Windows Server 2025 (Build 26100)
tests/rdna2_tools_check.pypassed (4.11s, no C++ build needed).Notes
tools/disasm_rdna2.pydecodesv_permlane16_b32(0x377) andv_permlanex16_b32(0x378) withop_sel:[fi,bound_ctrl](w0[11:12]), refuses unsupported modifier/operand combinations, and preserves 12-byte record length (andvop3_truncatedon short input) when a literal (255) appears insrc0/src1/src2so downstream instruction alignment is maintained.tests/rdna2_tools_check.pycovers golden vectors, field/neighbour negative controls (0x376–0x379), refused forms, and truncation.