shader: lower aligned gfx1030 packed D16 typed-buffer stores #1200

Merged
stan495 merged 1 commit from upstream-pr/1207 into main 2026-11-24 05:02:19 +00:00
stan495 commented 2026-11-24 03:33:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T03:33:21Z.


Scope

Add D16 x, xy, xyz and xyzw for packed 16-bit UINT. Odd counts preserve the last high half using an invocation-exclusive DWORD. Verify record ownership and assume no concurrent access and dispatch only along the indexed axis.

Follow-up to #1179. Rebased after #1206 merged, preserving the multichannel load bookkeeping. #1211 edits the adjacent load branch, so the second D16 PR may need a branch refresh after the first merges.

Validation

Tested e5f4acf2d8ee0fdea45b03da2329c6a58b37b376 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|store)|guard_read)_' -V reported 6 passes, zero failures and zero skips. Clearing the preserved half changes word 1 from c5c54567 to 00004567 for x and word 2 from c5c5cdef to 0000cdef for xyz.
  • 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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6574004080 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1207). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T03:33:21Z. --- ## Scope Add D16 x, xy, xyz and xyzw for packed 16-bit UINT. Odd counts preserve the last high half using an invocation-exclusive DWORD. Verify record ownership and assume no concurrent access and dispatch only along the indexed axis. Follow-up to #1179. Rebased after #1206 merged, preserving the multichannel load bookkeeping. #1211 edits the adjacent load branch, so the second D16 PR may need a branch refresh after the first merges. ## Validation Tested `e5f4acf2d8ee0fdea45b03da2329c6a58b37b376` 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|store)|guard_read)_' -V` reported 6 passes, zero failures and zero skips. Clearing the preserved half changes word 1 from c5c54567 to 00004567 for x and word 2 from c5c5cdef to 0000cdef for xyz. - `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.
upstream-sync closed this pull request 2026-11-24 06:46:55 +00:00
tedin7 commented 2026-11-24 06:46:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T03:45:30Z.

Review: COMMENTED


Reviewed 79beeb8c on Linux (Windows build and D3D12 ctest execution were not run locally).

Diff audit

  • tools/compute_store_aot.py: adds tbuffer_store_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.
    • Enforces DWORD-aligned offset (offset % 4 == 0), offset + 4 * count <= stride, and reserves the full [offset, offset + 4 * count) span in written_spans so no overlapping store can share the final DWORD.
    • For odd counts (d16_x, d16_xyz), performs (outputData.Load(final_address) & 0xffff0000u) | (words[-1] & 0xffffu) to preserve the high 16 bits, relying on single-axis indexed dispatch and no concurrent UAV access (documented in docs/experiments.md).
  • tests/compute_store_check.py: adds mtbuf_store_d16_{x,xy,xyz,xyzw} cases, negative controls, half-swap mutants, and & 0u high-half-clear mutants for odd counts.
  • README.md and docs/experiments.md: consistent and title-neutral. Cleanly disjoint from #1206 and #1211.

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_store|guard_read)_' not run locally.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033342160 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1207#pullrequestreview-6033342160). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:45:30Z. **Review:** COMMENTED --- Reviewed `79beeb8c` on Linux (Windows build and D3D12 `ctest` execution were not run locally). ### Diff audit - `tools/compute_store_aot.py`: adds `tbuffer_store_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. - Enforces DWORD-aligned `offset` (`offset % 4 == 0`), `offset + 4 * count <= stride`, and reserves the full `[offset, offset + 4 * count)` span in `written_spans` so no overlapping store can share the final DWORD. - For odd counts (`d16_x`, `d16_xyz`), performs `(outputData.Load(final_address) & 0xffff0000u) | (words[-1] & 0xffffu)` to preserve the high 16 bits, relying on single-axis indexed dispatch and no concurrent UAV access (documented in `docs/experiments.md`). - `tests/compute_store_check.py`: adds `mtbuf_store_d16_{x,xy,xyz,xyzw}` cases, negative controls, half-swap mutants, and `& 0u` high-half-clear mutants for odd counts. - `README.md` and `docs/experiments.md`: consistent and title-neutral. Cleanly disjoint from #1206 and #1211. ### 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_store|guard_read)_'` not run locally.
tedin7 commented 2026-11-24 06:46:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:48:09Z.

Review: COMMENTED


Retested e5f4acf2 (delta 79beeb8c..e5f4acf2, merge/rebase onto main) on Linux. Windows build and D3D12 ctest execution were not run locally.

Delta audit (79beeb8c..e5f4acf2)

  • No changes to the PR's own files (README.md, docs/experiments.md, tests/compute_store_check.py, tools/compute_store_aot.py) relative to 79beeb8c; the delta only pulls in main updates (#1206, #1209, #1210, #1218, #1221, etc.).
  • tbuffer_store_format_d16_{x,xy,xyz,xyzw} lowering, odd-count high-half preservation (& 0xffff0000u), span reservation, and test mutants remain intact and title-neutral.

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

  • tests/compute_store_check.py binary /usr/bin/llvm-mc-19 /usr/bin/llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed (0 failures, exit 0)
  • tests/form_coverage_check.py: passed (form coverage checks passed, exit 0)
  • tests/docs_links_check.py: passed (16 Markdown files, 278 links, exit 0)
  • tests/bidi_controls_check.py: passed (1038 tracked files, exit 0)
  • git diff --check origin/main..HEAD: passed (exit 0)
  • Windows offscreen_check and ctest -R '^compute_store_aot_': not run locally.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033788560 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1207#pullrequestreview-6033788560). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:48:09Z. **Review:** COMMENTED --- Retested `e5f4acf2` (delta `79beeb8c..e5f4acf2`, merge/rebase onto `main`) on Linux. Windows build and D3D12 `ctest` execution were not run locally. ### Delta audit (`79beeb8c..e5f4acf2`) - No changes to the PR's own files (`README.md`, `docs/experiments.md`, `tests/compute_store_check.py`, `tools/compute_store_aot.py`) relative to `79beeb8c`; the delta only pulls in `main` updates (`#1206`, `#1209`, `#1210`, `#1218`, `#1221`, etc.). - `tbuffer_store_format_d16_{x,xy,xyz,xyzw}` lowering, odd-count high-half preservation (`& 0xffff0000u`), span reservation, and test mutants remain intact and title-neutral. ### Linux checks (`/root/.local/share/x2w-rev-venv/bin/python -B`) - `tests/compute_store_check.py binary /usr/bin/llvm-mc-19 /usr/bin/llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: **passed** (0 failures, exit 0) - `tests/form_coverage_check.py`: **passed** (`form coverage checks passed`, exit 0) - `tests/docs_links_check.py`: **passed** (16 Markdown files, 278 links, exit 0) - `tests/bidi_controls_check.py`: **passed** (1038 tracked files, exit 0) - `git diff --check origin/main..HEAD`: **passed** (exit 0) - Windows `offscreen_check` and `ctest -R '^compute_store_aot_'`: **not run locally**.
tedin7 commented 2026-11-24 06:50:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T04:37:50Z.


Windows Server 2025 retest at 79beeb8c (Windows Server 2025 Build 26100, MSVC 14.44.35207, AMD Ryzen 5 PRO 5650U, WARP):

Debug (dev preset)

Commands:

cmake --build --preset dev --target offscreen_check -- -j 6
ctest --preset dev -R "^compute_store_aot" --no-tests=error --output-on-failure

Results: 26 passed, 0 failed, 0 skipped (Total Test time: 151.19 sec, including compute_store_aot_mtbuf_store_hardware (4.29 sec) and compute_store_aot_mtbuf_store_warp (4.02 sec)).

Release (/O2, release preset)

Commands:

cmake --build --preset release --target offscreen_check -- -j 6
ctest --preset release -R "^compute_store_aot" --no-tests=error --output-on-failure

Results: 26 passed, 0 failed, 0 skipped (Total Test time: 174.34 sec, including compute_store_aot_mtbuf_store_hardware (5.72 sec) and compute_store_aot_mtbuf_store_warp (6.47 sec)).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7122195222 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1207#issuecomment-7122195222). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T04:37:50Z. --- Windows Server 2025 retest at `79beeb8c` (`Windows Server 2025 Build 26100, MSVC 14.44.35207, AMD Ryzen 5 PRO 5650U, WARP`): ### Debug (`dev` preset) Commands: ```powershell cmake --build --preset dev --target offscreen_check -- -j 6 ctest --preset dev -R "^compute_store_aot" --no-tests=error --output-on-failure ``` Results: **26 passed, 0 failed, 0 skipped** (Total Test time: `151.19 sec`, including `compute_store_aot_mtbuf_store_hardware` (`4.29 sec`) and `compute_store_aot_mtbuf_store_warp` (`4.02 sec`)). ### Release (`/O2`, `release` preset) Commands: ```powershell cmake --build --preset release --target offscreen_check -- -j 6 ctest --preset release -R "^compute_store_aot" --no-tests=error --output-on-failure ``` Results: **26 passed, 0 failed, 0 skipped** (Total Test time: `174.34 sec`, including `compute_store_aot_mtbuf_store_hardware` (`5.72 sec`) and `compute_store_aot_mtbuf_store_warp` (`6.47 sec`)).
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!1200
No description provided.