shader: allow safe entry interpolation in pixel loops (Part of #3814) #3833
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!3833
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3831"
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?
@timbot103 on GitHub · 2026-12-02 07:57 UTC · original
timbot103:shader/pixel-loop-entry-inputs→main· +274 −28 · 4 files · 1 commits · merged 2026-12-02 10:11 UTCAllows safe entry attribute interpolation (
v_interp_mov_f32flat fetches and same-blockv_interp_p1_f32/v_interp_p2_f32pairs whose entry barycentrics are preserved on all reaching CFG paths) after branches in looping pixel shaders, clearing"looping graphics shader uses an entry input operation after a branch"(~315 pixel stages in #3816, including the main second wall exposed by #3817).Part of #3816. Refs #3642, #3643, #3705, #3817.
(Opened as Draft per #3516 until an active review slot frees.)
Summary
src/gfx1013_direct_graphics.inl(emit_graphics_loops):read.pc > last_loop_edgelinear scan with an exact CFG dataflow overg.overwritten_inputs(recording all lowered VGPR writes per block, includingv_interp_p1_f32and implicitv_swap_b32destinations, and propagating them across all CFG edges including back-edges).v_interp_mov_f32loads before, inside, and after loops (subject to the existing selector/attribute checks ingraphics.interpolate).v_interp_p1_f32/v_interp_p2_f32pairs in any pixel loop block whenever no in-block prefix write and no reaching CFG path (including loop back-edges) clobbers the barycentric source VGPR. Allows P1 to overwrite its own source after consuming it when no path returns to that read, while refusing if P1 overwrites P2's source or a back-edge returns to the read.Encoding::Fetch,op == 3, cross-block split P1/P2 pairs, non-barycentric sources, and invalid flat selectors strictly refused.tests/native_pixel_loop_entry_inputs_check.py+tests/cmake/native_pixel_loop_entry_inputs.cmake+docs/experiments/native-pixel-loop-entry-inputs.md:native_pixel_loop_entry_inputs_controls(runs automatically in theprCTest preset): 4 positive shapes (CMPX if/else join before loop, smooth interpolation inside loop, flat loads before/inside/after loop, smooth P1 self-overwrite after loop) + 9 fail-closed refusal controls (loop clobbers I/J after pair, loop P1 overwrites own source, pre-loop arm clobber,v_swap_b32clobber, P1 clobbers P2 source, split pair, non-barycentric source, invalid flat selector).native_pixel_loop_entry_inputs_warp&native_pixel_loop_entry_inputs_hardware: four 8×2 draws on WARP and RTX 5080, each paired with a wrong-trip-count mismatch control (all 16 pixels differ).Verification
Host: Windows 11 (
10.0.26200.9974), MSVC19.44.35230(C++20/W4, zero new warnings), DXC1.9.2602.17, inbox WARP (10.0.26100.9818), NVIDIA GeForce RTX 5080 (32.0.16.2140; D3D12 debug layer unavailable). Baseorigin/mainf365f125.ctest --preset pr --no-tests=error -R "^native_pixel_loop_entry_inputs_controls$": 1/1 passed.dev) & Release (release): 15/15 passed in both configs (native_pixel_loop_entry_inputs_{controls,warp,hardware},native_pixel_cmpx_*,native_pixel_compare_mask_*,native_pixel_dxil,native_graphics_wqm_*,native_direct_container), zero skips.tests/bidi_controls_check.py,tests/docs_links_check.py,git diff --check origin/main..HEAD: all clean.@lukaslw-lab on GitHub · 2026-12-02 08:05 UTC · original · approved these changes
Reviewed
7f029c4e(draft) by reading the diff; not built or run.Verdict: approve. The CFG dataflow is a sound replacement for the old "after the last back edge" scan, and it fails closed. No MUST.
ps86census onf365f125before and after would give the real gain (follow-up is fine).after_graphics_write→overwritten_inputs(gfx1013_direct_graphics.inl:1912), including load destinations and bothv_swap_b32operands. So dropping the explicit Image/MUBUF/LDS ranges of the oldentry_barycentricloses nothing. The set is cleared per block (:1587), sowritten[label]is that block's own writes.:66,:1608).src == base + (op==1)). Each is recorded separately, so a clobber of only J is still caught. MOV has no VGPR source.interpolateloads the attribute from the input signature (load(generic(...))) and uses I/J only as provenance. Interpolating inside a loop with lane-varying trip counts therefore needs no derivatives or helper lanes.Fetchand op 3 stay refused.Tests:
_controls(4 shapes, 9 refusals, including a back-edge clobber,v_swap_b32and P1 overwriting P2's source) is in theprfilter._warp/_hardwarehave wrong-trip-count controls and ran only locally.@timbot103 on GitHub · 2026-12-02 09:34 UTC · original
Promoted to Ready for review now that #3808 and #3828 merged (keeping at 5/5 non-draft PRs per #3516). Re-checked
CLEAN / MERGEABLEagainstorigin/main(45c809ab) with all CI checks green.@R0Y00 on GitHub · 2026-12-02 10:07 UTC · original · approved these changes
Independent Windows Debug result at
7f029c4e:ctest --preset dev --no-tests=error -j 1 -R '^native_pixel_loop_entry_inputs_(controls|warp|hardware)$' --output-on-failurepassed 3/3. The control-flow refusals and both pixel readbacks passed. Windows 11 26300.9974, WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, with the offscreen fixture's D3D12 debug layer enabled.@lukaslw-lab on GitHub · 2026-12-02 10:34 UTC · original
Census follow-up for the SHOULD in my review:
f365f125+ this PR alone, same capture and method as #3816 (6,436 distinct pixel stages). Counts only. None lost, no validation failures.looping graphics shader uses an entry input operation after a branchf365f125f365f125+ #3833All 315 now stop at the same next wall,
graphics readfirstlane requires a wave-uniform reaching value, so the interpolation part is cleared and the loop'sv_readfirstlaneis what remains.