shader: lower gfx1030 2D comparison sampling offsets #1480

Merged
stan495 merged 1 commit from upstream-pr/1487 into main 2026-11-24 13:09:42 +00:00
stan495 commented 2026-11-24 12:47:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T12:47:01Z.


Summary

Lower gfx1030 image_sample_c, image_sample_c_o, and image_sample_c_lz_o in the pixel AOT translator for a single 2D R32_FLOAT view and a comparison sampler. Implicit forms require quad-provenance UVs and a zero source LOD range, with desktop maximum LOD zero or a one-mip view. Offset forms decode two signed six-bit fields and require the DXIL immediate range [-8, 7]. The contiguous address is optional offset, reference, then UV. The existing explicit-zero NSA path is unchanged.

Replays only the comparison sampling patch from stan495/Xbox2Windows#12. The ordinary offset parent, #1451, has merged. Related to #1471, which covers a separate gfx1013 startup translation and sampler binding path; neither PR depends on the other.

Verification

Tested clean head d34ee740ad0edbad234e64427b6c0ef59d7272e6.

. .\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 -j 1 -R '^pixel_aot_(compare_sample|compare|sample_offset|sample_lod|dmask|get_lod)_(warp|hardware)$' -V --output-junit "$root/out/compare-sampling-d34ee740.xml"
python -B tools/form_coverage.py out/compare-sampling-d34ee740.xml --records out/build/dev/form_coverage --json out/compare-sampling-d34ee740.coverage.json
python -B tests/form_coverage_check.py
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py

CTest: 12 passed, 0 failed, 0 skipped. Both passing comparison sample records contain all three new gfx1030 forms. The translated DXIL matches independent point and bilinear CPU references over the full 8x8 and 16x16 targets. With (1,-2) incorrectly replaced by zero, both offset forms first differ at (3,0), channel 0 (1 expected, 0 actual) at size 8. The size 16 bilinear control first differs at (5,0) (0.25 expected, 0 actual). Rejections include missing quad provenance, a nonzero maximum LOD, unsupported offsets, masks and address forms, and an outstanding destination write.

Windows 11 build 26300.9974; Intel Arc B390 32.0.101.8509; Microsoft WARP 10.0.26100.9818. Debug layer unavailable on both backends.

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

LLVM 15 round-trips all three forms and verifies the synthetic-container CLI emits matching HLSL. git diff --check origin/main...HEAD passed. git merge-tree --write-tree origin/main HEAD passed against 5065b57450c19208a6199ae347d5ba6c057020b3; a separate simulation with #1485 applied first also passed. No integrated GPU test run is claimed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6582112032 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1487). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T12:47:01Z. --- ## Summary Lower gfx1030 `image_sample_c`, `image_sample_c_o`, and `image_sample_c_lz_o` in the pixel AOT translator for a single 2D `R32_FLOAT` view and a comparison sampler. Implicit forms require quad-provenance UVs and a zero source LOD range, with desktop maximum LOD zero or a one-mip view. Offset forms decode two signed six-bit fields and require the DXIL immediate range `[-8, 7]`. The contiguous address is optional offset, reference, then UV. The existing explicit-zero NSA path is unchanged. Replays only the comparison sampling patch from stan495/Xbox2Windows#12. The ordinary offset parent, #1451, has merged. Related to #1471, which covers a separate gfx1013 startup translation and sampler binding path; neither PR depends on the other. ## Verification Tested clean head `d34ee740ad0edbad234e64427b6c0ef59d7272e6`. ```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 -j 1 -R '^pixel_aot_(compare_sample|compare|sample_offset|sample_lod|dmask|get_lod)_(warp|hardware)$' -V --output-junit "$root/out/compare-sampling-d34ee740.xml" python -B tools/form_coverage.py out/compare-sampling-d34ee740.xml --records out/build/dev/form_coverage --json out/compare-sampling-d34ee740.coverage.json python -B tests/form_coverage_check.py python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py ``` CTest: 12 passed, 0 failed, 0 skipped. Both passing comparison sample records contain all three new gfx1030 forms. The translated DXIL matches independent point and bilinear CPU references over the full 8x8 and 16x16 targets. With `(1,-2)` incorrectly replaced by zero, both offset forms first differ at `(3,0)`, channel 0 (`1` expected, `0` actual) at size 8. The size 16 bilinear control first differs at `(5,0)` (`0.25` expected, `0` actual). Rejections include missing quad provenance, a nonzero maximum LOD, unsupported offsets, masks and address forms, and an outstanding destination write. Windows 11 build `26300.9974`; Intel Arc B390 `32.0.101.8509`; Microsoft WARP `10.0.26100.9818`. Debug layer unavailable on both backends. ```sh python3 -B tests/pixel_compare_sample_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` LLVM 15 round-trips all three forms and verifies the synthetic-container CLI emits matching HLSL. `git diff --check origin/main...HEAD` passed. `git merge-tree --write-tree origin/main HEAD` passed against `5065b57450c19208a6199ae347d5ba6c057020b3`; a separate simulation with #1485 applied first also passed. No integrated GPU test run is claimed.
tedin7 commented 2026-11-24 13:00:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:57:39Z.

Review: COMMENTED


Reviewed at commit d34ee740ad0edbad234e64427b6c0ef59d7272e6:

Code & Diff Audit

  • tools/pixel_aot.py: cleanly extracts sample_offset_arg() so plain and comparison sampling share packed 6-bit offset decoding, [-8, 7] bounds checking, and vmcnt hazard validation. Extending comparison sampling to image_sample_c, image_sample_c_o, and image_sample_c_lz_o properly enforces contiguous addresses for the new forms, MAX_LOD 0 and quad-provenance UVs (address[1:] after popping the offset) for implicit-LOD forms, and emits SampleCmp vs SampleCmpLevelZero with optional int2(x, y).
  • tests/pixel_compare_sample_check.py: validates all three forms against independent point and bilinear Fraction-based CPU references and covers negative controls (missing quad provenance, nonzero MAX_LOD, non-canonical/out-of-range/unknown offsets, NSA on new forms, dmask:0x2, a16, and outstanding vmcnt writes).
  • Clean merge with origin/main.

Verification

  • Linux checks: tests/docs_links_check.py (16 files, 335 links), tests/bidi_controls_check.py (1,219 files), git diff --check origin/main..HEAD, and python3 -B tests/pixel_compare_sample_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so all passed (Three gfx1030 2D comparison sample forms checked).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Python check: tests/form_coverage_check.py passed (42.99s).
    • Debug (--preset dev): ctest --preset dev -R '^pixel_aot_(compare_sample|compare|sample_offset|sample_lod|dmask|get_lod)_(warp|hardware)$' 12/12 passed (26.27s, including pixel_aot_compare_sample_warp 4.63s and pixel_aot_compare_sample_hardware 5.37s).
    • Release /O2 (--preset release): same filter 12/12 passed (26.27s, including pixel_aot_compare_sample_warp 4.50s and pixel_aot_compare_sample_hardware 5.15s).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6039587403 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1487#pullrequestreview-6039587403). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:57:39Z. **Review:** COMMENTED --- Reviewed at commit `d34ee740ad0edbad234e64427b6c0ef59d7272e6`: ### Code & Diff Audit - `tools/pixel_aot.py`: cleanly extracts `sample_offset_arg()` so plain and comparison sampling share packed 6-bit offset decoding, `[-8, 7]` bounds checking, and `vmcnt` hazard validation. Extending comparison sampling to `image_sample_c`, `image_sample_c_o`, and `image_sample_c_lz_o` properly enforces contiguous addresses for the new forms, `MAX_LOD 0` and quad-provenance UVs (`address[1:]` after popping the offset) for implicit-LOD forms, and emits `SampleCmp` vs `SampleCmpLevelZero` with optional `int2(x, y)`. - `tests/pixel_compare_sample_check.py`: validates all three forms against independent point and bilinear `Fraction`-based CPU references and covers negative controls (missing quad provenance, nonzero `MAX_LOD`, non-canonical/out-of-range/unknown offsets, NSA on new forms, `dmask:0x2`, `a16`, and outstanding `vmcnt` writes). - Clean merge with `origin/main`. ### Verification - **Linux checks**: `tests/docs_links_check.py` (16 files, 335 links), `tests/bidi_controls_check.py` (1,219 files), `git diff --check origin/main..HEAD`, and `python3 -B tests/pixel_compare_sample_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so` all passed (`Three gfx1030 2D comparison sample forms checked`). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - Python check: `tests/form_coverage_check.py` passed (`42.99s`). - Debug (`--preset dev`): `ctest --preset dev -R '^pixel_aot_(compare_sample|compare|sample_offset|sample_lod|dmask|get_lod)_(warp|hardware)$'` **12/12 passed** (`26.27s`, including `pixel_aot_compare_sample_warp` `4.63s` and `pixel_aot_compare_sample_hardware` `5.37s`). - Release `/O2` (`--preset release`): same filter **12/12 passed** (`26.27s`, including `pixel_aot_compare_sample_warp` `4.50s` and `pixel_aot_compare_sample_hardware` `5.15s`).
upstream-sync closed this pull request 2026-11-24 14:02:53 +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!1480
No description provided.