tooling: decode the remaining GFX1013 MIMG sampling, gather, packed-load and BVH ops #1066
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1073"
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 tedin7 on 2026-11-24T00:21:06Z.
Change
Refs #938.
tools/disasm_rdna2.pydecoded 69 GFX1013 MIMG opcodes asimage_mimg_NN. This adds them toMIMG_OPSwith LLVM's spelling and operand widths:_c), clamp (_cl), offset (_o), derivative (_d,_cd) and_g16forms that were missingimage_gather4_*(the 24 forms in the coverage table; a gather returns four texels whatever the one-hot dmask)image_load_pck*,image_load_mip_pck*,image_store_pck,image_store_mip,image_store_mip_pckimage_msaa_load(opcode 0x80)image_bvh_intersect_rayandimage_bvh64_intersect_ray(0xe6, 0xe7), witha16and the non-sequential-address formDecoder changes outside the table: the opcode now includes word 0 bit 0 (needed for opcodes >= 0x80), the derivative address count is table-driven (
MIMG_DERIV_OPS,MIMG_G16_DERIV_OPS), a packed address of 9 to 15 dwords is printed as the 16-register tuple LLVM 15 uses, and BVH words with modifier bits the encoding fixes are reported as*_unsupportedwith the record length kept. No existing opcode row, translator or scanner rule changes.Overlap: #977 (merged) covered the atomics; #1062 changes decoding after
s_endpgm, which this does not touch.Verification
Assemble and translate gfx1013 fixtures, runstests/rdna2_tools_check.pywith llvm-mc-15 and libLLVM-15) passes on96e03500, as does the platform-independent Linux job.LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python3 -B tests/rdna2_tools_check.py) the new tests pass; 3 older tests fail the same way on unmodified main with LLVM 19 (test_interp_f16_llvm_round_trip,test_llvm_comparison,test_source_built_records_after_s_endpgm).Evidence and follow-up
Fixtures are synthetic words built from the opcode and field layout and checked against LLVM, no external data.
Assumptions: dimension 7 (2D MSAA array) is left out of the LLVM comparison because LLVM decodes five-or-more-dword addresses there into a different operand shape. Not changed here:
image_get_resinfotakes one address dword in LLVM, while the decoder prints the dimension width.AI-assisted.
Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:26:42Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
b3357355e6ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:21:19Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
b335735ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T00:30:01Z.
I reran all 101 decoder tests against CI-pinned LLVM 15.0.7 on
580adbcc. The only failure is the BVH part of the new round-trip test. The first word pair 019f98f100040100 prints image_bvh_intersect_ray with v[0:10] in Python and v[0:15] in LLVM 15. Apply the packed-address spelling policy consistently to BVH, and distinguish that printed tuple width from the number of address dwords consumed by the instruction. Please cover the one-hot gather and NSA findings in the existing threads on the same revision, then rerun LLVM 15. Keeping valid unsupported variants explicit is fine if the PR scope and tests say which forms are still excluded.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T00:35:06Z.
Pushed a revision of the branch (
96e03500) with all three points, rerun locally with LLVM 19 (I do not have LLVM 15 here, so the CI Ubuntu job is the LLVM 15 check).019f98f100040100now decodes tov[0:15]; the golden vectors changed accordingly. The LLVM round trip compares the decoder's output as is and widens a newer LLVM's exact spelling.d16, whatever the mask. Vectors080120f104102303(v[16:19]) and itsd16form (v[16:17]), plus one-hot andd16gather masks in the round trip.w0[2:1], and the appended bytes give one VGPR per address dword (079f98f1...decodes to an 11-entry list). The round trip includes that form against LLVM. Nothing in scope is left excluded for BVH.Local result:
python3 -B tests/rdna2_tools_check.pyon LLVM 19: the MIMG and BVH tests pass. Three tests fail the same way on the previous commit with LLVM 19 (test_interp_f16_llvm_round_trip,test_llvm_comparison,test_source_built_records_after_s_endpgm), so they are not from this change; I could not check them against LLVM 15.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:26:42Z.
Code review location:
tools/disasm_rdna2.py; line 435For a normal one-hot gather mask, these new entries use the generic
popcount(dmask)result width, although a gather returns four texels of the selected component. For example, LLVM 20 targeting gfx1013 assembles and disassembles080120f104102303with destinationv[16:19], but this decoder printsimage_gather4_c v16, ... dmask:0x1. Withd16, the destination should span two VGPRs rather than one. Consequently, the newly supported gather forms produce incorrect, non-round-trippable assembly for their usual masks. Give gathers a fixed four-component result width before applyingd16, and cover a one-hot mask instead of testing only0xf.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T00:26:42Z.
Code review location:
tools/disasm_rdna2.py; line 1764For a BVH instruction using non-sequential addressing,
w0[2:1]contains a nonzero NSA length, but this equality treats those address-encoding bits as illegal modifiers. LLVM 20 targeting gfx1013 accepts079f98f100040100020406080a0c0e1012140000as a valid 20-byte NSAimage_bvh_intersect_ray, whereas this branch returnsimage_bvh_intersect_ray_unsupported. The same rejection affectsimage_bvh64_intersect_rayand theira16NSA forms, so valid instructions using these encodings lose all decoded operands. Excludensizefrom the fixed-modifier check and decode the appended VGPR bytes instead of always constructing a contiguous range.Useful? React with 👍 / 👎.