shader: lower packed gfx1030 2D image loads #1314

Merged
stan495 merged 1 commit from upstream-pr/1321 into main 2026-11-24 08:21:49 +00:00
stan495 commented 2026-11-24 07:59:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T07:59:05Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6577275108 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1321). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T07:59:05Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 09:04:29 +00:00
tedin7 commented 2026-11-24 09:04:29 +00:00 (Migrated from github.com)

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

Review: COMMENTED


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).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6035663199 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1321#pullrequestreview-6035663199). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T08:06:31Z. **Review:** COMMENTED --- 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`).
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!1314
No description provided.