Repository navigation
rdna2_decode: support GFX10.1 v_mul_lo_i32 - #3
tahffo68hk-hash wants to merge 7 commits into
Conversation
The decoder's tables carry the GFX10.3 names, but one encoding has two names depending on the target: GFX10.1 (the console, gfx1013) spells the legacy multiply-accumulate ops without the fused prefix. llvm-mc prints v_mac_legacy_f32 where the tables say v_fmac_legacy_f32 (VOP2 0x06, VOP3 0x106) and v_mad_legacy_f32 where they say v_fma_legacy_f32 (VOP3 0x140). Thread the target through decode_bytes() and disasm_bytes() (default gfx1013), name those three opcodes per target, and pass shader_disasm's --mcpu to its Python backend.
The new target parameter accepted anything: `--backend python --mcpu gfx1100` (the Python tools need no llvm-mc, so nothing else rejected it) decoded RDNA2 tables and reported the shader "clean", with the GFX10.3 opcode names for a GFX11 target. decode_bytes() now raises for a target outside gfx101*/gfx103*, and the CLI stops with exit 2 before it reads a shader.
`gfx101`/`gfx103` prefixes let near-misses through, and llvm-mc accepts gfx1014 and gfx1037 as CPU names without complaint, so nothing else rejects them either: `--backend python --mcpu gfx1037` exited 0 on main and would still have been accepted with a prefix. The guard now lists the parts the tables describe (gfx1010-1013, gfx1030-1036) and names them in the error.
A listing is only reusable for the target it was written for, but the check was "non-empty file", so `--mcpu gfx1030 --skip-existing` kept a listing disassembled as gfx1013 and reported it as reused, even though opcode 0x140 has a different mnemonic there. Match the target recorded in the listing header.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
200a4c3 to
1d16b2a
Compare
(cherry picked from commit b99aa97)
The current parent and the unchanged v_mul_lo_i32 patch supply the resulting tree. Keep the prior published head as ancestry so the fork update can fast-forward.
|
I updated this patch for the rebased parent at 我已将该补丁同步到重基后的父分支 |
Summary
Add the missing VOP3
0x16boperand entry. The Python decoder reuses the target passed through by ProjectLeonida#4928. GFX10.1 (gfx1010–gfx1013) decodesv_mul_lo_i32with one VGPR destination and two sources. GFX10.3 (gfx1030–gfx1036) rejects the encoding and skips all of its words, including a literal when present. Synthetic regressions also check the adjacent0x169,0x16a, and0x16copcodes.mcpusupport).Tests
python -I tests/test_rdna2_decode.py -k vop3 -vreproduced missing GFX10.1 decoding and a literal interpreted as an instruction on GFX10.3 before the fix. Both regressions pass with the patch.python -I tests/test_rdna2_decode.py -v— 13 passed, 1 skipped (localllvm-mcunavailable).python -I tests/test_shader_disasm.py -v— 22 passed.python -I tests/test_rdna2spirv_decode.py -v— 24 passed.python -I tests/test_rdna2spirv_merge.py -v— 26 passed.python -m compileall -q make_game.py tools testsandgit diff --check— passed.LLVM 21’s AMDGPU opcode definitions confirm
0x16bunderisGFX10Before1030. Validation was CPU-only.AI-assisted. Synthetic fixtures only.
概述
补上缺失的 VOP3
0x16b操作数条目。Python 解码器复用 ProjectLeonida#4928 传入的目标架构。GFX10.1(gfx1010–gfx1013)将其解码为v_mul_lo_i32,解析一个 VGPR 目标和两个源操作数。GFX10.3(gfx1030–gfx1036)会拒绝该编码并跳过它的所有字,包括存在的字面量。合成回归测试还检查了相邻的0x169、0x16a和0x16c操作码。mcpu支持)。测试
python -I tests/test_rdna2_decode.py -k vop3 -v在修复前复现了 GFX10.1 解码缺失及 GFX10.3 把字面量误当成指令的问题。两个回归用例在补丁上均通过。python -I tests/test_rdna2_decode.py -v— 13 项通过,1 项跳过(本机缺少llvm-mc)。python -I tests/test_shader_disasm.py -v— 22 项通过。python -I tests/test_rdna2spirv_decode.py -v— 24 项通过。python -I tests/test_rdna2spirv_merge.py -v— 26 项通过。python -m compileall -q make_game.py tools tests和git diff --check均通过。LLVM 21 的 AMDGPU 操作码定义 确认
0x16b受isGFX10Before1030限制。本轮验证只在 CPU 上运行。AI-assisted(AI 辅助)。Synthetic fixtures only(仅使用合成测试输入)。