startup: lower a loop around the v_interp_p1ll_f16 / v_interp_p2_f16 pair in the pixel stage #2746
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2754"
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 tedin7 on 2026-11-26T06:00:52Z.
Part 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.
precise, so RDNA 1 drops the sign of a -0 product (startup_gfx2hlsl_fma_mix_dispatch_hardware) #2721Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T08:18:29Z.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T08:18:42Z.
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.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T09:29:46Z.
Review: APPROVED
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.precise, so RDNA 1 drops the sign of a -0 product (startup_gfx2hlsl_fma_mix_dispatch_hardware) #2721precise, so RDNA 1 drops the sign of a -0 product (startup_gfx2hlsl_fma_mix_dispatch_hardware) #2721