startup: lower a loop around the v_interp_p1ll_f16 / v_interp_p2_f16 pair in the pixel stage #2754
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!2754
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2754/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?
@tedin7 on GitHub · 2026-11-26 06:00 UTC · original
tedin7:x2w-interp-f16-loop→main· +74 −4 · 2 files · 1 commits · merged 2026-11-26 09:29 UTCPart of #1723
What this unblocks: pixel programs that wrap the
v_interp_p1ll_f16/v_interp_p2_f16pair in a loop, which were refused with "a backward branch in a program with v_interp_p1ll_f16 / v_interp_p2_f16".Source: AMD "RDNA 2" Instruction Set Architecture reference guide, VINTRP instructions V_INTERP_P1LL_F16 and V_INTERP_P2_F16 (parameter interpolation with binary16 data).
What changed
Stage.interp_f16_scanno longer refuses a backward branch. The scan is linear and holds three kinds of state: a p1ll result waiting for its p2, a p1ll result left stale by a p2 that wrote elsewhere, and a p2 destination whose upper half is undefined. Every branch instruction and every branch target is already a boundary where the scan refuses when any of that state is non-empty. Nothing it tracks can therefore travel along a back edge, and the loop head starts clean on every iteration.Why it is correct
i.param0.xand so on), which is the same value on every iteration. The loop only repeats the pair and its full-width conversion.What stays refused
Tests
startup_gfx2hlsl_interp_f16_check.py: a constant-trip loop (two iterations, scalar counter) around the pair translates and evaluates to the reference words; the same loop with the high bit inverted evaluates to other words; the two loops that carry state along the back edge are refused. The fixture words are checked against llvm-mc (binarymode, back-edge fixup patched). The existingdrawmode now also runs the loop on D3D12 WARP with a wrong-value control (high bit inverted must fail), andcompilemode compiles it.Verification
python3 -B tests/startup_gfx2hlsl_interp_f16_check.pyand... binary llvm-mc-19pass; the same test fails on main at the loop translation (backward-branch refusal).tests/startup_gfx2hlsl_interp_p2_hi_check.pypasses; the fulltests/startup_*check.pyset has no result that differs from main.AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-26 08:18 UTC · original
Independent review of head
5626c049a5: PASS.Verification:
ctest -R '^startup_gfx2hlsl_interp': dev 4/4 and release 4/4 (startup_gfx2hlsl_interp_p2_hi_controls,_f16_controls,_f16_warp,_f16_hardware).python3 -B tests/startup_gfx2hlsl_interp_f16_check.py binary llvm-mc-19passes.AI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 08:18 UTC · original · edited 2026-11-26 08:22 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
5626c04ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
@R0Y00 on GitHub · 2026-11-26 09:29 UTC · original · approved these changes
Reviewed
5626c049: the scan still requires an empty interpolation state at every branch instruction and target. The change removes only the direction-specific rejection. The independent controls refused a pending p1ll and an unconverted p2 across the latch. The source-built loop matched the DXC pixel reference on native WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 (Windows 11 build 26200), and the high-half mutation failed on both. Command:python -B tests/startup_gfx2hlsl_interp_f16_check.py draw <dxc> <offscreen_check> <warp|hardware>. I used the repository's compatible renderer built at06574c9d; all shader inputs and lowering were from the exact PR head.github-bot referenced this pull request2026-11-28 22:11:18 +00:00
github-bot referenced this pull request2026-11-28 22:12:40 +00:00