shader: lower indexed gfx1030 formatted UINT buffer loads #1297

Manually merged
github merged 1 commit from gh-pr/1297/head into gh-pr/1297/base 2026-11-26 22:56:01 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-24 07:11 UTC · original
stan495:codex/gfx1030-mubuf-format-uint-upstream → main · +181 −8 · 5 files · 1 commits · merged 2026-11-24 08:06 UTC

Change

Lower buffer_load_format_x, buffer_load_format_xy, buffer_load_format_xyz, and buffer_load_format_xyzw in the gfx1030 compute store profile. The caller uses --source-format BUF_FMT_32_32_32_32_UINT to declare the format and identity XYZW selectors of the bound source descriptor. The synthetic fixture binds the corresponding bytes at raw t0. Each load copies the requested prefix of the texel in channel order with its full UINT representation.

The supported subset uses a verified idxen dispatch-thread index, zero scalar offset, and 16-byte-aligned stride and instruction offset. A complete texel must fit within a source record. The source is stable, unswizzled, in range, and disjoint from the output, with add-thread-ID disabled. The descriptor and destination registers require their existing waits. Other channel mappings, D16 and status forms, and native descriptor bounds are outside this profile. Format and selector ownership follows section 8.1.4 of the AMD RDNA 2 Shader ISA.

Follow-up to merged #1254 and #1282. Replayed on upstream main at b1e812ccf774fe67d27e84c785ff6429f0aaf7b7, which includes the raw subword stores from #1288.

Verification

Tested clean head c05767dd56b7f4b9d2cb20784462b827d57e1e54.

$python = (Get-Command python).Source
cmake --preset dev "-DINTAKE_PYTHON=$python"
cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -R '^compute_store_aot_' -V --output-junit (Join-Path $PWD out/format-c05767dd.xml)
python -B tools/form_coverage.py out/format-c05767dd.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/format-c05767dd-coverage.json
python -B tests/docs_links_check.py
python -B tests/form_coverage_check.py

40 passed, 0 failed, 0 skipped. Both compute_store_aot_mubuf_format_{hardware,warp} tests recorded the four new gfx1030 forms. Windows build 26300.9974, Intel Arc B390 (32.0.101.8509) and Microsoft Basic Render Driver/WARP (10.0.26100.9818). The debug layer was unavailable on both. A CPU reference compared all 320 words for one and two groups, including the untouched gaps and tail. For buffer_load_format_x, selecting Y first differed at word 0 with 8b02a7f1 expected and 8b06bba2 actual. For XY, XYZ and XYZW, swapping the first and last channels also first differed at word 0. Rejection controls cover missing format or waits, bad operands, and partial or misaligned source records. The rejection for a read exactly at the next record is Read leaves its source element.

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. All four original wave32 fixtures assemble and decode, and the synthetic container CLI emits the same HLSL as direct lowering. The GPU fixtures execute translated desktop DXIL. The Markdown link and coverage self-tests passed.

Both simulated landing orders with #1288 before its merge produced the same tree. The combined source passed the LLVM round-trip and the formatted load and raw subword store fixtures on both backends. The final replay and regression above use the merged upstream baseline. A pre-publication merge against main 924e414b920d2b85c5dd0eba70dcac9ca0dfb7e9 produced tree 31b8f301320824f3cfeddb645f2fa62ccdfc318c without conflicts.

The source-built fixtures use the repository's MIT License. This change was AI-assisted.

**@⁠stan495** on GitHub · 2026-11-24 07:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1297) `stan495:codex/gfx1030-mubuf-format-uint-upstream` → `main` · +181 −8 · 5 files · 1 commits · merged 2026-11-24 08:06 UTC ## Change Lower `buffer_load_format_x`, `buffer_load_format_xy`, `buffer_load_format_xyz`, and `buffer_load_format_xyzw` in the gfx1030 compute store profile. The caller uses `--source-format BUF_FMT_32_32_32_32_UINT` to declare the format and identity XYZW selectors of the bound source descriptor. The synthetic fixture binds the corresponding bytes at raw `t0`. Each load copies the requested prefix of the texel in channel order with its full UINT representation. The supported subset uses a verified `idxen` dispatch-thread index, zero scalar offset, and 16-byte-aligned stride and instruction offset. A complete texel must fit within a source record. The source is stable, unswizzled, in range, and disjoint from the output, with add-thread-ID disabled. The descriptor and destination registers require their existing waits. Other channel mappings, D16 and status forms, and native descriptor bounds are outside this profile. Format and selector ownership follows section 8.1.4 of the [AMD RDNA 2 Shader ISA](https://gpuopen.com/download/rdna2-shader-instruction-set-architecture.pdf). Follow-up to merged #1254 and #1282. Replayed on upstream main at `b1e812ccf774fe67d27e84c785ff6429f0aaf7b7`, which includes the raw subword stores from #1288. ## Verification Tested clean head `c05767dd56b7f4b9d2cb20784462b827d57e1e54`. ```powershell $python = (Get-Command python).Source cmake --preset dev "-DINTAKE_PYTHON=$python" cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error -R '^compute_store_aot_' -V --output-junit (Join-Path $PWD out/format-c05767dd.xml) python -B tools/form_coverage.py out/format-c05767dd.xml --records out/build/dev/form_coverage --gaps gfx1030 --json out/format-c05767dd-coverage.json python -B tests/docs_links_check.py python -B tests/form_coverage_check.py ``` 40 passed, 0 failed, 0 skipped. Both `compute_store_aot_mubuf_format_{hardware,warp}` tests recorded the four new gfx1030 forms. Windows build 26300.9974, Intel Arc B390 (32.0.101.8509) and Microsoft Basic Render Driver/WARP (10.0.26100.9818). The debug layer was unavailable on both. A CPU reference compared all 320 words for one and two groups, including the untouched gaps and tail. For `buffer_load_format_x`, selecting Y first differed at word 0 with `8b02a7f1` expected and `8b06bba2` actual. For XY, XYZ and XYZW, swapping the first and last channels also first differed at word 0. Rejection controls cover missing format or waits, bad operands, and partial or misaligned source records. The rejection for a read exactly at the next record is `Read leaves its source element`. ```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. All four original wave32 fixtures assemble and decode, and the synthetic container CLI emits the same HLSL as direct lowering. The GPU fixtures execute translated desktop DXIL. The Markdown link and coverage self-tests passed. Both simulated landing orders with #1288 before its merge produced the same tree. The combined source passed the LLVM round-trip and the formatted load and raw subword store fixtures on both backends. The final replay and regression above use the merged upstream baseline. A pre-publication merge against main `924e414b920d2b85c5dd0eba70dcac9ca0dfb7e9` produced tree `31b8f301320824f3cfeddb645f2fa62ccdfc318c` without conflicts. The source-built fixtures use the repository's MIT License. This change was AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:55:59 +00:00
github manually merged commit c05767dd56 into gh-pr/1297/base 2026-11-26 22:56:01 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 07:17 UTC · original · reviewed

Reviewed at commit c05767dd56b7f4b9d2cb20784462b827d57e1e54.

Linux Checks

  • git diff --check origin/main...HEAD: passed.
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (Checked 16 Markdown files and 290 links.).
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (Checked 1083 tracked source, script and build/CI files: no bidirectional controls.).
  • /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 (including mubuf_format_controls and buffer_load_format_{x,xy,xyz,xyzw} assembly/disassembly/container comparison).

Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)

  • Debug (--preset dev):
    • cmake --build --preset dev --target offscreen_check -- -j 6 (2.81s, configure 1.53s)
    • ctest --preset dev -R '^compute_store_aot_mubuf_format_' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (3.22s: compute_store_aot_mubuf_format_hardware 3.13s, compute_store_aot_mubuf_format_warp 3.14s)
  • Release /O2 (--preset release):
    • cmake --build --preset release --target offscreen_check -- -j 6 (0.36s, configure 1.53s)
    • ctest --preset release -R '^compute_store_aot_mubuf_format_' --parallel 4 --no-tests=error --output-on-failure: 2/2 passed (3.15s: compute_store_aot_mubuf_format_hardware 3.06s, compute_store_aot_mubuf_format_warp 3.07s)

Code Review Notes

  • tools/compute_store_aot.py: cleanly enforces cpu == "gfx1030", idxen and not offen, source_stride % 16 == 0, 16-byte offset alignment, and offset + 16 <= source_stride (full texel bounds check even for 1–3 channel loads).
  • tests/compute_store_check.py: covers 1–4 channel loads with index/destination aliasing (v8), 1- and 2-group dispatches against the CPU reference, wrong-channel mismatch controls, and rejection controls for missing/unsupported --source-format, non-16-byte stride/offset, offen, scalar offset, tfe, d16_, UAV aliasing, and missing lgkmcnt(0)/vmcnt(0) waits.
**@⁠tedin7** on GitHub · 2026-11-24 07:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1297#pullrequestreview-6035148675) · **reviewed** Reviewed at commit `c05767dd56b7f4b9d2cb20784462b827d57e1e54`. ### Linux Checks - `git diff --check origin/main...HEAD`: passed. - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: passed (`Checked 16 Markdown files and 290 links.`). - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: passed (`Checked 1083 tracked source, script and build/CI files: no bidirectional controls.`). - `/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 (including `mubuf_format_controls` and `buffer_load_format_{x,xy,xyz,xyzw}` assembly/disassembly/container comparison). ### Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) - **Debug (`--preset dev`)**: - `cmake --build --preset dev --target offscreen_check -- -j 6` (`2.81s`, configure `1.53s`) - `ctest --preset dev -R '^compute_store_aot_mubuf_format_' --parallel 4 --no-tests=error --output-on-failure`: **2/2 passed** (`3.22s`: `compute_store_aot_mubuf_format_hardware` `3.13s`, `compute_store_aot_mubuf_format_warp` `3.14s`) - **Release `/O2` (`--preset release`)**: - `cmake --build --preset release --target offscreen_check -- -j 6` (`0.36s`, configure `1.53s`) - `ctest --preset release -R '^compute_store_aot_mubuf_format_' --parallel 4 --no-tests=error --output-on-failure`: **2/2 passed** (`3.15s`: `compute_store_aot_mubuf_format_hardware` `3.06s`, `compute_store_aot_mubuf_format_warp` `3.07s`) ### Code Review Notes - `tools/compute_store_aot.py`: cleanly enforces `cpu == "gfx1030"`, `idxen and not offen`, `source_stride % 16 == 0`, 16-byte offset alignment, and `offset + 16 <= source_stride` (full texel bounds check even for 1–3 channel loads). - `tests/compute_store_check.py`: covers 1–4 channel loads with index/destination aliasing (`v8`), 1- and 2-group dispatches against the CPU reference, wrong-channel mismatch controls, and rejection controls for missing/unsupported `--source-format`, non-16-byte stride/offset, `offen`, scalar offset, `tfe`, `d16_`, UAV aliasing, and missing `lgkmcnt(0)`/`vmcnt(0)` waits.
This discussion has been locked. Commenting is limited to contributors.
No description provided.