shader: lower aligned gfx1030 packed D16 typed-buffer loads #1211

Manually merged
github merged 3 commits from gh-pr/1211/head into gh-pr/1211/base 2026-11-26 22:49:18 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-24 03:34 UTC · original
stan495:codex/gfx1030-tbuffer-load-format-d16-upstream → main · +68 −11 · 4 files · 3 commits · merged 2026-11-24 05:11 UTC

Scope

Add the gfx1030 tbuffer_load_format_d16_{x,xy,xyz,xyzw} forms for packed 16-bit UINT. An odd count requires an explicit low-half mask before consuming the last VGPR as a full word. Reads require aligned, in-range, read-only bindings and an observed vmcnt(0) wait.

#1206 has merged. The only commit unique to this branch against main is the D16 load change. #1207 edits the adjacent store matcher, so the second D16 PR may need a branch refresh after the first merges.

Validation

Tested 4e1775cb97bb8728b0782428ac0c4c2683baf81a on Windows 11 25H2 build 26200.9974 with the D3D12 debug layer enabled. The adapters were RX 7900 XTX driver 32.0.32029.2010 and Microsoft WARP 10.0.26100.9818.

  • cmake --preset dev -DINTAKE_PYTHON=<dev-python> and cmake --build --preset dev --target offscreen_check passed.
  • ctest --preset dev --no-tests=error -R '^compute_store_aot_(mtbuf_load|guard_read)_' -V reported 4 passes, zero failures and zero skips. Swapping packed halves changes word 1 from 8b06bba2 to bba28b06 for xy, xyz and xyzw. For x, it changes word 1 from 0000bba2 to bba20000.
  • python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 passed on LLVM 15.0.7.
  • python -B tests/form_coverage_check.py, python -B tests/docs_links_check.py and python -B tests/bidi_controls_check.py passed. python -B tools/form_coverage.py out/results.xml recorded the new instruction forms from passing readbacks.

The GPU measurements execute translated desktop DXIL against CPU references.

A local integration checkout, 8b8a60a4d025ffbf06d0a9550642a0c8fbcfcc3b, kept the D16 load bookkeeping and the D16 store matcher when resolving their adjacent edits. ctest --preset dev --no-tests=error -R '^compute_store_aot_(mtbuf_(load|store)|guard_read)_' -V reported 6 passes, zero failures and zero skips on WARP and RX 7900 XTX. The passing readbacks recorded all 16 gfx1030 MTBUF forms.

**@⁠stan495** on GitHub · 2026-11-24 03:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1211) `stan495:codex/gfx1030-tbuffer-load-format-d16-upstream` → `main` · +68 −11 · 4 files · 3 commits · merged 2026-11-24 05:11 UTC ## Scope Add the gfx1030 `tbuffer_load_format_d16_{x,xy,xyz,xyzw}` forms for packed 16-bit UINT. An odd count requires an explicit low-half mask before consuming the last VGPR as a full word. Reads require aligned, in-range, read-only bindings and an observed `vmcnt(0)` wait. #1206 has merged. The only commit unique to this branch against `main` is the D16 load change. #1207 edits the adjacent store matcher, so the second D16 PR may need a branch refresh after the first merges. ## Validation Tested `4e1775cb97bb8728b0782428ac0c4c2683baf81a` on Windows 11 25H2 build 26200.9974 with the D3D12 debug layer enabled. The adapters were RX 7900 XTX driver 32.0.32029.2010 and Microsoft WARP 10.0.26100.9818. - `cmake --preset dev -DINTAKE_PYTHON=<dev-python>` and `cmake --build --preset dev --target offscreen_check` passed. - `ctest --preset dev --no-tests=error -R '^compute_store_aot_(mtbuf_load|guard_read)_' -V` reported 4 passes, zero failures and zero skips. Swapping packed halves changes word 1 from 8b06bba2 to bba28b06 for xy, xyz and xyzw. For x, it changes word 1 from 0000bba2 to bba20000. - `python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1` passed on LLVM 15.0.7. - `python -B tests/form_coverage_check.py`, `python -B tests/docs_links_check.py` and `python -B tests/bidi_controls_check.py` passed. `python -B tools/form_coverage.py out/results.xml` recorded the new instruction forms from passing readbacks. The GPU measurements execute translated desktop DXIL against CPU references. A local integration checkout, `8b8a60a4d025ffbf06d0a9550642a0c8fbcfcc3b`, kept the D16 load bookkeeping and the D16 store matcher when resolving their adjacent edits. `ctest --preset dev --no-tests=error -R '^compute_store_aot_(mtbuf_(load|store)|guard_read)_' -V` reported 6 passes, zero failures and zero skips on WARP and RX 7900 XTX. The passing readbacks recorded all 16 gfx1030 MTBUF forms.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:49:16 +00:00
github manually merged commit 709ecf630a into gh-pr/1211/base 2026-11-26 22:49:18 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 03:45 UTC · original · reviewed

Reviewed 4e1775cb (stacked on #1206 de3b1b26) on Linux (Windows build and D3D12 ctest execution were not run locally).

Diff audit (D16-specific changes on top of #1206)

  • tools/compute_store_aot.py: adds tbuffer_load_format_d16_{x,xy,xyz,xyzw} lowering (cpu == "gfx1030", idxen, no offen).
    • Maps x/xy/xyz/xyzw to BUF_FMT_16_UINT, BUF_FMT_16_16_UINT, BUF_FMT_16_16_16_16_UINT (for xyz and xyzw), with count = (components + 1) // 2 DWORDs and offset + 4 * count <= source_stride.
    • Marks the trailing VGPR of odd-count loads (d16_x, d16_xyz) as source_low16 in loading, preventing whole-word consumption before or after s_waitcnt vmcnt(0); only v_and_b32_e32 vdst, 0xffff|65535, vsrc promotes it to ("alu", "(inputData.Load(...) & 0xffffu)").
  • tests/compute_store_check.py: adds mtbuf_load_d16_{x,xy,xyz,xyzw} cases, negative controls (format, pre-wait use, unaligned offset:2, missing 0xffff mask, 0x1ffff mask), and half-swap mutants.
  • README.md and docs/experiments.md: consistent and title-neutral. Note: rebase onto main after #1206 merges.

Linux checks (/root/.local/share/x2w-rev-venv/bin/python -B)

  • tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed (0 failures)
  • tests/form_coverage_check.py: passed
  • tests/docs_links_check.py: passed (15 Markdown files, 268 links)
  • tests/bidi_controls_check.py: passed (977 files)
  • Windows offscreen_check and ctest -R '^compute_store_aot_(mtbuf_load|guard_read)_' not run locally.
**@⁠tedin7** on GitHub · 2026-11-24 03:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1211#pullrequestreview-6033342311) · **reviewed** Reviewed `4e1775cb` (stacked on #1206 `de3b1b26`) on Linux (Windows build and D3D12 `ctest` execution were not run locally). ### Diff audit (D16-specific changes on top of #1206) - `tools/compute_store_aot.py`: adds `tbuffer_load_format_d16_{x,xy,xyz,xyzw}` lowering (`cpu == "gfx1030"`, `idxen`, no `offen`). - Maps `x`/`xy`/`xyz`/`xyzw` to `BUF_FMT_16_UINT`, `BUF_FMT_16_16_UINT`, `BUF_FMT_16_16_16_16_UINT` (for `xyz` and `xyzw`), with `count = (components + 1) // 2` DWORDs and `offset + 4 * count <= source_stride`. - Marks the trailing VGPR of odd-count loads (`d16_x`, `d16_xyz`) as `source_low16` in `loading`, preventing whole-word consumption before or after `s_waitcnt vmcnt(0)`; only `v_and_b32_e32 vdst, 0xffff|65535, vsrc` promotes it to `("alu", "(inputData.Load(...) & 0xffffu)")`. - `tests/compute_store_check.py`: adds `mtbuf_load_d16_{x,xy,xyz,xyzw}` cases, negative controls (format, pre-wait use, unaligned `offset:2`, missing `0xffff` mask, `0x1ffff` mask), and half-swap mutants. - `README.md` and `docs/experiments.md`: consistent and title-neutral. Note: rebase onto `main` after #1206 merges. ### Linux checks (`/root/.local/share/x2w-rev-venv/bin/python -B`) - `tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: passed (0 failures) - `tests/form_coverage_check.py`: passed - `tests/docs_links_check.py`: passed (15 Markdown files, 268 links) - `tests/bidi_controls_check.py`: passed (977 files) - Windows `offscreen_check` and `ctest -R '^compute_store_aot_(mtbuf_load|guard_read)_'` not run locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.