shader: lower indexed gfx1030 raw vector loads #1247

Merged
stan495 merged 2 commits from upstream-pr/1254 into main 2026-11-24 06:33:12 +00:00
stan495 commented 2026-11-24 05:34:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T05:34:53Z.


Change

Lower buffer_load_dwordx2, buffer_load_dwordx3 and buffer_load_dwordx4 in the gfx1030 compute store profile. Accept a verified idxen dispatch-thread index, zero scalar offset, an aligned immediate and a consecutive destination range. All words must fit in one valid, unswizzled source record. Capture the address before marking the destination range pending, so the index can alias a destination. The caller-bound raw t0 must remain stable, in range and disjoint from the output. Native descriptor bounds and pixel bindings are out of scope.

Follow-up to merged #1225; supersedes the stacked draft stan495/Xbox2Windows#4. The upstream merge at f1b16abd266144c4ec3517fb989060a4ee7a50ce resolves the adjacent README rows by retaining both raw vector reads and the upstream image-load entry.

Verification

Tested clean head 4c272ccb07da285b90b28669e13d6334a6b68ce1:

$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/vector-4c272ccb.xml)
python -B tools/form_coverage.py out/vector-4c272ccb.xml --records out/build/dev/form_coverage --gaps gfx1030
python -B tests/docs_links_check.py

34 passed, 0 failed, 0 skipped; Markdown links passed. Both compute_store_aot_mubuf_vector_{hardware,warp} tests contributed all three new gfx1030 forms. Windows build 26300.9974, Intel Arc B390 (32.0.101.8509), Microsoft Basic Render Driver/WARP (10.0.26100.9818); debug layer unavailable on both. The translated shaders matched all 320 CPU reference words at one and two groups, including gaps and untouched tail. Swapping first and last channels failed at word 0: 8b06bba2 expected, 8b0acf53/8b0ee304/8b12f6b5 actual for x2/x3/x4. Invalid destination spans, record overruns, and use or overwrite of the last destination before vmcnt(0) were rejected.

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

Passed in Ubuntu 22.04.5 with LLVM 15.0.7. The three source-built wave32 programs assemble and decode, and the synthetic container CLI emits the same HLSL as direct lowering. The GPU tests execute the translated desktop DXIL.

Evidence and follow-up

The fixtures are original synthetic sources under the repository's MIT License. The README experiment row and docs/experiments.md specify the command and input contract.

This change was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6575387657 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1254). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T05:34:53Z. --- ## Change Lower `buffer_load_dwordx2`, `buffer_load_dwordx3` and `buffer_load_dwordx4` in the gfx1030 compute store profile. Accept a verified `idxen` dispatch-thread index, zero scalar offset, an aligned immediate and a consecutive destination range. All words must fit in one valid, unswizzled source record. Capture the address before marking the destination range pending, so the index can alias a destination. The caller-bound raw `t0` must remain stable, in range and disjoint from the output. Native descriptor bounds and pixel bindings are out of scope. Follow-up to merged #1225; supersedes the stacked draft stan495/Xbox2Windows#4. The upstream merge at `f1b16abd266144c4ec3517fb989060a4ee7a50ce` resolves the adjacent README rows by retaining both raw vector reads and the upstream image-load entry. ## Verification Tested clean head `4c272ccb07da285b90b28669e13d6334a6b68ce1`: ```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/vector-4c272ccb.xml) python -B tools/form_coverage.py out/vector-4c272ccb.xml --records out/build/dev/form_coverage --gaps gfx1030 python -B tests/docs_links_check.py ``` 34 passed, 0 failed, 0 skipped; Markdown links passed. Both `compute_store_aot_mubuf_vector_{hardware,warp}` tests contributed all three new gfx1030 forms. Windows build 26300.9974, Intel Arc B390 (32.0.101.8509), Microsoft Basic Render Driver/WARP (10.0.26100.9818); debug layer unavailable on both. The translated shaders matched all 320 CPU reference words at one and two groups, including gaps and untouched tail. Swapping first and last channels failed at word 0: `8b06bba2` expected, `8b0acf53`/`8b0ee304`/`8b12f6b5` actual for x2/x3/x4. Invalid destination spans, record overruns, and use or overwrite of the last destination before `vmcnt(0)` were rejected. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` Passed in Ubuntu 22.04.5 with LLVM 15.0.7. The three source-built wave32 programs assemble and decode, and the synthetic container CLI emits the same HLSL as direct lowering. The GPU tests execute the translated desktop DXIL. ## Evidence and follow-up The fixtures are original synthetic sources under the repository's MIT License. The README experiment row and `docs/experiments.md` specify the command and input contract. This change was AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:47:20 +00:00
tedin7 commented 2026-11-24 06:47:20 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Dual-platform review of 4d100c9c7337fe31a00356fbded8f46e290c640e (shader: lower indexed gfx1030 raw vector loads).

Linux / LLVM-19 Checks

  • git diff --check origin/main...HEAD: PASS
  • docs_links_check.py: PASS (16 Markdown files, 282 links)
  • bidi_controls_check.py: PASS (1054 tracked files, no bidirectional controls)
  • LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so python -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: PASS (exit 0; includes mubuf_vector_controls and gfx1030_binary for buffer_load_dwordx2/x3/x4)

Windows Server 2025 (Build 26100, MSVC 14.44, D3D12 WARP)

Command: C:\OEM\run_pr_test.ps1 -Pr 1254 -Targets 'offscreen_check,offscreen_check' -Regex '^compute_store_aot_mubuf_vector_' -Jobs 6 -Parallel 4

  • dev (Debug): offscreen_check built; ctest 2/2 Passed (compute_store_aot_mubuf_vector_hardware 2.78s, compute_store_aot_mubuf_vector_warp 2.88s)
  • release (/O2): offscreen_check built; ctest 2/2 Passed (compute_store_aot_mubuf_vector_hardware 2.81s, compute_store_aot_mubuf_vector_warp 2.81s)

Code Review Notes

  • tools/compute_store_aot.py: extends the buffer_load_dword matcher to buffer_load_dwordx[234], enforces cpu == "gfx1030", idxen, !offen, DWORD-aligned immediate offset, and consecutive VGPR destination range, and captures source addresses before clearing/marking destination registers so index-destination aliasing (v8 in the fixture) works as intended.
  • tests/compute_store_check.py: mubuf_vector_controls() exercises negative rejections (wrong dest count, v255 overflow, offen, unaligned offset, record overrun, tfe, UAV source, missing vmcnt(0) / lgkmcnt(0), pre-wait read/overwrite of last dest, gfx1013), and mubuf_vector_draw() checks 1- and 2-group CPU reference parity plus a first/last channel-swap failure check.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034415863 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1254#pullrequestreview-6034415863). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:00:09Z. **Review:** COMMENTED --- Dual-platform review of `4d100c9c7337fe31a00356fbded8f46e290c640e` (*shader: lower indexed gfx1030 raw vector loads*). ### Linux / LLVM-19 Checks - `git diff --check origin/main...HEAD`: **PASS** - `docs_links_check.py`: **PASS** (16 Markdown files, 282 links) - `bidi_controls_check.py`: **PASS** (1054 tracked files, no bidirectional controls) - `LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so python -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: **PASS** (exit 0; includes `mubuf_vector_controls` and `gfx1030_binary` for `buffer_load_dwordx2/x3/x4`) ### Windows Server 2025 (Build 26100, MSVC 14.44, D3D12 WARP) Command: `C:\OEM\run_pr_test.ps1 -Pr 1254 -Targets 'offscreen_check,offscreen_check' -Regex '^compute_store_aot_mubuf_vector_' -Jobs 6 -Parallel 4` - **`dev` (Debug)**: `offscreen_check` built; `ctest` **2/2 Passed** (`compute_store_aot_mubuf_vector_hardware` 2.78s, `compute_store_aot_mubuf_vector_warp` 2.88s) - **`release` (`/O2`)**: `offscreen_check` built; `ctest` **2/2 Passed** (`compute_store_aot_mubuf_vector_hardware` 2.81s, `compute_store_aot_mubuf_vector_warp` 2.81s) ### Code Review Notes - `tools/compute_store_aot.py`: extends the `buffer_load_dword` matcher to `buffer_load_dwordx[234]`, enforces `cpu == "gfx1030"`, `idxen`, `!offen`, DWORD-aligned immediate offset, and consecutive VGPR destination range, and captures source addresses before clearing/marking destination registers so index-destination aliasing (`v8` in the fixture) works as intended. - `tests/compute_store_check.py`: `mubuf_vector_controls()` exercises negative rejections (wrong dest count, `v255` overflow, `offen`, unaligned offset, record overrun, `tfe`, UAV source, missing `vmcnt(0)` / `lgkmcnt(0)`, pre-wait read/overwrite of last dest, `gfx1013`), and `mubuf_vector_draw()` checks 1- and 2-group CPU reference parity plus a first/last channel-swap failure check.
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!1247
No description provided.