shader: lower packed-address gfx1030 2D image loads #1239

Manually merged
github merged 3 commits from gh-pr/1239/head into gh-pr/1239/base 2026-11-26 22:51:27 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-24 04:57 UTC · original
stan495:codex/gfx1030-mimg-a16 → main · +135 −75 · 4 files · 3 commits · merged 2026-11-24 06:06 UTC

Scope

Stacked on #1236. Add the packed-address a16 spelling of the same typed 2D image load:
image_load vD, vP, s[A:A+7] dmask:0x1|0x3|0x7|0xf dim:SQ_RSRC_IMG_2D unorm a16.
One address VGPR holds both coordinates, x in bits [15:0] and y in bits [31:16]; the lowering
extracts them into the same Texture2D<uint4>.Load(int3(x, y, 0)) from t0 and writes the
DMASK-selected components to consecutive destination VGPRs. d16, tfe, glc, slc, dlc,
r128 and the NSA register list stay refused, and the two address families are mutually exclusive:
the a16 flag with a two-dword address, or a packed address without the flag, is rejected.

main merged the D16 typed-buffer store PR (#1207), then the D16 load PR (#1211) and the float-ALU
compute-store PR (#1169), while this branch was open. Both commits were rebased onto 55a975ab: the
#1236 commit became eb9269c9 (its conflicts were resolved in #1236) and the a16 commit became
a8be8889. Review the delta a8be8889 for the a16-specific changes; after #1236 lands, rebase
this branch on main before marking it ready.

Validation

Tested a8be88895c5073bf6c043a961d9039eb1f4096b2 (parent eb9269c9) on Windows 11 26H2 build
26300.9974 with the Intel(R) Arc(TM) B390 GPU (driver 32.0.101.8509) and Microsoft WARP
(Microsoft Basic Render Driver, driver 10.0.26100.9818). The runner reported
debug_layer=unavailable.

  • cmake --preset dev and cmake --build --preset dev --target offscreen_check passed.
  • ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -V reported 2 passes
    (WARP and hardware), 0 failures and 0 skips. Each backend now compares all 320 UAV words for eight
    cases: dmask:0x1, 0x3, 0x7 and 0xf in both the two-dword and the packed a16 address
    family, 0 mismatches.
    • Packed-half mutation (>> 16u changed to >> 0u): word=4 expected=10000010 actual=10001010.
    • The unchanged #1236 controls still report word=0 expected=10000001 actual=10000000 (flipped
      written word), word=300 expected=c5c5c5c4 actual=c5c5c5c5 (flipped untouched word),
      word=0 expected=10000000 actual=20000001 (component order) and
      word=4 expected=10000010 actual=10001000 (two-dword coordinate order).
  • ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V
    reported 9 passes, 0 failures and 0 skips.
  • python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
    exited 0 on LLVM 15.0.7 (Ubuntu 22.04 container). It assembles and decodes all eight forms,
    including LLVM's ... unorm a16 spelling and the one-register address, and the CLI lowering of
    the decoded program matches the text lowering.
  • The JUnit run of the two tests records image_load; tools/form_coverage.py --json counts one
    gfx1030 form from this run. tests/docs_links_check.py, tests/bidi_controls_check.py and
    tests/form_coverage_check.py passed.

The GPU measurements execute translated desktop DXIL against CPU references; they are not native
runs of the assembled gfx1030 program. Descriptor fields remain a caller guarantee as in #1236; this
PR only changes how the address VGPRs are formed.

Reproduce

cmake --preset dev -DINTAKE_PYTHON=<dev-python>
cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_(warp|hardware)$' -V
python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1

The updated description is in
docs/experiments.md#gfx1030-2d-image-loads.

**@⁠stan495** on GitHub · 2026-11-24 04:57 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1239) `stan495:codex/gfx1030-mimg-a16` → `main` · +135 −75 · 4 files · 3 commits · merged 2026-11-24 06:06 UTC ## Scope Stacked on #1236. Add the packed-address `a16` spelling of the same typed 2D image load: `image_load vD, vP, s[A:A+7] dmask:0x1|0x3|0x7|0xf dim:SQ_RSRC_IMG_2D unorm a16`. One address VGPR holds both coordinates, x in bits [15:0] and y in bits [31:16]; the lowering extracts them into the same `Texture2D<uint4>.Load(int3(x, y, 0))` from `t0` and writes the DMASK-selected components to consecutive destination VGPRs. `d16`, `tfe`, `glc`, `slc`, `dlc`, `r128` and the NSA register list stay refused, and the two address families are mutually exclusive: the `a16` flag with a two-dword address, or a packed address without the flag, is rejected. `main` merged the D16 typed-buffer store PR (#1207), then the D16 load PR (#1211) and the float-ALU compute-store PR (#1169), while this branch was open. Both commits were rebased onto `55a975ab`: the #1236 commit became `eb9269c9` (its conflicts were resolved in #1236) and the `a16` commit became `a8be8889`. Review the delta `a8be8889` for the `a16`-specific changes; after #1236 lands, rebase this branch on `main` before marking it ready. ## Validation Tested `a8be88895c5073bf6c043a961d9039eb1f4096b2` (parent `eb9269c9`) on Windows 11 26H2 build 26300.9974 with the Intel(R) Arc(TM) B390 GPU (driver 32.0.101.8509) and Microsoft WARP (Microsoft Basic Render Driver, driver 10.0.26100.9818). The runner reported `debug_layer=unavailable`. - `cmake --preset dev` and `cmake --build --preset dev --target offscreen_check` passed. - `ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -V` reported 2 passes (WARP and hardware), 0 failures and 0 skips. Each backend now compares all 320 UAV words for eight cases: `dmask:0x1`, `0x3`, `0x7` and `0xf` in both the two-dword and the packed `a16` address family, 0 mismatches. - Packed-half mutation (`>> 16u` changed to `>> 0u`): `word=4 expected=10000010 actual=10001010`. - The unchanged #1236 controls still report `word=0 expected=10000001 actual=10000000` (flipped written word), `word=300 expected=c5c5c5c4 actual=c5c5c5c5` (flipped untouched word), `word=0 expected=10000000 actual=20000001` (component order) and `word=4 expected=10000010 actual=10001000` (two-dword coordinate order). - `ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V` reported 9 passes, 0 failures and 0 skips. - `python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1` exited 0 on LLVM 15.0.7 (Ubuntu 22.04 container). It assembles and decodes all eight forms, including LLVM's `... unorm a16` spelling and the one-register address, and the CLI lowering of the decoded program matches the text lowering. - The JUnit run of the two tests records `image_load`; `tools/form_coverage.py --json` counts one gfx1030 form from this run. `tests/docs_links_check.py`, `tests/bidi_controls_check.py` and `tests/form_coverage_check.py` passed. The GPU measurements execute translated desktop DXIL against CPU references; they are not native runs of the assembled gfx1030 program. Descriptor fields remain a caller guarantee as in #1236; this PR only changes how the address VGPRs are formed. ## Reproduce ```powershell cmake --preset dev -DINTAKE_PYTHON=<dev-python> cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_(warp|hardware)$' -V ``` ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` The updated description is in [`docs/experiments.md#gfx1030-2d-image-loads`](docs/experiments.md#gfx1030-2d-image-loads).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:51:26 +00:00
github manually merged commit f0741f16f8 into gh-pr/1239/base 2026-11-26 22:51:27 +00:00
Author
Owner

@⁠stan495 on GitHub · 2026-11-24 05:08 UTC · original

Rebased as a stacked branch after main merged #1207. The #1236 commit is now 9657c622 (its conflict was resolved in #1236) and the a16 commit is ceaf2185; main is 908c34bf.

The a16-specific delta is still the final commit (ceaf2185). Re-verified on the new head, Windows 11 26H2 build 26300.9974, Intel Arc B390 + WARP:

  • ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -V: 2 passes, 0 failures, 0 skips (eight dmask/address-family cases, 320 UAV words each).
  • ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V: 9 passes, 0 failures, 0 skips.
  • python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 on LLVM 15.0.7: exit 0.

This PR stays stacked on #1236 until that lands.

**@⁠stan495** on GitHub · 2026-11-24 05:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1239#issuecomment-7122667535) Rebased as a stacked branch after `main` merged #1207. The #1236 commit is now `9657c622` (its conflict was resolved in #1236) and the `a16` commit is `ceaf2185`; `main` is `908c34bf`. The `a16`-specific delta is still the final commit (`ceaf2185`). Re-verified on the new head, Windows 11 26H2 build 26300.9974, Intel Arc B390 + WARP: - `ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -V`: 2 passes, 0 failures, 0 skips (eight dmask/address-family cases, 320 UAV words each). - `ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V`: 9 passes, 0 failures, 0 skips. - `python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1` on LLVM 15.0.7: exit 0. This PR stays stacked on #1236 until that lands.
Author
Owner

@⁠stan495 on GitHub · 2026-11-24 05:15 UTC · original

Rebased again after main merged #1211 (D16 typed-buffer loads) and #1169 (float ALU in the compute store profile). New heads on main 55a975ab: #1236 commit eb9269c9, a16 commit a8be8889.

Re-verified on a8be8889, Windows 11 26H2 build 26300.9974, Intel Arc B390 + WARP:

  • ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -V: 2 passes, 0 failures, 0 skips (eight dmask/address-family cases, 320 UAV words each).
  • ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V: 9 passes, 0 failures, 0 skips.
  • python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 on LLVM 15.0.7: exit 0.

The a16-specific delta remains the final commit (a8be8889).

**@⁠stan495** on GitHub · 2026-11-24 05:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1239#issuecomment-7122771812) Rebased again after `main` merged #1211 (D16 typed-buffer loads) and #1169 (float ALU in the compute store profile). New heads on `main` `55a975ab`: #1236 commit `eb9269c9`, `a16` commit `a8be8889`. Re-verified on `a8be8889`, Windows 11 26H2 build 26300.9974, Intel Arc B390 + WARP: - `ctest --preset dev --no-tests=error -R '^compute_store_aot_mimg_load_' -V`: 2 passes, 0 failures, 0 skips (eight dmask/address-family cases, 320 UAV words each). - `ctest --preset dev --no-tests=error -R '^(compute_store_aot_mtbuf_load_|compute_store_aot_mtbuf_store_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V`: 9 passes, 0 failures, 0 skips. - `python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1` on LLVM 15.0.7: exit 0. The `a16`-specific delta remains the final commit (`a8be8889`).
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 05:21 UTC · original · edited 2026-11-24 05:23 UTC

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit a8be88895c5073bf6c043a961d9039eb1f4096b2:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target offscreen_check -- -j 6): 3.56s (configure 1.78s)
    • Test (ctest --preset dev -R '^(compute_store_aot_mimg_load_warp|compute_store_aot_warp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (7.18s: compute_store_aot_mimg_load_warp 4.67s, compute_store_aot_warp 7.07s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target offscreen_check -- -j 6): 1.01s (configure 1.83s)
    • Test (ctest --preset release -R '^(compute_store_aot_mimg_load_warp|compute_store_aot_warp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (6.11s: compute_store_aot_mimg_load_warp 4.30s, compute_store_aot_warp 6.03s)
**@⁠tedin7** on GitHub · 2026-11-24 05:21 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1239#issuecomment-7122867908) · edited 2026-11-24 05:23 UTC Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `a8be88895c5073bf6c043a961d9039eb1f4096b2`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target offscreen_check -- -j 6`): `3.56s` (configure `1.78s`) - Test (`ctest --preset dev -R '^(compute_store_aot_mimg_load_warp|compute_store_aot_warp)$' --parallel 4 --no-tests=error --output-on-failure`): **2/2 passed** (`7.18s`: `compute_store_aot_mimg_load_warp` `4.67s`, `compute_store_aot_warp` `7.07s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target offscreen_check -- -j 6`): `1.01s` (configure `1.83s`) - Test (`ctest --preset release -R '^(compute_store_aot_mimg_load_warp|compute_store_aot_warp)$' --parallel 4 --no-tests=error --output-on-failure`): **2/2 passed** (`6.11s`: `compute_store_aot_mimg_load_warp` `4.30s`, `compute_store_aot_warp` `6.03s`)
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 05:04 UTC · original · reviewed

Reviewed commit 6fc4be5a (stacked on #1236 / a0842350; Linux host — Windows offscreen_check build and compute_store_aot_mimg_load_* GPU tests were not executed locally).

Code & Edge-Case Audit

  • tools/compute_store_aot.py:
    • image_load lowering enforces mutual exclusivity between a16 and the two-dword address (a16 != (packed is not None)), cpu == "gfx1030", guard_span is None, contiguous dmask == (1 << count) - 1 (1 <= count <= 4, last == first + count - 1, rejecting dmask:0x0), high == base + 7, base % 4 == 0, completed s_load_dwordx8 at --image-descriptor, and s_waitcnt vmcnt(0) before reading destination VGPRs.
    • Packed a16 coordinate extraction emits int3(asint(word & 0xffffu), asint(word >> 16u), 0): because word is an HLSL uint, & 0xffffu and >> 16u perform unsigned extraction before asint(...), avoiding sign-extension of bit 15 or bit 31.
    • --image-descriptor validates alignment and non-overlap against existing descriptor bindings and --source-descriptor.
  • tests/compute_store_check.py, tests/compute_check.cpp, tests/offscreen_check.cpp, docs/experiments.md, README.md:
    • Title-neutral (AGENTS.md compliant).
    • Remember to rebase onto main once #1236 lands.

Checks Run (Linux / Python / LLVM-19)

  • git diff --check origin/main...HEAD: pass (0 issues)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 281 links)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1046 files)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py: pass
  • LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so /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: pass (exit 0; all mimg_load and mimg_load_a16 forms assembled/decoded and CLI-lowered, plus mimg_load_controls / mimg_a16_controls)
  • Windows build and ctest -R '^compute_store_aot_mimg_load_': not run locally.
**@⁠tedin7** on GitHub · 2026-11-24 05:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1239#pullrequestreview-6033967371) · **reviewed** Reviewed commit `6fc4be5a` (stacked on `#1236` / `a0842350`; Linux host — Windows `offscreen_check` build and `compute_store_aot_mimg_load_*` GPU tests were not executed locally). ### Code & Edge-Case Audit - `tools/compute_store_aot.py`: - `image_load` lowering enforces mutual exclusivity between `a16` and the two-dword address (`a16 != (packed is not None)`), `cpu == "gfx1030"`, `guard_span is None`, contiguous `dmask == (1 << count) - 1` (`1 <= count <= 4`, `last == first + count - 1`, rejecting `dmask:0x0`), `high == base + 7`, `base % 4 == 0`, completed `s_load_dwordx8` at `--image-descriptor`, and `s_waitcnt vmcnt(0)` before reading destination VGPRs. - Packed `a16` coordinate extraction emits `int3(asint(word & 0xffffu), asint(word >> 16u), 0)`: because `word` is an HLSL `uint`, `& 0xffffu` and `>> 16u` perform unsigned extraction before `asint(...)`, avoiding sign-extension of bit 15 or bit 31. - `--image-descriptor` validates alignment and non-overlap against existing descriptor bindings and `--source-descriptor`. - `tests/compute_store_check.py`, `tests/compute_check.cpp`, `tests/offscreen_check.cpp`, `docs/experiments.md`, `README.md`: - Title-neutral (`AGENTS.md` compliant). - Remember to rebase onto `main` once `#1236` lands. ### Checks Run (Linux / Python / LLVM-19) - `git diff --check origin/main...HEAD`: pass (0 issues) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: pass (16 Markdown files, 281 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: pass (1046 files) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py`: pass - `LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so /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`: pass (exit 0; all `mimg_load` and `mimg_load_a16` forms assembled/decoded and CLI-lowered, plus `mimg_load_controls` / `mimg_a16_controls`) - Windows build and `ctest -R '^compute_store_aot_mimg_load_'`: not run locally.
Author
Owner

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

Retest of commit ceaf2185 (rebased onto main 908c34bf + #1236 9657c622; delta from 6fc4be5a is rebase-only with identical a16 lowering/test diff; Linux host — Windows offscreen_check build and compute_store_aot_mimg_load_* GPU tests were not executed locally).

Delta & Audit (6fc4be5a..ceaf2185)

  • diff -u between 6fc4be5a and ceaf2185 shows zero functional changes to the a16 implementation or tests (only blob hashes and line offsets from rebasing onto main).
  • Title-neutral (AGENTS.md compliant).

Checks Run (Linux / Python / LLVM-19)

  • git diff --check origin/main...HEAD: pass (0 issues)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 281 links)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1050 files)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py: pass
  • LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so /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: pass (exit 0)
  • Windows build and ctest -R '^compute_store_aot_mimg_load_': not run locally.
**@⁠tedin7** on GitHub · 2026-11-24 05:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1239#pullrequestreview-6034084893) · **reviewed** Retest of commit `ceaf2185` (rebased onto `main` `908c34bf` + `#1236` `9657c622`; delta from `6fc4be5a` is rebase-only with identical `a16` lowering/test diff; Linux host — Windows `offscreen_check` build and `compute_store_aot_mimg_load_*` GPU tests were not executed locally). ### Delta & Audit (`6fc4be5a..ceaf2185`) - `diff -u` between `6fc4be5a` and `ceaf2185` shows zero functional changes to the `a16` implementation or tests (only blob hashes and line offsets from rebasing onto `main`). - Title-neutral (`AGENTS.md` compliant). ### Checks Run (Linux / Python / LLVM-19) - `git diff --check origin/main...HEAD`: pass (0 issues) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: pass (16 Markdown files, 281 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: pass (1050 files) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/form_coverage_check.py`: pass - `LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so /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`: pass (exit 0) - Windows build and `ctest -R '^compute_store_aot_mimg_load_'`: not run locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.