shader: lower packed gfx1030 2D image loads #1321

Manually merged
github merged 1 commit from gh-pr/1321/head into gh-pr/1321/base 2026-11-26 22:57:58 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-24 07:59 UTC · original
stan495:codex/gfx1030-mimg-packed-loads → main · +160 −18 · 6 files · 1 commits · merged 2026-11-24 08:21 UTC

Scope

Lower image_load_pck, image_load_pck_sgn, image_load_mip_pck and image_load_mip_pck_sgn in the gfx1030 compute translator. The caller binds a linear RGBA8 UINT 2D image with an identity channel mapping and a zero base mip. The UINT SRV supplies zero-extended bytes and the _sgn forms sign-extend from bit 7. The four opcodes share the existing 32-bit and a16 address paths, DMASK packing, descriptor provenance and waits. This follows #1265 and #1310.

Validation

Tested 580299daedc3ac6d80c6b2be5e398c57ab493dab on Windows 11 build 26300.9974. The adapters were Intel Arc B390 with driver 32.0.101.8509 and WARP (Microsoft Basic Render Driver) with driver 10.0.26100.9818. Both reported debug_layer=unavailable.

. .\tools\dev.ps1
cmake --preset dev -DINTAKE_PYTHON=<dev-python>
cmake --build --preset dev --target offscreen_check
ctest --preset dev --no-tests=error -R '^(compute_store_aot_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V --output-junit <absolute-path-to-packed-junit.xml>
python -B tools/form_coverage.py <absolute-path-to-packed-junit.xml> --records out/build/dev/form_coverage --json out/packed-coverage.json --gaps gfx1030
python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py

CTest reported 47 passed, 0 failed and 0 skipped. Each backend executed 24 packed load cases across four opcodes, two address widths and three DMASKs with one, two and four groups. The fixture checked all 320 words against a CPU reference, including untouched output. Replacing sign extension with zero extension first differed at word=0 expected=ffffff80 actual=00000080. The reverse mutation produced the reverse mismatch. Fixing the mip level to zero first differed at word=32 expected=0000009d actual=00000080 for unsigned loads. Both adapters detected both errors. The fixture also checks refusal of a mismatched format, d16 and missing waits. The JUnit-backed gfx1030 compute coverage includes all four new MIMG mnemonics and the two existing typed reads.

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

LLVM 15 assembled and decoded the 24 packed load variants. The synthetic-container CLI emitted the same HLSL as the text path, and the GPU tests executed the translated desktop DXIL.

**@⁠stan495** on GitHub · 2026-11-24 07:59 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1321) `stan495:codex/gfx1030-mimg-packed-loads` → `main` · +160 −18 · 6 files · 1 commits · merged 2026-11-24 08:21 UTC ## Scope Lower `image_load_pck`, `image_load_pck_sgn`, `image_load_mip_pck` and `image_load_mip_pck_sgn` in the gfx1030 compute translator. The caller binds a linear RGBA8 UINT 2D image with an identity channel mapping and a zero base mip. The UINT SRV supplies zero-extended bytes and the `_sgn` forms sign-extend from bit 7. The four opcodes share the existing 32-bit and `a16` address paths, DMASK packing, descriptor provenance and waits. This follows #1265 and #1310. ## Validation Tested `580299daedc3ac6d80c6b2be5e398c57ab493dab` on Windows 11 build 26300.9974. The adapters were Intel Arc B390 with driver 32.0.101.8509 and WARP (Microsoft Basic Render Driver) with driver 10.0.26100.9818. Both reported `debug_layer=unavailable`. ```powershell . .\tools\dev.ps1 cmake --preset dev -DINTAKE_PYTHON=<dev-python> cmake --build --preset dev --target offscreen_check ctest --preset dev --no-tests=error -R '^(compute_store_aot_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' -V --output-junit <absolute-path-to-packed-junit.xml> python -B tools/form_coverage.py <absolute-path-to-packed-junit.xml> --records out/build/dev/form_coverage --json out/packed-coverage.json --gaps gfx1030 python -B tests/form_coverage_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py ``` CTest reported 47 passed, 0 failed and 0 skipped. Each backend executed 24 packed load cases across four opcodes, two address widths and three DMASKs with one, two and four groups. The fixture checked all 320 words against a CPU reference, including untouched output. Replacing sign extension with zero extension first differed at `word=0 expected=ffffff80 actual=00000080`. The reverse mutation produced the reverse mismatch. Fixing the mip level to zero first differed at `word=32 expected=0000009d actual=00000080` for unsigned loads. Both adapters detected both errors. The fixture also checks refusal of a mismatched format, `d16` and missing waits. The JUnit-backed gfx1030 compute coverage includes all four new MIMG mnemonics and the two existing typed reads. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` LLVM 15 assembled and decoded the 24 packed load variants. The synthetic-container CLI emitted the same HLSL as the text path, and the GPU tests executed the translated desktop DXIL.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:57:56 +00:00
github manually merged commit 580299daed into gh-pr/1321/base 2026-11-26 22:57:58 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 08:06 UTC · original · reviewed

Reviewed and verified PR #1321 at commit 580299daedc3ac6d80c6b2be5e398c57ab493dab (looks good; no blockers).

Linux Checks (/tmp/rev-x2w-1321)

  • git diff --check origin/main...HEAD: passed
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: passed (16 Markdown files, 290 links)
  • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: passed (1093 tracked files)
  • /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 mimg_packed_controls() and 24 mimg_packed_cases() LLVM-19 assembly/lowering checks)

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

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target offscreen_check -- -j 6): 20.96s
    • Test (ctest --preset dev -R '^(compute_store_aot_mimg_packed_warp|compute_store_aot_mimg_load_warp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (compute_store_aot_mimg_packed_warp 4.78s, compute_store_aot_mimg_load_warp 5.43s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target offscreen_check -- -j 6): 22.25s
    • Test (ctest --preset release -R '^(compute_store_aot_mimg_packed_warp|compute_store_aot_mimg_load_warp)$' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (compute_store_aot_mimg_packed_warp 5.05s, compute_store_aot_mimg_load_warp 5.61s)

Notes

  • tools/compute_store_aot.py enforces _pck <-> R8G8B8A8_UINT matching and lowers _sgn via per-component asuint(asint(image_load_N << 24u) >> 24u) sign-extension from bit 7.
  • tests/compute_store_check.py covers all four opcodes (image_load_pck, image_load_pck_sgn, image_load_mip_pck, image_load_mip_pck_sgn) across 32-bit and a16 addresses, dmask 0x1/0xa/0xf, negative lowering controls, and HLSL mutant detection (wrong extension and fixed LOD).
**@⁠tedin7** on GitHub · 2026-11-24 08:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1321#pullrequestreview-6035663199) · **reviewed** Reviewed and verified PR #1321 at commit `580299daedc3ac6d80c6b2be5e398c57ab493dab` (looks good; no blockers). ### Linux Checks (`/tmp/rev-x2w-1321`) - `git diff --check origin/main...HEAD`: passed - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: passed (16 Markdown files, 290 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: passed (1093 tracked files) - `/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 `mimg_packed_controls()` and 24 `mimg_packed_cases()` LLVM-19 assembly/lowering checks) ### Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target offscreen_check -- -j 6`): `20.96s` - Test (`ctest --preset dev -R '^(compute_store_aot_mimg_packed_warp|compute_store_aot_mimg_load_warp)$' --parallel 4 --no-tests=error --output-on-failure`): **2/2 passed** (`compute_store_aot_mimg_packed_warp` `4.78s`, `compute_store_aot_mimg_load_warp` `5.43s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target offscreen_check -- -j 6`): `22.25s` - Test (`ctest --preset release -R '^(compute_store_aot_mimg_packed_warp|compute_store_aot_mimg_load_warp)$' --parallel 4 --no-tests=error --output-on-failure`): **2/2 passed** (`compute_store_aot_mimg_packed_warp` `5.05s`, `compute_store_aot_mimg_load_warp` `5.61s`) ### Notes - `tools/compute_store_aot.py` enforces `_pck` <-> `R8G8B8A8_UINT` matching and lowers `_sgn` via per-component `asuint(asint(image_load_N << 24u) >> 24u)` sign-extension from bit 7. - `tests/compute_store_check.py` covers all four opcodes (`image_load_pck`, `image_load_pck_sgn`, `image_load_mip_pck`, `image_load_mip_pck_sgn`) across 32-bit and `a16` addresses, `dmask` `0x1`/`0xa`/`0xf`, negative lowering controls, and HLSL mutant detection (`wrong extension` and `fixed LOD`).
This discussion has been locked. Commenting is limited to contributors.
No description provided.