shader: lower gfx1030 uniform coarse-gradient sampling #1569
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1576"
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-24T14:32:17Z.
Summary
Lower gfx1030
image_sample_cd,image_sample_cd_o,image_sample_cd_g16, andimage_sample_cd_o_g16for contiguous 2D addresses,dmask:0xf, and statically known finite slopes. The full and packed gradient operands reuse the existingSampleGradlowering. Identical slope words across lanes make the coarse lane selection immaterial to this profile. The tests reject dynamic slopes and non-finite operands. Native lane selection for varying slopes is outside the profile.Refs #1507
Verification
Tested clean head
0479b8dece5fe54196605ae106c76199e8287fbaon5042ab7514a4f5715795da44f5899b437c40d8d5.CTest reported 10 passes, 0 failures and 0 skips. Both coarse-gradient records contain all four forms. The tests check two-mip and four-mip textures and a spatial ramp against the expected readback. Zeroing the slopes first changed
(0,0)from green to red. Channel 0 was expected0and read1. Zeroing the signed offset also changed the first pixel. The translator rejects a gradient loaded from a constant buffer asCoarse gradients require statically known slopes.Windows 11 build
26300.9974, Intel Arc B390 driver32.0.101.8509, Microsoft WARP10.0.26100.9818. The debug layer was unavailable.Both LLVM 15 checks passed. The four coarse forms assembled, disassembled and translated through the synthetic-container CLI.
git diff --checkandgit merge-tree --write-treepassed againstbe484d0f12aa6e7d6e755cbded6068dd7172a1f4, including a simulation landing #1565 and #1568 first.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T14:37:07Z.
Review: COMMENTED
Looks good overall. Reviewed the lowering in
tools/pixel_aot.py, test coverage intests/pixel_sample_gradient_check.py, and docs/build integration at0479b8dece5fe54196605ae106c76199e8287fba.Semantic & Edge-Case Review
image_sample_cd{,_o}{,_g16}tocpu == "gfx1030"anddmask:0xfmatches the explicit-gradientimage_sample_d*path and RDNA2 active address operand layout.known_ssa_bits.get(vector[reg])acrosscoord_regs[:-2]rejects lane-varying/runtime slopes (s60/buffer loads), and checking the exponent masks (0x7c00for both packed FP16 halves ing16,0x7f800000for FP32) rejectsInf/NaNwhile allowing finite normals, subnormals, and±0.check_coarse_lowering()andcheck_binary(..., coarse=True)verify equivalence withimage_sample_d*, rejection on non-gfx1030, rejection of non-static and non-finite slopes, andllvm-mc/libLLVMround-trip.Verification
python3 -B tests/pixel_sample_gradient_check.py— passed.python3 -B tests/pixel_sample_gradient_check.py binary llvm-mc-19 llvm-objcopy-19 libLLVM-19.so llc-19andbinary-coarse— passed.python3 -B tests/pixel_sample_offset_check.py,python3 -B tests/pixel_aot_check.py,python3 -B tests/docs_links_check.py,python3 -B tests/bidi_controls_check.py— passed.--preset dev):offscreen_checkbuilt (29.03s),ctest --preset dev -R '^pixel_aot_sample_(coarse_)?gradient_'4/4 passed (5.52s)./O2(--preset release):offscreen_checkbuilt (41.52s),ctest --preset release -R '^pixel_aot_sample_(coarse_)?gradient_'4/4 passed (5.50s).tests/pixel_sample_gradient_check.py— passed (3.1s).AI-assisted; commands listed were executed locally.