startup: accept v_fma_mix reading the low half of a plain v_interp_p2_f16 result #2789
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!2789
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2789/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 09:20 UTC · original
tedin7:x2w-interp-hi-read→main· +80 −2 · 2 files · 4 commits · closed without mergingPart of #1723
What this unblocks: pixel programs that feed a plain
v_interp_p2_f16result tov_fma_mix_f32as a binary16 low half no longer stop at "reads the upper 16 bits".Source: AMD RDNA2 ISA guide, VOP3P
v_fma_mix_f32/v_fma_mixlo_f16/v_fma_mixhi_f16:op_sel_hi[i]set means source i is binary16, andop_sel[i]picks its upper half (clear = low half).v_interp_p2_f16without op_sel 0x8 writes only the low 16 bits of its destination.Stage.mixalready lowers this exactly, includingop_selon binary32 sources refused.What changed
interp_f16_scanrefused every reader of a plain p2 result exceptv_cvt_f32_f16. Av_fma_mix*whose every source naming that register hasop_sel_hiset andop_selclear reads only defined bits, so it is accepted.v_fma_mix_f32rewrites the whole 32-bit destination, so no half of the old value survives: the register leaves the undefined-half state.Also fixed in the same scan:
exp mrt0 v4, ...parses with the export target glued to the first channel, so the scan never saw the first exported register; a plain p2 result exported as channel x went unchecked (found by mutation: dropping the "mix rewrites the destination" step survived). The first channel is read now.What stays refused: an
op_selpick of the upper half, a binary32 source (noop_sel_hi), and every other reader of an undefined upper half.Tests:
startup_gfx2hlsl_interp_f16_check.pygains four llvm-mc-verified variants (plus adrawreadback, below) (low half accepted and evaluated against the binary32 product, upper-half pick refused, binary32 source refused, plain p2 result exported as the first channel refused). The accepted case is refused on main with the old message.Verification:
python3 -B tests/startup_gfx2hlsl_interp_f16_check.py-> controls ok; on origin/main the same file fails with "v_fma_mix_f32 reads the upper 16 bits of the v_interp_p2_f16 result v4: not modelled".python3 -B tests/startup_gfx2hlsl_interp_f16_check.py binary llvm-mc-19-> fixture words match llvm-mc.startup_gfx2hlsl_interp_p2_hi_check.py,startup_gfx2hlsl_fma_mix_check.py-> pass.remote_pycheck.sh <worktree> --compare origin/main-> 0 scripts differ from main.drawmode: the translatedfma_mix low halfpixel stage is drawn and read back against the ISA arithmetic (binary16 low half squared in binary32), with two wrong-reference controls that must mismatch (plain pair vs mix reference, mix program vs plain reference).startup_gfx2hlsl_interp_f16_{controls,warp,hardware}3/3 passed at head959b38b64.passnow fails the check.AI-assisted; commands listed were executed locally.
@tedin7 on GitHub · 2026-11-26 09:49 UTC · original
Independent Stage-2 review of head
959b38b6: PASS (round 2; round 1 failed on a missing GPU readback and a surviving mutant, both fixed in663c84f1).v_fma_mix_f32low-half case is drawn and read back (startup_gfx2hlsl_interp_f16_{warp,hardware}, with two wrong-reference controls that must mismatch), and the "mix rewrites the destination" step is now covered (mutation caught).startup_gfx2hlsl_interp_f16_check.py:op_selignored (upper half accepted): caught; binary32 source accepted: caught; destination state kept after av_fma_mix_f32: caught; first exported channel not read: caught. One survivor is equivalent (the instruction-name guard inmix_low_onlyis redundant, since non-mix rows carry noop_sel_himodifier).origin/main;remote_pycheck.sh --compare origin/main: 0 scripts differ;startup_gfx2hlsl_interp_f16_check.py, itsbinary llvm-mc-19mode,interp_p2_hi,fma_mixpass.Part of #1723,What this unblocks:,Source:(AMD RDNA 2 ISA guide, VOP3Pv_fma_mix_f32and VINTRPv_interp_p2_f16),Verification:and the signature line are present.Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
959b38b64871c58172eeb2b15fbc5ec846ec0508:--preset dev):cmake --build --preset dev --target offscreen_check -- -j 2thenctest --preset dev -R '^startup_gfx2hlsl_(interp_f16|interp_p2_hi|fma_mix)' --no-tests=error --output-on-failure: 8/8 passed (startup_gfx2hlsl_interp_f16_controls,_warp,_hardware,startup_gfx2hlsl_interp_p2_hi_controls,startup_gfx2hlsl_fma_mix,_fxc,_dispatch_warp,_dispatch_hardware)./O2(--preset release): the same build and ctest command with--preset release: 8/8 passed, same eight tests.bash runpod_test.sh 2789).AI-assisted; commands listed were executed locally.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 09:49 UTC · original · edited 2026-11-26 09:56 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
959b38bℹ️ 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.
@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 09:55 UTC · original · reviewed
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
959b38b648ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@ -8404,3 +8425,3 @@raise Unsupported('v%d is the v_interp_p1ll_f16 result, which emits nothing: %s reads it after ''a v_interp_p2_f16 that wrote another register' % (r, n))if r in high_undefined and not (low_reader and r == int(ops[1][1:])):if r in high_undefined and not (low_reader and r == int(ops[1][1:])) and not mix_low_only(n, ops, mods, r):@chatgpt-codex-connector[bot] on GitHub · 2026-11-26 09:55 UTC · original
With plain
v_interp_p2_f16results inv4andv5,v_fma_mix_f32 v4, v4, |v5|, 0 op_sel:[0,1,0] op_sel_hi:[1,1,0]is now accepted despite reading the unmodelled upper half ofv5. The scan buildsreadusingregs(o), which does not recognize|v5|or-v5, so the newmix_low_onlyexception validates onlyv4. Mutating the added low-half fixture this way succeeds, whereas the parent refuses it, and emitsf16tof32(v5 >> 16), allowing unmodelled bits to affect the exported result. Normalize negation/absolute-value modifiers when collecting source registers, and add a refusal control using distinct interpolation-result registers.Useful? React with 👍 / 👎.
@tedin7 on GitHub · 2026-11-26 10:12 UTC · original
Withdrawn: shader translation is moving to the native C++ frontend (see #870), so we are not continuing this change to the Python translator. The branch stays available if any part is useful later. Thank you to everyone who reviewed and tested it.
Pull request closed