shader: lower gfx1030 non-comparison 2D gathers #1506
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1513"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T13:24:49Z.
Summary
Lower six gfx1030 contiguous-address 2D non-comparison
image_gather4*forms for a matching float4 SRV. Use a one-hot DMASK, normalized XY clamp, and one visible mip for implicit LOD. Explicitlzand known integrallcan address a multi-mip view. The_oforms take a static signed six-bit XY displacement. The lowering reads four taps withLoadand requires coordinates whose footprints agree at native and desktop precision. Comparison gathers and other unverified modifiers are outside this PR.The test renderer adds a dedicated gather operation without changing the sampling, comparison, MSAA or #1445 raw-LOD paths.
Verification
Tested clean head
7536843c8e154a91a2c73ac8fd352ff28c1e9a09.CTest: 18 passed, 0 failed, 0 skipped. Both gather records contain all six forms. Each backend compares desktop DXIL for all 24 opcode and mask pairs with an independent CPU reference over 64 pixels and 256 exact channel values per case. Direct desktop HLSL
Gather{Red,Green,Blue,Alpha}also matches the CPU reference at view mip zero. The wrong-channel control first differs at(0,0), channel 0:4609expected,4353actual. Swapped taps first differ at(0,1),4625versus4609; forcing mip zero at(0,0)changes4609to529, and zero-extending a negative offset changes817to824. Unsupported masks, operands, sampler modes and waits are rejected by the fixture.Windows 11 build
26300.9974; Intel Arc B39032.0.101.8509; Microsoft WARP10.0.26100.9818. Debug layer unavailable on both.Both LLVM checks passed. The gather check assembles and disassembles all 24 pairs and checks identical HLSL via the synthetic-container CLI.
git diff --checkpassed.git merge-tree --write-tree refs/remotes/origin/main HEADpassed against7b0d795484155cced986e687be56e974479bf259, including a separate simulation after #1504 and #1507. Those simulations did not execute fixtures.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T13:31:31Z.
Review: COMMENTED
Reviewed
7536843c8e154a91a2c73ac8fd352ff28c1e9a09:tools/pixel_aot.pylowers six gfx1030 non-comparison 2Dimage_gather4*forms (image_gather4,_o,_lz,_lz_o,_l,_l_o) viagather_2dusing fourLoadtaps in(0,1), (1,1), (1,0), (0,0)order. Sampler validation (check_gather_sampler), signed 6-bit packed XY offset decoding (gather_offset), one-hot DMASK check, single-mip requirement for implicit LOD, known integral LOD bounds check for_l, register-range/outstanding-load checks, andsample_kind != "gather"guard at the end oflower()are all consistent.tests/pixel_gather_check.py,tests/pixel_aot_render.cpp,tests/offscreen_check.cpp,CMakeLists.txt,.github/workflows/windows.yml,README.md, anddocs/experiments.mdwire up the fixture, controls, and negative mutations.git diff --check origin/main..HEAD,python3 tests/docs_links_check.py(340 links across 16 files), andpython3 tests/bidi_controls_check.py(1234 files) all passed.python3 -B tests/pixel_gather_check.py --binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM.so.1passed (all 24 LLVM-assembled CLI cases + controls).tests/form_coverage_check.py: passed (42.51s).--preset dev):offscreen_checkbuilt (35.05s);ctest --preset dev -R '^pixel_aot_(gather|compare_sample|compare|sample_offset|sample_lod|dmask|get_lod|three_way|cmpx_regions)_(warp|hardware)$' --parallel 4 --no-tests=error --output-on-failure— 18/18 passed (41.28s, includingpixel_aot_gather_warpandpixel_aot_gather_hardware)./O2(--preset release):offscreen_checkbuilt (51.76s); same CTest filter — 18/18 passed (40.81s).Looks good to me.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T14:59:18Z.
Both the tap order and the offset sign extension are covered
Independent reviewer, not the author. Reviewed
7536843c; nothing pushed to the branch. Mutations were made locally intools/pixel_aot.py, reverted between each; working tree is clean.Environment: Windows 11 build 26300.9974, MSVC 14.44.35207, SDK 10.0.26100, DXC 1.8.2502.11, LLVM gfx1013 tooling
available, RTX 5080 Laptop (32.0.15.8142) for
_hardware.Mutation 1 — the first and last taps exchanged
The emitted helper loads
(0,1),(1,1),(1,0),(0,0)into the four components. Swapping the first and the last:Good: the component order is asserted, not just "four taps happen".
Mutation 2 — the six-bit offset loses its sign extension
So the fixture actually uses a negative offset somewhere; a bias-by-32 error is caught rather than being invisible because
all offsets happen to be positive.
What I did not test
The
check_gather_samplerrefusals (non-clamp addressing, non-bilinear XY, LOD modifiers). Those are ValueError paths inthe translator; I can drive them by editing the case words if you want them confirmed, but they are cheap to reason about
and I did not want to guess at which sampler word layout you consider canonical.
Verdict
Reviewed
7536843c. Builds clean, both gather cases pass on WARP and on a physical adapter, and two independentmutations in the emitted taps and in the offset decode are caught. No objection from me.