shader: lower gfx1030 formatted D16 UINT buffer loads #1336

Merged
stan495 merged 1 commit from upstream-pr/1343 into main 2026-11-24 08:56:10 +00:00
stan495 commented 2026-11-24 08:39:21 +00:00 (Migrated from github.com)

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


Summary

  • Lower indexed gfx1030 buffer_load_format_d16_x, _xy, _xyz, and _xyzw for a caller-declared BUF_FMT_16_16_16_16_UINT source descriptor with identity XYZW selectors. The read stays within one aligned eight-byte texel in the source record.
  • Pack channels into one or two consecutive VGPRs, low half first. The odd forms require an explicit low-half mask before a whole-word consumer. Reuse the descriptor and VGPR wait tracking, including the case where the index aliases the first destination.
  • Assemble and disassemble all four forms and compare container CLI output with direct lowering. On WARP and hardware, dispatch the translated DXIL and compare all 320 words with an independent byte-level reference for one and two groups.

Validation

Commit tested bb90a3d010f4a923afbd85c4d2e4f7b34e3ca139.

cmake --preset dev
cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -R '^compute_store_aot_' -V --output-junit "$PWD/out/compute-store-junit.xml"
python -B tools/form_coverage.py out/compute-store-junit.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/compute-store-coverage.json
python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py

46 passed, 0 failed, 0 capability skips. Both compute_store_aot_mubuf_load_format_d16_* fixtures register all four mnemonics as passing in the same run. The selected run records 29 of 73 gfx1030 MUBUF forms. The coverage and documentation checks pass.

Windows build 26300.9974, WARP on Microsoft Basic Render Driver (10.0.26100.9818), and hardware on Intel Arc B390 (32.0.101.8509). The debug layer was unavailable on both.

The preceding-texel mutation reports the first difference at word 1 on both adapters. The x form expects 0000cf53 and produces 0000a7f1. The other three forms expect 8b0acf53 and produce 8b02a7f1. Rejection fixtures cover missing waits, partial-VGPR whole-word use, bad destination spans, descriptor format, alignment and record overrun.

python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1

Passed on Ubuntu 22.04.5 with LLVM 15.0.7.

The formatted writes from #1333 and these reads also passed both semantic fixture modes on WARP and hardware in the combined local merge tree a58ba5ba12624ab7fb6fa265407357c1e61d9c50.

git diff --check passed. git merge-tree --write-tree refs/remotes/origin/main HEAD succeeded against dde8afd2e5102a5b5feaa0bd92cadffa2b2e7495.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6577885130 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1343). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T08:39:21Z. --- ## Summary - Lower indexed gfx1030 `buffer_load_format_d16_x`, `_xy`, `_xyz`, and `_xyzw` for a caller-declared `BUF_FMT_16_16_16_16_UINT` source descriptor with identity XYZW selectors. The read stays within one aligned eight-byte texel in the source record. - Pack channels into one or two consecutive VGPRs, low half first. The odd forms require an explicit low-half mask before a whole-word consumer. Reuse the descriptor and VGPR wait tracking, including the case where the index aliases the first destination. - Assemble and disassemble all four forms and compare container CLI output with direct lowering. On WARP and hardware, dispatch the translated DXIL and compare all 320 words with an independent byte-level reference for one and two groups. ## Validation Commit tested `bb90a3d010f4a923afbd85c4d2e4f7b34e3ca139`. ```powershell cmake --preset dev cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error -R '^compute_store_aot_' -V --output-junit "$PWD/out/compute-store-junit.xml" python -B tools/form_coverage.py out/compute-store-junit.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/compute-store-coverage.json python -B tests/form_coverage_check.py python -B tests/docs_links_check.py ``` 46 passed, 0 failed, 0 capability skips. Both `compute_store_aot_mubuf_load_format_d16_*` fixtures register all four mnemonics as passing in the same run. The selected run records 29 of 73 gfx1030 MUBUF forms. The coverage and documentation checks pass. Windows build `26300.9974`, WARP on Microsoft Basic Render Driver (`10.0.26100.9818`), and hardware on Intel Arc B390 (`32.0.101.8509`). The debug layer was unavailable on both. The preceding-texel mutation reports the first difference at word 1 on both adapters. The `x` form expects `0000cf53` and produces `0000a7f1`. The other three forms expect `8b0acf53` and produce `8b02a7f1`. Rejection fixtures cover missing waits, partial-VGPR whole-word use, bad destination spans, descriptor format, alignment and record overrun. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` Passed on Ubuntu 22.04.5 with LLVM 15.0.7. The formatted writes from #1333 and these reads also passed both semantic fixture modes on WARP and hardware in the combined local merge tree `a58ba5ba12624ab7fb6fa265407357c1e61d9c50`. `git diff --check` passed. `git merge-tree --write-tree refs/remotes/origin/main HEAD` succeeded against `dde8afd2e5102a5b5feaa0bd92cadffa2b2e7495`.
upstream-sync closed this pull request 2026-11-24 09:04:38 +00:00
tedin7 commented 2026-11-24 09:04:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T08:56:53Z.

Review: COMMENTED


Technical peer review at commit bb90a3d010f4a923afbd85c4d2e4f7b34e3ca139 (LGTM, no blocking findings):

Code audit:

  • tools/compute_store_aot.py: Extends buffer_load_format_* to buffer_load_format_d16_{x,xy,xyz,xyzw} with MUBUF_SOURCE_TEXELS mapping BUF_FMT_32_32_32_32_UINT (16-byte texel) and BUF_FMT_16_16_16_16_UINT (8-byte texel). Validates cpu == "gfx1030", idxen-only addressing, non-null source_format matching expected, 8-byte offset alignment and element bounds, lgkmcnt(0) descriptor readiness, vmcnt(0) pending-register tracking, and marks the final VGPR of odd-component x/xyz loads as source_low16 so only explicit 0xffff masking is accepted.
  • tests/compute_store_check.py, CMakeLists.txt, README.md, docs/experiments.md: Adds mubuf_format_d16_controls (negative controls for address mode, soffset, tfe, offset alignment/bounds, UAV read, destination width/range, source_format/source_stride, waitcnt, and source_low16 masking), mubuf_format_d16_draw (including wrong-texel negative control), and compute_store_aot_mubuf_load_format_d16_{warp,hardware}; updates adjacent mubuf_subword_controls and mubuf_format_controls diagnostics. Title-neutral.

Checks:

  • Linux / LLVM-19: tests/docs_links_check.py (16 Markdown files, 295 links) passed; tests/bidi_controls_check.py (1110 files) passed; tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so passed; tests/rdna2_tools_check.py (138 tests, 18 skipped) passed; tests/form_coverage_check.py passed; git diff --check clean.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev, offscreen_check): compute_store_aot_mubuf_format_warp (3.11s), compute_store_aot_mubuf_load_format_d16_warp (3.19s), compute_store_aot_mubuf_d16_warp (3.67s) 3/3 passed.
    • Release /O2 (--preset release, offscreen_check): compute_store_aot_mubuf_format_warp (3.10s), compute_store_aot_mubuf_load_format_d16_warp (3.13s), compute_store_aot_mubuf_d16_warp (3.61s) 3/3 passed.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6036264632 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1343#pullrequestreview-6036264632). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:56:53Z. **Review:** COMMENTED --- Technical peer review at commit `bb90a3d010f4a923afbd85c4d2e4f7b34e3ca139` (LGTM, no blocking findings): **Code audit:** - `tools/compute_store_aot.py`: Extends `buffer_load_format_*` to `buffer_load_format_d16_{x,xy,xyz,xyzw}` with `MUBUF_SOURCE_TEXELS` mapping `BUF_FMT_32_32_32_32_UINT` (16-byte texel) and `BUF_FMT_16_16_16_16_UINT` (8-byte texel). Validates `cpu == "gfx1030"`, `idxen`-only addressing, non-null `source_format` matching `expected`, 8-byte offset alignment and element bounds, `lgkmcnt(0)` descriptor readiness, `vmcnt(0)` pending-register tracking, and marks the final VGPR of odd-component `x`/`xyz` loads as `source_low16` so only explicit `0xffff` masking is accepted. - `tests/compute_store_check.py`, `CMakeLists.txt`, `README.md`, `docs/experiments.md`: Adds `mubuf_format_d16_controls` (negative controls for address mode, soffset, `tfe`, offset alignment/bounds, UAV read, destination width/range, `source_format`/`source_stride`, waitcnt, and `source_low16` masking), `mubuf_format_d16_draw` (including wrong-texel negative control), and `compute_store_aot_mubuf_load_format_d16_{warp,hardware}`; updates adjacent `mubuf_subword_controls` and `mubuf_format_controls` diagnostics. Title-neutral. **Checks:** - **Linux / LLVM-19**: `tests/docs_links_check.py` (16 Markdown files, 295 links) passed; `tests/bidi_controls_check.py` (1110 files) passed; `tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so` passed; `tests/rdna2_tools_check.py` (138 tests, 18 skipped) passed; `tests/form_coverage_check.py` passed; `git diff --check` clean. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - Debug (`--preset dev`, `offscreen_check`): `compute_store_aot_mubuf_format_warp` (`3.11s`), `compute_store_aot_mubuf_load_format_d16_warp` (`3.19s`), `compute_store_aot_mubuf_d16_warp` (`3.67s`) **3/3 passed**. - Release `/O2` (`--preset release`, `offscreen_check`): `compute_store_aot_mubuf_format_warp` (`3.10s`), `compute_store_aot_mubuf_load_format_d16_warp` (`3.13s`), `compute_store_aot_mubuf_d16_warp` (`3.61s`) **3/3 passed**.
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!1336
No description provided.