shader: lower gfx1030 uniform coarse-gradient sampling #1576
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!1576
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1576/head"
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?
@stan495 on GitHub · 2026-11-24 14:32 UTC · original
stan495:codex/gfx1030-mimg-coarse-gradient→main· +99 −19 · 6 files · 1 commits · merged 2026-11-24 14:45 UTCSummary
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.@tedin7 on GitHub · 2026-11-24 14:37 UTC · original · reviewed
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.