tooling: refuse VOPC SDWA scalar codes 209-234 in disasm_rdna2 #1021
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1028"
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-23T22:09:39Z.
Refs #938
Summary
The GFX10 VOPC/VOPCX SDWA decoder added in #980 refused only scalar source codes 249, 250 and 255. For codes 209-234
decode_s_regfell back tos{n}, so records such asf904007cd1008606printedv_cmp_f_f32_sdwa vcc_lo, s209, v2 ..., which names no register. LLVM 15.0.7 refuses every such record. The #938 sweep found 20,129 of them across all 124 VOPC SDWA opcodes, as src0 and as src1, with and without input modifiers.This change refuses those records as 8-byte
vopc_sdwarecords with the commentVOPC SDWA scalar operand outside the supported LLVM 15 decoder subset. The range is labelled as the supported LLVM 15 decoder subset, as requested, and not as an ISA claim. The record length and the next offset do not change, and the following instruction still decodes at offset 8. Codes 208 (-16) and 235 (src_shared_base) still decode.Files:
tools/disasm_rdna2.py(+8),tests/rdna2_tools_check.py(+73).Tests
New tests are in
tests/rdna2_tools_check.py, which is already registered in CMake and both CI jobs:test_vopc_sdwa_scalar_codes_outside_llvm15_subsetdecodes six accepted boundary records followed byv_mov_b32_e32 v3, v4(0403067e). They cover codes 208 and 235, src0 and src1, VOPC withvcc_loands6, and VOPCX. The bytes come from llvm-mc 15.0.7 (-triple=amdgcn--amdpal -mcpu=gfx1013 -mattr=+wavefrontsize32). The test checks(offset, length, opcode, text)for both records. It then checks six refused records with the same layout (codes 209 and 234, src0 and src1, f32, u32 and VOPCX):vopc_sdwaat offset 0 with length 8 and the new comment, andv_mov_b32_e32 v3, v4at offset 8. Finally it loops over every code from 209 to 234 as src0 and as src1, with and without neg. No assembler spelling exists for these codes, so those records are built from the accepted ones.test_vopc_sdwa_scalar_subset_matches_llvmruns only whenLLVM_LIBis set. LLVM 15 must decode the accepted records with the same text and next offset, and must refuse each refused record at byte 0.Environment: Windows 11, Python 3.13.1, LLVM 15.0.7 (
LLVM-C.dll,llvm-mc,llvm-objcopy), commitb2fa797on upstream/main64ecc87(measured at09e21a4oncd87907;tools/disasm_rdna2.pyand its tests are unchanged between the two bases, andrdna2_tools_check,shader_census_check,form_coverage_checkanddocs_links_checkwere rerun after the rebase).Sweep before and after
I ran the independent #938 sweep script (
sweep_980.py: 869,888 VOPC SDWA records, each followed byv_mov_b32_e32 v3, v4; s_endpgm, all compared against LLVM 15.0.7) on this commit. Each record is compared with the original #938 run:All 20,129 records moved from
llvm_refuses_disasm_decodestoboth_refuse. No other record changed category or decoder text. Truncated-tail checks: 0 unexpected. Scanner mismatches: 0. The sweep's three in-memory negative controls still report their injected defects with 0 deltas outside the expected scope. Before this change, 3,329 distincts209..s234decoder texts passed the scanner's per-line check and then failedpixel_aot.lowerwithKeyError. After it, none do.Negative control
I reverted
tools/disasm_rdna2.pyto upstream/main and kept the new tests.test_vopc_sdwa_scalar_codes_outside_llvm15_subsetthen fails:The LLVM-gated test still passes, because it checks LLVM rather than the decoder. With the change restored, both tests pass.
Limits
decode_s_regstill printss{n}for 209-234 elsewhere, for example in VOP3. Those paths were not swept here.git merge-tree).AI-assisted.
🤖 Generated with Claude Code