shader: lower gfx1030 2D comparison gathers #1562

Manually merged
github merged 1 commit from gh-pr/1562/head into gh-pr/1562/base 2026-11-26 23:16:49 +00:00
Owner

@⁠stan495 on GitHub · 2026-11-24 14:04 UTC · original
stan495:codex/gfx1030-mimg-compare-gather-upstream → main · +309 −17 · 7 files · 1 commits · merged 2026-11-24 14:25 UTC

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.

**@⁠stan495** on GitHub · 2026-11-24 14:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1562) `stan495:codex/gfx1030-mimg-compare-gather-upstream` → `main` · +309 −17 · 7 files · 1 commits · merged 2026-11-24 14:25 UTC ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:16:47 +00:00
github manually merged commit af72b13dff into gh-pr/1562/base 2026-11-26 23:16:49 +00:00
Author
Owner

@⁠Makto94 on GitHub · 2026-11-24 15:14 UTC · original

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.

**@⁠Makto94** on GitHub · 2026-11-24 15:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1562#issuecomment-7135692152) 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.