shader: probe native gfx1030 2D gather clamps #2742

Open
stan495 wants to merge 1 commit from upstream-pr/2750 into main
stan495 commented 2026-11-26 05:44:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-26T05:44:30Z.


Behavior

Generate source-built native gfx1030 probes for image_gather4_cl, image_gather4_b_cl, image_gather4_c_cl, image_gather4_c_b_cl, and the four signed-offset forms. The external graphics runner draws them with the three-level RGBA32F texture and native pixel ABI from #1643, which is already on main. This patch does not depend on the Vulkan bias runner.

A native image_get_lod draw checks implicit LOD 1 and twelve explicit-LOD draws pin mip layout and gather tap order. The sixteen instruction trials distinguish an upper or lower clamp, either bound before bias, and an ignored clamp. The readback classifier requires one model to explain all trials after the controls match. This is an integer-mip probe, not support for fractional thresholds or alternate views. No AOT lowering or semantic coverage is added.

Verification

Tested clean 82bb3631973008a5c96cf2e18b8ca81b0b4ec8b8, based on 651577a07f1d7122b21bf6f0010ee0903272b14c.

python3 -B tests/pixel_gather_clamp_probe.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
python3 -B tests/pixel_gather_bias_probe.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_gather_check.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
python3 -B tests/docs_links_check.py
python3 -B tests/bidi_controls_check.py
git diff --check HEAD^ HEAD

Ubuntu LLVM 15.0.7 assembled, extracted and disassembled all 29 clamp programs and matched exact instruction bytes for the eight clamp mnemonics. The adjacent checks passed: 24 existing bias shaders, 24 ordinary LLVM/archive CLI cases, six comparison LLVM/archive CLI forms, docs links, bidi controls and diff checks.

The classifier accepted all five synthetic model signatures, with 16 synthetic trial files and 13 synthetic controls per signature. For each signature, the synthetic control files use the emitted *.expected.rgba32f bytes; the trial files copy the expected mip bytes named by the manifest's model prediction. Replacing the mip-1 control with mip 2 returned 1 at image_gather4-explicit-mip1, pixel (0,0), tap 0: expected 4625, actual 8705. Mixing trials from two models also returned 1 (no unique clamp interpretation across all draws, candidates=[]). These are CPU-model readbacks, not native execution.

python3 -B tests/pixel_gather_clamp_probe.py --classify out/native-gather-clamp-readbacks

For hardware reproduction, draw the 29 shaders listed in out/gfx1030-gather-clamp-probe/manifest.json with a native gfx1030 graphics runner before running the classifier. Save all tightly packed RGBA32F readbacks and record the adapter, driver and runtime. Ordinary biased gather's Vulkan extension does not provide this path for clamp or comparison gather, so no Vulkan draw is claimed here. Native readbacks are pending. These standalone probes are not CTest cases and add no passing FORM_COVERAGE_RECORD entries.

Local merge simulation against 1ec01d7037d30fbdc383d48dceb43ad8c48e0f0b passed independently and with the Vulkan bias probe in either order. The merged tree was not used for the execution results above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6620380507 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2750). Originally posted by [stan495](https://github.com/stan495) on 2026-11-26T05:44:30Z. --- ## Behavior Generate source-built native gfx1030 probes for `image_gather4_cl`, `image_gather4_b_cl`, `image_gather4_c_cl`, `image_gather4_c_b_cl`, and the four signed-offset forms. The external graphics runner draws them with the three-level RGBA32F texture and native pixel ABI from #1643, which is already on `main`. This patch does not depend on the Vulkan bias runner. A native `image_get_lod` draw checks implicit LOD 1 and twelve explicit-LOD draws pin mip layout and gather tap order. The sixteen instruction trials distinguish an upper or lower clamp, either bound before bias, and an ignored clamp. The readback classifier requires one model to explain all trials after the controls match. This is an integer-mip probe, not support for fractional thresholds or alternate views. No AOT lowering or semantic coverage is added. ## Verification Tested clean `82bb3631973008a5c96cf2e18b8ca81b0b4ec8b8`, based on `651577a07f1d7122b21bf6f0010ee0903272b14c`. ```sh python3 -B tests/pixel_gather_clamp_probe.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 python3 -B tests/pixel_gather_bias_probe.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_gather_check.py --binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 python3 -B tests/docs_links_check.py python3 -B tests/bidi_controls_check.py git diff --check HEAD^ HEAD ``` Ubuntu LLVM 15.0.7 assembled, extracted and disassembled all 29 clamp programs and matched exact instruction bytes for the eight clamp mnemonics. The adjacent checks passed: 24 existing bias shaders, 24 ordinary LLVM/archive CLI cases, six comparison LLVM/archive CLI forms, docs links, bidi controls and diff checks. The classifier accepted all five synthetic model signatures, with 16 synthetic trial files and 13 synthetic controls per signature. For each signature, the synthetic control files use the emitted `*.expected.rgba32f` bytes; the trial files copy the expected mip bytes named by the manifest's model prediction. Replacing the mip-1 control with mip 2 returned 1 at `image_gather4-explicit-mip1`, pixel `(0,0)`, tap 0: expected `4625`, actual `8705`. Mixing trials from two models also returned 1 (`no unique clamp interpretation across all draws, candidates=[]`). These are CPU-model readbacks, not native execution. ```sh python3 -B tests/pixel_gather_clamp_probe.py --classify out/native-gather-clamp-readbacks ``` For hardware reproduction, draw the 29 shaders listed in `out/gfx1030-gather-clamp-probe/manifest.json` with a native gfx1030 graphics runner before running the classifier. Save all tightly packed RGBA32F readbacks and record the adapter, driver and runtime. Ordinary biased gather's Vulkan extension does not provide this path for clamp or comparison gather, so no Vulkan draw is claimed here. Native readbacks are pending. These standalone probes are not CTest cases and add no passing `FORM_COVERAGE_RECORD` entries. Local merge simulation against `1ec01d7037d30fbdc383d48dceb43ad8c48e0f0b` passed independently and with the Vulkan bias probe in either order. The merged tree was not used for the execution results above.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2750:upstream-pr/2750'
git switch 'upstream-pr/2750'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2750'
git switch 'upstream-pr/2750'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2750'
git switch 'upstream-pr/2750'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2750'
git switch 'main'
git merge --squash 'upstream-pr/2750'
git switch 'main'
git merge --ff-only 'upstream-pr/2750'
git switch 'main'
git merge 'upstream-pr/2750'
git push origin 'main'
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!2742
No description provided.