shader: lower gfx1030 2D comparison gathers #1555

Merged
stan495 merged 1 commit from upstream-pr/1562 into main 2026-11-24 14:25:49 +00:00
stan495 commented 2026-11-24 14:04:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T14:04:43Z.


Summary

Lower image_gather4_c, _c_o, _c_lz, _c_lz_o, _c_l and _c_l_o for the existing gfx1030 2D gather profile. The comparison forms require red dmask:0x1, normalized clamp, contiguous addresses and finite depth and reference values in [0, 1]. Implicit LOD requires a single visible mip. Fixed LOD zero and known integral explicit LOD support a multi-mip view. Each of the four taps compares reference OP texel using the native sampler's comparison function. Offset forms accept the existing signed XY encoding.

Refs #1513

Verification

Tested clean head af72b13dff0d5603ff0620f7278096db6ef6c6af on upstream main a3633d4df879a46bd07d941ce8295e23ec3400a1.

. .\tools\dev.ps1
$root = (Get-Location).Path
cmake --preset dev -DINTAKE_PYTHON=<python.exe>
cmake --build --preset dev --target offscreen_check
$env:TEMP = "$root/out"
$env:TMP = $env:TEMP
ctest --preset dev --no-tests=error -R '^pixel_aot_(cmpx_regions|dmask|sample_lod|sample_offset|sample_gradient|three_way|get_lod|compare_sample|gather|compare_gather|compare)_(warp|hardware)$' -V --output-junit "$root/out/compare-gather-af72b13d.xml"
python -B tools/form_coverage.py out/compare-gather-af72b13d.xml --records out/build/dev/form_coverage --json out/compare-gather-af72b13d.coverage.json
python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py

CTest reported 22 passed, 0 failed and 0 skipped. Both comparison gather tests recorded all six forms. Thirteen translated draws and independent desktop HLSL GatherCmpRed draws on the selected mip agreed with the CPU reference on both adapters. Reversing the predicate first differed at (0,0), channel 1, with expected 1 and actual 0. Wrong reference, tap order, mip and offset controls also differed as intended. The fixture checks rejections for unsupported sampler and address combinations.

Windows 11 build 26300.9974, Intel Arc B390 driver 32.0.101.8509, Microsoft WARP 10.0.26100.9818. The debug layer was unavailable.

python3 -B tests/pixel_compare_gather_check.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
python3 -B tests/pixel_gather_check.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
python3 -B tests/pixel_compare_sample_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
python3 -B tests/pixel_sample_gradient_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 llc-15

All four LLVM 15 container checks and all three Python checks passed. The six new forms assembled, disassembled and lowered through the synthetic archive CLI. git diff --check origin/main...HEAD and git merge-tree --write-tree origin/main HEAD passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583573988 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1562). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T14:04:43Z. --- ## Summary Lower `image_gather4_c`, `_c_o`, `_c_lz`, `_c_lz_o`, `_c_l` and `_c_l_o` for the existing gfx1030 2D gather profile. The comparison forms require red `dmask:0x1`, normalized clamp, contiguous addresses and finite depth and reference values in `[0, 1]`. Implicit LOD requires a single visible mip. Fixed LOD zero and known integral explicit LOD support a multi-mip view. Each of the four taps compares `reference OP texel` using the native sampler's comparison function. Offset forms accept the existing signed XY encoding. Refs #1513 ## Verification Tested clean head `af72b13dff0d5603ff0620f7278096db6ef6c6af` on upstream main `a3633d4df879a46bd07d941ce8295e23ec3400a1`. ```powershell . .\tools\dev.ps1 $root = (Get-Location).Path cmake --preset dev -DINTAKE_PYTHON=<python.exe> cmake --build --preset dev --target offscreen_check $env:TEMP = "$root/out" $env:TMP = $env:TEMP ctest --preset dev --no-tests=error -R '^pixel_aot_(cmpx_regions|dmask|sample_lod|sample_offset|sample_gradient|three_way|get_lod|compare_sample|gather|compare_gather|compare)_(warp|hardware)$' -V --output-junit "$root/out/compare-gather-af72b13d.xml" python -B tools/form_coverage.py out/compare-gather-af72b13d.xml --records out/build/dev/form_coverage --json out/compare-gather-af72b13d.coverage.json python -B tests/form_coverage_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py ``` CTest reported 22 passed, 0 failed and 0 skipped. Both comparison gather tests recorded all six forms. Thirteen translated draws and independent desktop HLSL `GatherCmpRed` draws on the selected mip agreed with the CPU reference on both adapters. Reversing the predicate first differed at `(0,0)`, channel 1, with expected `1` and actual `0`. Wrong reference, tap order, mip and offset controls also differed as intended. The fixture checks rejections for unsupported sampler and address combinations. Windows 11 build `26300.9974`, Intel Arc B390 driver `32.0.101.8509`, Microsoft WARP `10.0.26100.9818`. The debug layer was unavailable. ```sh python3 -B tests/pixel_compare_gather_check.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 python3 -B tests/pixel_gather_check.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 python3 -B tests/pixel_compare_sample_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 python3 -B tests/pixel_sample_gradient_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 llc-15 ``` All four LLVM 15 container checks and all three Python checks passed. The six new forms assembled, disassembled and lowered through the synthetic archive CLI. `git diff --check origin/main...HEAD` and `git merge-tree --write-tree origin/main HEAD` passed.
upstream-sync closed this pull request 2026-11-24 15:02:00 +00:00
Makto94 commented 2026-11-24 16:03:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-24T15:14:32Z.


Hardware check of this PR (head of pr-1562, clean worktree build).

  • Adapter: NVIDIA GeForce RTX 3070 Ti, driver 621.01; Windows 11 Pro build 26300 (Insider); debug layer not enabled explicitly
  • Command: ctest --preset dev --no-tests=error -R '^pixel_aot_(compare_gather|gather|compare)_(warp|hardware)$' -j1
Test WARP Hardware
pixel_aot_compare_gather (new) Passed 3.6 s Passed 11.7 s
pixel_aot_gather Passed 3.6 s Passed 12.2 s
pixel_aot_compare Passed 9.5 s Passed 39.5 s

No capability skips. The binary LLVM round-trip (--binary) was not run here (no local gfx1030 LLVM).

Code read: moving check_gather_sampler into the gather match is safe, since lower() already refuses a sampler that is not four 32-bit words (and --sampler-words takes nargs=4). The comparison path requires red DMASK and adds the reference register to the address width as expected.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7135692152 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1562#issuecomment-7135692152). Originally posted by [Makto94](https://github.com/Makto94) on 2026-11-24T15:14:32Z. --- Hardware check of this PR (head of pr-1562, clean worktree build). - Adapter: NVIDIA GeForce RTX 3070 Ti, driver 621.01; Windows 11 Pro build 26300 (Insider); debug layer not enabled explicitly - Command: `ctest --preset dev --no-tests=error -R '^pixel_aot_(compare_gather|gather|compare)_(warp|hardware)$' -j1` | Test | WARP | Hardware | |---|---|---| | pixel_aot_compare_gather (new) | Passed 3.6 s | Passed 11.7 s | | pixel_aot_gather | Passed 3.6 s | Passed 12.2 s | | pixel_aot_compare | Passed 9.5 s | Passed 39.5 s | No capability skips. The binary LLVM round-trip (`--binary`) was not run here (no local gfx1030 LLVM). Code read: moving `check_gather_sampler` into the gather match is safe, since `lower()` already refuses a sampler that is not four 32-bit words (and `--sampler-words` takes `nargs=4`). The comparison path requires red DMASK and adds the reference register to the address width as expected.
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!1555
No description provided.