Repository navigation
rdna2_decode parity: skip llvm-mc's SDWA inline-constant disassembly quirk - #5013
FreeFlex3244 wants to merge 1 commit into
Conversation
…quirk llvm-mc's disassembler does not round-trip an SDWA source that is a 32-bit inline constant: it assembles 'v_cvt_f16_u16_sdwa v5, 1.0 src0_sel:WORD_1' as two words but disassembles them as a three-word form with a materialized literal, so test_parity_with_llvm_mc_on_shader_fixtures fails under LLVM 21 on ps_sdwa_f16_const.asm. The decoder matches the assembler and hardware, and its bytes/operands are pinned by test_sdwa_inline_constants_and_sgpr, so skip the parity comparison for that one quirk rather than encode llvm-mc's mis-sized read.
|
Independent check of Environment: Windows 11, CPython 3.15.2.
This PR only adjusts the test (skips llvm-mc's SDWA inline-constant quirk when comparing parity), so there's no parent A/B to run — the check is that the suite still passes and the skip is surgical, which holds. The quirk-skip itself can't be exercised here without the llvm-mc parity corpus path. AI-assisted (Devin). |
|
Heads-up on overlap: the |
|
Tested
|
|
Tested 6128ba0 merged with main 203a348 on Linux (WSL2)/Python 3.12.16: concern (cannot discriminate here)
|
Claimed here: #4933 (comment)
What changed and why
tests/test_rdna2_decode.py::test_parity_with_llvm_mc_on_shader_fixturesfails onmainunder LLVM 21 (the version CI'stranslator-testsjob installs) onruntime/test/shaders/ps_sdwa_f16_const.asm:llvm-mc's assembler encodes
v_cvt_f16_u16_sdwa v5, 1.0 src0_sel:WORD_1as two words (f9a00a7ef2148500), but its disassembler reads those two words back as a three-word form with a materialized literal (ff148500003c0000), changing the instruction's reported size. The pure-Python decoder (tools/rdna2_decode.py) matches the assembler and hardware; its bytes and operands for this instruction are already pinned bytest_sdwa_inline_constants_and_sgpr, so the parity comparison should not encode llvm-mc's mis-sized read.The fix skips the byte/operand parity comparison for an SDWA instruction whose disassembler encoding is longer than the decoder's — i.e. only when llvm-mc actually manifests this quirk (llvm-mc 18 round-trips it correctly, so the guard is a no-op there). It is version-agnostic and only drops the coverage that
test_sdwa_inline_constants_and_sgpralready holds.Tests
Windows 11, CPython 3.15, llvm-mc 21.1.8 (via
LLVM_MC). CPU only, no GPU, no game files.python -I tests/test_rdna2_decode.py(LLVM_MC set)ps_sdwa_f16_const.asm; the remaining failure isps_w64_a_discard.asmexp(nullvsoffspecial operand), a separate issue fixed by #4697 and not touched here.python -I tests/test_rdna2_decode.py(LLVM_MC unset)python -m compileall -q tests/test_rdna2_decode.pygit diff --checkA full-corpus scan over
runtime/test/shaders/*.asmfinds 4 parity mismatches total: the one fixed here (SDWA inline constant) plus 3exp nulloperand mismatches inps_w64_a_discard.asm, which are the subject of #4697.AI-assisted. No GPU or driver used (CPU-only parity check).
Related: #4697 (fixes the separate
exp nullparity failure; the test only goes fully green once both land).