shader: lower typed gfx1030 2D image mip loads #1258

Merged
stan495 merged 3 commits from upstream-pr/1265 into main 2026-11-24 07:16:17 +00:00
stan495 commented 2026-11-24 06:15:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T06:15:12Z.


Scope

Lower gfx1030 image_load_mip for a caller-declared linear 2D R32G32B32A32_UINT image. The 32-bit address has three consecutive VGPRs for x, y and mip. In the a16 form, the first VGPR holds x and y and the low half of the next VGPR holds mip. Both forms emit Texture2D<uint4>.Load(int3(x, y, mip)) for DMASK x, xy, xyz and xyzw. The image_load path and its descriptor provenance and wait rules are shared with the mip form. The caller supplies in-range coordinates and a matching mip range starting at level zero. This extends #1236 and #1239.

The synthetic fixture uploads three separately tagged subresources and uses LOD 0, 1 and 2 within each dispatch. It compares all 320 output words against a CPU reference and covers dispatches of one, two and four groups. The four-channel form aliases the destination with address registers. Rejections cover the wrong tuple width, an unknown LOD VGPR, NSA, TFE and reading the result before s_waitcnt vmcnt(0).

Validation

Tested commit 6e23abc64d8d659c7f5ae57f5ae65ece4a9a1d38 on Windows 11 26H2 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. The runner reported debug_layer=unavailable on both backends.

.\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-mip-junit.xml>
python -B tools/form_coverage.py <absolute-path-to-mip-junit.xml> --records out/build/dev/form_coverage --json out/mip-coverage.json --gaps gfx1030

CTest reported 41 passed, 0 failed and 0 skipped. This run also covered the upstream raw MUBUF vector reads on both backends. Each mip backend ran eight cases and compared 320 words per case with zero mismatches. Forcing LOD zero first failed at word=32 expected=11000000 actual=10000000 in both address families. Reading the packed high half as the LOD first failed at word=0 expected=10000000 actual=00000000. Mutating one written word and one sentinel word also triggered the expected comparisons. The compute fixture executes translated desktop DXIL. The same-run JUnit coverage records image_load and image_load_mip, two of 111 gfx1030 MIMG mnemonics in docs/coverage/rdna2.tsv for this fixture set.

python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
LLVM_LIB=libLLVM-15.so.1 LLVM_MC=llvm-mc-15 LLVM_OBJCOPY=llvm-objcopy-15 python3 -B tests/rdna2_tools_check.py
python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py

LLVM 15.0.7 assembled and decoded all eight mip cases from source on Ubuntu 22.04. The synthetic PSB container CLI emitted the same HLSL as direct text lowering. The disassembly suite ran 133 tests with one skip. The coverage and documentation checks passed.

The experiment notes document the bound SRV and descriptor assumptions.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6575876434 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1265). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T06:15:12Z. --- ## Scope Lower gfx1030 `image_load_mip` for a caller-declared linear 2D `R32G32B32A32_UINT` image. The 32-bit address has three consecutive VGPRs for x, y and mip. In the `a16` form, the first VGPR holds x and y and the low half of the next VGPR holds mip. Both forms emit `Texture2D<uint4>.Load(int3(x, y, mip))` for DMASK x, xy, xyz and xyzw. The `image_load` path and its descriptor provenance and wait rules are shared with the mip form. The caller supplies in-range coordinates and a matching mip range starting at level zero. This extends #1236 and #1239. The synthetic fixture uploads three separately tagged subresources and uses LOD 0, 1 and 2 within each dispatch. It compares all 320 output words against a CPU reference and covers dispatches of one, two and four groups. The four-channel form aliases the destination with address registers. Rejections cover the wrong tuple width, an unknown LOD VGPR, NSA, TFE and reading the result before `s_waitcnt vmcnt(0)`. ## Validation Tested commit `6e23abc64d8d659c7f5ae57f5ae65ece4a9a1d38` on Windows 11 26H2 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. The runner reported `debug_layer=unavailable` on both backends. ```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-mip-junit.xml> python -B tools/form_coverage.py <absolute-path-to-mip-junit.xml> --records out/build/dev/form_coverage --json out/mip-coverage.json --gaps gfx1030 ``` CTest reported 41 passed, 0 failed and 0 skipped. This run also covered the upstream raw MUBUF vector reads on both backends. Each mip backend ran eight cases and compared 320 words per case with zero mismatches. Forcing LOD zero first failed at `word=32 expected=11000000 actual=10000000` in both address families. Reading the packed high half as the LOD first failed at `word=0 expected=10000000 actual=00000000`. Mutating one written word and one sentinel word also triggered the expected comparisons. The compute fixture executes translated desktop DXIL. The same-run JUnit coverage records `image_load` and `image_load_mip`, two of 111 gfx1030 MIMG mnemonics in `docs/coverage/rdna2.tsv` for this fixture set. ```sh python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 LLVM_LIB=libLLVM-15.so.1 LLVM_MC=llvm-mc-15 LLVM_OBJCOPY=llvm-objcopy-15 python3 -B tests/rdna2_tools_check.py python -B tests/form_coverage_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py ``` LLVM 15.0.7 assembled and decoded all eight mip cases from source on Ubuntu 22.04. The synthetic PSB container CLI emitted the same HLSL as direct text lowering. The disassembly suite ran 133 tests with one skip. The coverage and documentation checks passed. The [experiment notes](https://github.com/stan495/Xbox2Windows/blob/6e23abc64d8d659c7f5ae57f5ae65ece4a9a1d38/docs/experiments.md#gfx1030-2d-image-loads) document the bound SRV and descriptor assumptions.
tedin7 commented 2026-11-24 06:47:26 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Dual-platform review at commit b5810ee63ae58e0c919e8e065a6c12ff082540ae:

Verification

  • Linux (LLVM 19):
    • git diff --check origin/main...HEAD: passed
    • python -B tests/docs_links_check.py: passed (16 Markdown files, 284 links)
    • python -B tests/bidi_controls_check.py: passed (1064 files)
    • python -B tests/form_coverage_check.py: passed
    • LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed
    • LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python -B tests/rdna2_tools_check.py: 3 failures / 3 errors out of 133 tests (existing LLVM 15 syntax/boundary expectations in rdna2_tools_check.py, unrelated to this PR)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): cmake --build --preset dev --target offscreen_check -- -j 6 + ctest --preset dev -R '^(compute_store_aot_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' --parallel 4 --no-tests=error --output-on-failure -> 39/39 passed (50.53s, including compute_store_aot_mimg_mip_warp and compute_store_aot_mimg_load_warp)
    • Release /O2 (--preset release): cmake --build --preset release --target offscreen_check -- -j 6 + ctest --preset release -R '^(compute_store_aot_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' --parallel 4 --no-tests=error --output-on-failure -> 39/39 passed (47.55s)

Code Notes

  • tools/compute_store_aot.py cleanly unifies image_load and image_load_mip lowering for both 32-bit (x, y, mip) and a16 (packed_xy, mip_lo16) forms, verifying exact VGPR tuple width (len(vaddr) == min(address_words, 2)), contiguous registers, is_word provenance, and waitcnt ordering.
  • tests/compute_check.cpp preserves backward compatibility with single-mip .case files while loading 3 mip levels (32x8, 16x4, 8x2) when appended.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034728853 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1265#pullrequestreview-6034728853). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:35:10Z. **Review:** COMMENTED --- Dual-platform review at commit `b5810ee63ae58e0c919e8e065a6c12ff082540ae`: ### Verification - **Linux (LLVM 19)**: - `git diff --check origin/main...HEAD`: passed - `python -B tests/docs_links_check.py`: passed (16 Markdown files, 284 links) - `python -B tests/bidi_controls_check.py`: passed (1064 files) - `python -B tests/form_coverage_check.py`: passed - `LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: passed - `LLVM_LIB=/usr/lib/llvm-19/lib/libLLVM-19.so LLVM_MC=llvm-mc-19 LLVM_OBJCOPY=llvm-objcopy-19 python -B tests/rdna2_tools_check.py`: 3 failures / 3 errors out of 133 tests (existing LLVM 15 syntax/boundary expectations in `rdna2_tools_check.py`, unrelated to this PR) - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `cmake --build --preset dev --target offscreen_check -- -j 6` + `ctest --preset dev -R '^(compute_store_aot_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' --parallel 4 --no-tests=error --output-on-failure` -> **39/39 passed** (`50.53s`, including `compute_store_aot_mimg_mip_warp` and `compute_store_aot_mimg_load_warp`) - **Release `/O2` (`--preset release`)**: `cmake --build --preset release --target offscreen_check -- -j 6` + `ctest --preset release -R '^(compute_store_aot_|compute_root_|compute_tables_|offscreen_capability_table_self_test$)' --parallel 4 --no-tests=error --output-on-failure` -> **39/39 passed** (`47.55s`) ### Code Notes - `tools/compute_store_aot.py` cleanly unifies `image_load` and `image_load_mip` lowering for both 32-bit `(x, y, mip)` and `a16` `(packed_xy, mip_lo16)` forms, verifying exact VGPR tuple width (`len(vaddr) == min(address_words, 2)`), contiguous registers, `is_word` provenance, and waitcnt ordering. - `tests/compute_check.cpp` preserves backward compatibility with single-mip `.case` files while loading 3 mip levels (`32x8`, `16x4`, `8x2`) when appended.
upstream-sync closed this pull request 2026-11-24 08:01:21 +00:00
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!1258
No description provided.