tooling: decode the remaining GFX1013 MIMG sampling, gather, packed-load and BVH ops #1066

Merged
tedin7 merged 4 commits from upstream-pr/1073 into main 2026-11-24 01:02:48 +00:00
tedin7 commented 2026-11-24 00:21:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T00:21:06Z.


Change

Refs #938.

tools/disasm_rdna2.py decoded 69 GFX1013 MIMG opcodes as image_mimg_NN. This adds them to MIMG_OPS with LLVM's spelling and operand widths:

  • sampling: the compare (_c), clamp (_cl), offset (_o), derivative (_d, _cd) and _g16 forms that were missing
  • image_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_pck
  • image_msaa_load (opcode 0x80)
  • image_bvh_intersect_ray and image_bvh64_intersect_ray (0xe6, 0xe7), with a16 and the non-sequential-address form

Decoder 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 *_unsupported with 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

  • LLVM 15 fixtures job (Assemble and translate gfx1013 fixtures, runs tests/rdna2_tools_check.py with llvm-mc-15 and libLLVM-15) passes on 96e03500, as does the platform-independent Linux job.
  • Locally with LLVM 19.1 (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).
  • Negative control: the new tests copied onto unmodified main fail (13 failing checks) and pass with the change.
  • Before writing the tests I swept opcodes 0..255 against LLVM, decoder text vs LLVM text over seven dimensions: 0 differences for the added ops.
  • Windows jobs: pending when this was written.

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_resinfo takes one address dword in LLVM, while the decoder prints the dimension width.

AI-assisted.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed (none needed).
  • I did not include game files, dumps, distribution links or secrets.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6571693887 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1073). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T00:21:06Z. --- ## Change Refs #938. `tools/disasm_rdna2.py` decoded 69 GFX1013 MIMG opcodes as `image_mimg_NN`. This adds them to `MIMG_OPS` with LLVM's spelling and operand widths: - sampling: the compare (`_c`), clamp (`_cl`), offset (`_o`), derivative (`_d`, `_cd`) and `_g16` forms that were missing - `image_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_pck` - `image_msaa_load` (opcode 0x80) - `image_bvh_intersect_ray` and `image_bvh64_intersect_ray` (0xe6, 0xe7), with `a16` and the non-sequential-address form Decoder 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 `*_unsupported` with 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 - LLVM 15 fixtures job (`Assemble and translate gfx1013 fixtures`, runs `tests/rdna2_tools_check.py` with llvm-mc-15 and libLLVM-15) passes on 96e03500, as does the platform-independent Linux job. - Locally with LLVM 19.1 (`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`). - Negative control: the new tests copied onto unmodified main fail (13 failing checks) and pass with the change. - Before writing the tests I swept opcodes 0..255 against LLVM, decoder text vs LLVM text over seven dimensions: 0 differences for the added ops. - Windows jobs: pending when this was written. ## 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_resinfo` takes one address dword in LLVM, while the decoder prints the dimension width. AI-assisted. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed (none needed). - [x] I did not include game files, dumps, distribution links or secrets.
upstream-sync closed this pull request 2026-11-24 06:46:09 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:46:09 +00:00 (Migrated from github.com)

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

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6031731588 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1073#pullrequestreview-6031731588). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:26:42Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `b3357355e6` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". 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". </details>
chatgpt-codex-connector[bot commented 2026-11-24 06:49:56 +00:00 (Migrated from github.com)

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.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T00:26:44.886224Z b335735 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117980765 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1073#issuecomment-7117980765). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:21:19Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"b3357355e697c45ee59f7439c8b78bd0b18e6c9b","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T00:26:44.886224Z">2026-11-24T00:26:44.886224Z</relative-time> | `b335735` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
R0Y00 commented 2026-11-24 06:49:56 +00:00 (Migrated from github.com)

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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118132557 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1073#issuecomment-7118132557). Originally posted by [R0Y00](https://github.com/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.
tedin7 commented 2026-11-24 06:49:57 +00:00 (Migrated from github.com)

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).

  1. BVH tuple width: one helper now maps the dword count an instruction consumes to the tuple LLVM 15 prints (up to 8 dwords as is, 9 to 15 as 16 registers), and both the MIMG sampling ops and the BVH ops use it. 019f98f100040100 now decodes to v[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.
  2. One-hot gathers: the destination is four texels of the selected component, two with d16, whatever the mask. Vectors 080120f104102303 (v[16:19]) and its d16 form (v[16:17]), plus one-hot and d16 gather masks in the round trip.
  3. BVH non-sequential addressing: the fixed-modifier check now ignores 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.py on 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7118220413 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1073#issuecomment-7118220413). Originally posted by [tedin7](https://github.com/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). 1. BVH tuple width: one helper now maps the dword count an instruction consumes to the tuple LLVM 15 prints (up to 8 dwords as is, 9 to 15 as 16 registers), and both the MIMG sampling ops and the BVH ops use it. `019f98f100040100` now decodes to `v[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. 2. One-hot gathers: the destination is four texels of the selected component, two with `d16`, whatever the mask. Vectors `080120f104102303` (`v[16:19]`) and its `d16` form (`v[16:17]`), plus one-hot and `d16` gather masks in the round trip. 3. BVH non-sequential addressing: the fixed-modifier check now ignores `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.py` on 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.
chatgpt-codex-connector[bot commented 2026-11-24 06:50:38 +00:00 (Migrated from github.com)

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 435

@@ -391,24 +397,107 @@ def format_literal32(value: int) -> str:
     0x20: ("image_sample", True, 0),
     0x21: ("image_sample_cl", True, 1),
     0x22: ("image_sample_d", True, 0),
+    0x23: ("image_sample_d_cl", True, 1),
     0x24: ("image_sample_l", True, 1),
     0x25: ("image_sample_b", True, 1),
     0x26: ("image_sample_b_cl", True, 2),
     0x27: ("image_sample_lz", True, 0),
     0x28: ("image_sample_c", True, 1),
+    0x29: ("image_sample_c_cl", True, 2),
+    0x2a: ("image_sample_c_d", True, 1),
+    0x2b: ("image_sample_c_d_cl", True, 2),
     0x2c: ("image_sample_c_l", True, 2),
     0x2d: ("image_sample_c_b", True, 2),
+    0x2e: ("image_sample_c_b_cl", True, 3),
     0x2f: ("image_sample_c_lz", True, 1),
     0x30: ("image_sample_o", True, 1),
+    0x31: ("image_sample_cl_o", True, 2),
+    0x32: ("image_sample_d_o", True, 1),
+    0x33: ("image_sample_d_cl_o", True, 2),
     0x34: ("image_sample_l_o", True, 2),
     0x35: ("image_sample_b_o", True, 2),
+    0x36: ("image_sample_b_cl_o", True, 3),
     0x37: ("image_sample_lz_o", True, 1),
+    0x38: ("image_sample_c_o", True, 2),
+    0x39: ("image_sample_c_cl_o", True, 3),
+    0x3a: ("image_sample_c_d_o", True, 2),
+    0x3b: ("image_sample_c_d_cl_o", True, 3),
+    0x3c: ("image_sample_c_l_o", True, 3),
+    0x3d: ("image_sample_c_b_o", True, 3),
+    0x3e: ("image_sample_c_b_cl_o", True, 4),
+    0x3f: ("image_sample_c_lz_o", True, 2),
     0x40: ("image_gather4", True, 0),
+    0x41: ("image_gather4_cl", True, 1),
     0x44: ("image_gather4_l", True, 1),
+    0x45: ("image_gather4_b", True, 1),
+    0x46: ("image_gather4_b_cl", True, 2),
     0x47: ("image_gather4_lz", True, 0),
+    0x48: ("image_gather4_c", True, 1),

P2 Badge Preserve the fixed destination width of newly added gathers

For 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 disassembles 080120f104102303 with destination v[16:19], but this decoder prints image_gather4_c v16, ... dmask:0x1. With d16, 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 applying d16, and cover a one-hot mask instead of testing only 0xf.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4673882646 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1073#discussion_r4673882646). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:26:42Z. **Code review location:** `tools/disasm_rdna2.py`; line 435 ~~~~diff @@ -391,24 +397,107 @@ def format_literal32(value: int) -> str: 0x20: ("image_sample", True, 0), 0x21: ("image_sample_cl", True, 1), 0x22: ("image_sample_d", True, 0), + 0x23: ("image_sample_d_cl", True, 1), 0x24: ("image_sample_l", True, 1), 0x25: ("image_sample_b", True, 1), 0x26: ("image_sample_b_cl", True, 2), 0x27: ("image_sample_lz", True, 0), 0x28: ("image_sample_c", True, 1), + 0x29: ("image_sample_c_cl", True, 2), + 0x2a: ("image_sample_c_d", True, 1), + 0x2b: ("image_sample_c_d_cl", True, 2), 0x2c: ("image_sample_c_l", True, 2), 0x2d: ("image_sample_c_b", True, 2), + 0x2e: ("image_sample_c_b_cl", True, 3), 0x2f: ("image_sample_c_lz", True, 1), 0x30: ("image_sample_o", True, 1), + 0x31: ("image_sample_cl_o", True, 2), + 0x32: ("image_sample_d_o", True, 1), + 0x33: ("image_sample_d_cl_o", True, 2), 0x34: ("image_sample_l_o", True, 2), 0x35: ("image_sample_b_o", True, 2), + 0x36: ("image_sample_b_cl_o", True, 3), 0x37: ("image_sample_lz_o", True, 1), + 0x38: ("image_sample_c_o", True, 2), + 0x39: ("image_sample_c_cl_o", True, 3), + 0x3a: ("image_sample_c_d_o", True, 2), + 0x3b: ("image_sample_c_d_cl_o", True, 3), + 0x3c: ("image_sample_c_l_o", True, 3), + 0x3d: ("image_sample_c_b_o", True, 3), + 0x3e: ("image_sample_c_b_cl_o", True, 4), + 0x3f: ("image_sample_c_lz_o", True, 2), 0x40: ("image_gather4", True, 0), + 0x41: ("image_gather4_cl", True, 1), 0x44: ("image_gather4_l", True, 1), + 0x45: ("image_gather4_b", True, 1), + 0x46: ("image_gather4_b_cl", True, 2), 0x47: ("image_gather4_lz", True, 0), + 0x48: ("image_gather4_c", True, 1), ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve the fixed destination width of newly added gathers** For 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 disassembles `080120f104102303` with destination `v[16:19]`, but this decoder prints `image_gather4_c v16, ... dmask:0x1`. With `d16`, 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 applying `d16`, and cover a one-hot mask instead of testing only `0xf`. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-24 06:50:38 +00:00 (Migrated from github.com)

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 1764

@@ -1664,6 +1753,26 @@ def source(code: int, index: int) -> str:
     return (8, name, asm, comment)
 
 
+def _decode_mimg_bvh(op: int, w0: int, w1: int, length: int) -> tuple[int, str, str, str]:
+    """Decode image_bvh_intersect_ray and image_bvh64_intersect_ray.
+
+    The hardware fixes every modifier field of these ops, so anything else is
+    reported as unsupported with the record length intact.
+    """
+    op_name, addr_dwords, addr_dwords_a16 = MIMG_BVH_OPS[op]
+    a16 = (w1 >> 30) & 1
+    if (w0 & ~(0x7f << 18)) != MIMG_BVH_W0 or (w1 >> 31) or (w1 >> 21) & 0x1f:

P2 Badge Decode valid NSA operand lists for the new BVH instructions

For 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 accepts 079f98f100040100020406080a0c0e1012140000 as a valid 20-byte NSA image_bvh_intersect_ray, whereas this branch returns image_bvh_intersect_ray_unsupported. The same rejection affects image_bvh64_intersect_ray and their a16 NSA forms, so valid instructions using these encodings lose all decoded operands. Exclude nsize from the fixed-modifier check and decode the appended VGPR bytes instead of always constructing a contiguous range.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4673882653 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1073#discussion_r4673882653). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T00:26:42Z. **Code review location:** `tools/disasm_rdna2.py`; line 1764 ~~~~diff @@ -1664,6 +1753,26 @@ def source(code: int, index: int) -> str: return (8, name, asm, comment) +def _decode_mimg_bvh(op: int, w0: int, w1: int, length: int) -> tuple[int, str, str, str]: + """Decode image_bvh_intersect_ray and image_bvh64_intersect_ray. + + The hardware fixes every modifier field of these ops, so anything else is + reported as unsupported with the record length intact. + """ + op_name, addr_dwords, addr_dwords_a16 = MIMG_BVH_OPS[op] + a16 = (w1 >> 30) & 1 + if (w0 & ~(0x7f << 18)) != MIMG_BVH_W0 or (w1 >> 31) or (w1 >> 21) & 0x1f: ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Decode valid NSA operand lists for the new BVH instructions** For 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 accepts `079f98f100040100020406080a0c0e1012140000` as a valid 20-byte NSA `image_bvh_intersect_ray`, whereas this branch returns `image_bvh_intersect_ray_unsupported`. The same rejection affects `image_bvh64_intersect_ray` and their `a16` NSA forms, so valid instructions using these encodings lose all decoded operands. Exclude `nsize` from the fixed-modifier check and decode the appended VGPR bytes instead of always constructing a contiguous range. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1066
No description provided.