disasm_rdna2: decode 64-bit MUBUF and MTBUF buffer instructions #579

Manually merged
github merged 2 commits from gh-pr/579/head into gh-pr/579/base 2026-11-26 22:03:23 +00:00
Owner

@⁠Neoplayer on GitHub · 2026-11-22 13:57 UTC · original
Neoplayer:disasm/mubuf-mtbuf → main · +447 −3 · 3 files · 2 commits · merged 2026-11-22 15:25 UTC

Change

Add decoding for 64-bit RDNA 2 (gfx1013) MUBUF (prefix 0xe0000000, 72 opcodes) and MTBUF (prefix 0xe8000000, 16 opcodes) memory instructions in tools/disasm_rdna2.py, and synchronize tools/scan_unsupported_shaders.py:

  1. tools/disasm_rdna2.py:
    • Add MUBUF_OPS covering all 72 gfx1013 MUBUF forms (format/untyped/d16 loads and stores, 32-bit and 64-bit _x2 atomics, buffer_gl0_inv, buffer_gl1_inv).
    • Add MTBUF_OPS covering all 16 gfx1013 MTBUF forms (4-bit opcode split across w0[18:16] and w1[21]) and MTBUF_FORMATS (0 = BUF_FMT_INVALID, 1 omitted as LLVM default BUF_FMT_8_UNORM, 2..77 named BUF_FMT_*, 78..127 printed numerically).
    • Extract shared _format_vgpr_range(), _format_srsrc4() (s[n:n+3] and ttmp[0:3]..ttmp[12:15]), and _format_buffer_operands_and_mods() handling idxen/offen/off, 12-bit unsigned offset, glc/slc/dlc, lds (omitting vdata on non-d16 loads), tfe (omitted on atomics), scalar soffset, and truncated encodings (mubuf_truncated, mtbuf_truncated).
  2. tools/scan_unsupported_shaders.py:
    • Register all 88 MUBUF and MTBUF mnemonics in KNOWN_RDNA2_BASE_OPCODES and include tbuffer_ in VMEM (Vector Memory / Buffer) in classify_isa_category().
  3. tests/rdna2_tools_check.py:
    • Add 21 LLVM-15-assembled gfx1013 golden vectors (test_golden_vectors), synthetic sweeps over all 72 MUBUF + 16 MTBUF opcodes + all MTBUF formats (test_mubuf_opcode_table_synthetic_forms, test_mtbuf_opcode_table_synthetic_forms), modifier/ttmp distinction checks (test_mubuf_mtbuf_distinguishes_modifiers), truncation & alignment checks, and exact-assembly LLVM 15 comparison (test_llvm_comparison).

Verification

Commit under test: 25f3d13 on macOS arm64 (verified against official upstream llvm/llvm-project llvmorg-15.0.7 BUFInstructions.td definitions and local Homebrew LLVM 15.0.7 -mcpu=gfx1013):

  • LLVM_LIB=libLLVM-15.dylib LLVM_MC=llvm-mc LLVM_OBJCOPY=llvm-objcopy python3 -B tests/rdna2_tools_check.py: Ran 45 tests in 0.336s - OK (0 skips).
  • Cross-check script against pixel_aot.disassemble(..., libLLVM-15.dylib) across all 72 MUBUF ops, all 16 MTBUF ops, all 128 MTBUF format IDs (0..127), and srsrc indices 0..25 + 27..30 (ttmp[0:3]..ttmp[12:15]): Checked 246 encodings against LLVM 15: mismatches=0.
  • python3 -B tests/form_coverage_check.py: form coverage checks passed.
  • python3 -B tests/shader_probe_check.py: 9 control checks passed.
  • python3 -B tests/pso_readiness_check.py: PSO census, evidence states, and native hash control passed.
  • python3 -B tests/docs_links_check.py: Self-test passed. Checked 10 Markdown files and 119 links.
  • python3 -B tests/bidi_controls_check.py: Self-test passed. Checked 554 tracked source, script and build/CI files: no bidirectional controls.
  • git diff --check: exit 0.

MSVC, D3D12, and WARP builds (cmake --preset dev) were not run on this macOS host and remain covered by Windows CI.

Evidence and follow-up

All fixtures are source-built synthetic sequences assembled and checked against LLVM 15.0.7 -mcpu=gfx1013. Decoding FLAT/GLOBAL/SCRATCH (0xdc000000) is tracked as a separate follow-up PR.

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. (No docs or build requirements changed.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

**@⁠Neoplayer** on GitHub · 2026-11-22 13:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/579) `Neoplayer:disasm/mubuf-mtbuf` → `main` · +447 −3 · 3 files · 2 commits · merged 2026-11-22 15:25 UTC ## Change Add decoding for 64-bit RDNA 2 (`gfx1013`) MUBUF (prefix `0xe0000000`, 72 opcodes) and MTBUF (prefix `0xe8000000`, 16 opcodes) memory instructions in `tools/disasm_rdna2.py`, and synchronize `tools/scan_unsupported_shaders.py`: 1. `tools/disasm_rdna2.py`: - Add `MUBUF_OPS` covering all 72 `gfx1013` MUBUF forms (format/untyped/d16 loads and stores, 32-bit and 64-bit `_x2` atomics, `buffer_gl0_inv`, `buffer_gl1_inv`). - Add `MTBUF_OPS` covering all 16 `gfx1013` MTBUF forms (4-bit opcode split across `w0[18:16]` and `w1[21]`) and `MTBUF_FORMATS` (`0` = `BUF_FMT_INVALID`, `1` omitted as LLVM default `BUF_FMT_8_UNORM`, `2..77` named `BUF_FMT_*`, `78..127` printed numerically). - Extract shared `_format_vgpr_range()`, `_format_srsrc4()` (`s[n:n+3]` and `ttmp[0:3]..ttmp[12:15]`), and `_format_buffer_operands_and_mods()` handling `idxen`/`offen`/`off`, 12-bit unsigned `offset`, `glc`/`slc`/`dlc`, `lds` (omitting `vdata` on non-d16 loads), `tfe` (omitted on atomics), scalar `soffset`, and truncated encodings (`mubuf_truncated`, `mtbuf_truncated`). 2. `tools/scan_unsupported_shaders.py`: - Register all 88 MUBUF and MTBUF mnemonics in `KNOWN_RDNA2_BASE_OPCODES` and include `tbuffer_` in `VMEM (Vector Memory / Buffer)` in `classify_isa_category()`. 3. `tests/rdna2_tools_check.py`: - Add 21 LLVM-15-assembled `gfx1013` golden vectors (`test_golden_vectors`), synthetic sweeps over all 72 MUBUF + 16 MTBUF opcodes + all MTBUF formats (`test_mubuf_opcode_table_synthetic_forms`, `test_mtbuf_opcode_table_synthetic_forms`), modifier/ttmp distinction checks (`test_mubuf_mtbuf_distinguishes_modifiers`), truncation & alignment checks, and exact-assembly LLVM 15 comparison (`test_llvm_comparison`). ## Verification Commit under test: `25f3d13` on macOS arm64 (verified against official upstream `llvm/llvm-project` `llvmorg-15.0.7` `BUFInstructions.td` definitions and local Homebrew LLVM 15.0.7 `-mcpu=gfx1013`): - `LLVM_LIB=libLLVM-15.dylib LLVM_MC=llvm-mc LLVM_OBJCOPY=llvm-objcopy python3 -B tests/rdna2_tools_check.py`: `Ran 45 tests in 0.336s - OK` (0 skips). - Cross-check script against `pixel_aot.disassemble(..., libLLVM-15.dylib)` across all 72 MUBUF ops, all 16 MTBUF ops, all 128 MTBUF format IDs (`0..127`), and `srsrc` indices `0..25` + `27..30` (`ttmp[0:3]..ttmp[12:15]`): `Checked 246 encodings against LLVM 15: mismatches=0`. - `python3 -B tests/form_coverage_check.py`: `form coverage checks passed`. - `python3 -B tests/shader_probe_check.py`: 9 control checks passed. - `python3 -B tests/pso_readiness_check.py`: `PSO census, evidence states, and native hash control passed`. - `python3 -B tests/docs_links_check.py`: `Self-test passed. Checked 10 Markdown files and 119 links.` - `python3 -B tests/bidi_controls_check.py`: `Self-test passed. Checked 554 tracked source, script and build/CI files: no bidirectional controls.` - `git diff --check`: exit 0. MSVC, D3D12, and WARP builds (`cmake --preset dev`) were not run on this macOS host and remain covered by Windows CI. ## Evidence and follow-up All fixtures are source-built synthetic sequences assembled and checked against LLVM 15.0.7 `-mcpu=gfx1013`. Decoding `FLAT`/`GLOBAL`/`SCRATCH` (`0xdc000000`) is tracked as a separate follow-up PR. ## 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. - [ ] I updated README/docs when a capability or build requirement changed. (No docs or build requirements changed.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:03:21 +00:00
github manually merged commit 5812dfa9c2 into gh-pr/579/base 2026-11-26 22:03:23 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.