startup: carry the undefined upper half through v_mov / v_cndmask copies and read VOP3 modifiers in the f16 interpolation scan #2792
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!2792
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2792/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:40 UTC · original
tedin7:x2w-interp-f16-copy→main· +135 −3 · 2 files · 5 commits · closed without mergingPart of #1723
What this unblocks: pixel programs that copy a plain
v_interp_p2_f16result withv_mov_b32/v_cndmask_b32before reading it as a binary16 low half (for example throughv_fma_mix_f32) no longer stop at "reads the upper 16 bits"; and a read of such a result through a VOP3 source modifier (-v4,|v4|) is now flagged instead of slipping past the scan.Stacked on #2789 (this branch contains its commits until that merges; the new work is the last commit). Does not touch #2789's low-half
v_fma_mix_f32rule.Source: AMD "RDNA 2" Instruction Set Architecture reference guide, VINTRP instruction V_INTERP_P2_F16 (a plain form writes only the low 16 bits of its destination), VOP3P V_FMA_MIX_F32 (
op_sel_himarks a binary16 source,op_selpicks its half), VOP1 V_MOV_B32 and VOP2 V_CNDMASK_B32 (32-bit register copies).What changed (
Stage.interp_f16_scanintools/startup/gfx2hlsl.py)v_mov_b32, orv_cndmask_b32with both value sources plain VGPRs, no modifiers) of a register whose upper half is undefined is no longer a read of that half: it hands the undefined-upper-half state on to its destination. The half is still checked where it is observed (an export, a shift, a binary32v_fma_mix, anop_selpick of the upper half all stay refused on the copy).v_mov_b32,v_cndmask_b32andv_fma_mix_f32(which rewrites all 32 bits) is no longer counted as a read of its old undefined half. It still counts for the pending / stalev_interp_p1ll_f16result checks, so overwriting a pending result is refused with the same message as before.v_mul_f32_e64 v8, -v4, 1.0or|v4|on a plain p2 result named no register, so the read of the undefined upper half was never flagged and the program translated.What stays refused: any other reader of an undefined upper half, an
op_selupper-half pick, a binary32 source, a copy read through an export or shift, and every otherv_interp_p1ll_f16/v_interp_p2_f16form that was refused before.Tests (
startup_gfx2hlsl_interp_f16_check.py, llvm-mc-verified words inbinarymode)v_mov_b32copy and av_cndmask_b32copy of a plain p2 result read throughv_fma_mix_f32as a low half; both evaluate to the same words as the direct low-half read. Thedrawmode also draws thev_mov_b32copy on D3D12 and compares it with the ISA arithmetic (binary16 low half squared), with a wrong-reference control that must fail.Verification:
Win2025 WARP dev+release: pending Stage-2.
AI-assisted; commands listed were executed locally.
@RavenCurseBurg on GitHub · 2026-11-26 09:56 UTC · original
I will verify the conditional-copy case with two distinct half values, both condition outcomes and an aliased destination. I will assemble the pixel programs, check the low-half readback on D3D12, and check that reading the copied upper half is still diagnosed.
@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.
@RavenCurseBurg on GitHub · 2026-11-26 10:32 UTC · original
Closing out my earlier test claim with fixtures the native frontend can reuse. On withdrawn head
92f8ee9fI assembled 24 gfx1013 pixel programs, varying the two conditional-copy inputs, their order, whether the destination aliases either source, and both outcomes of a comparison against an interpolated 0.5. Twelve cases mix a fully defined register and an interpolated register whose upper half is undefined.WARP, Intel UHD 770 and RTX 4060 each passed 24/24 DXC SM 6.0 draws. Each reversed-arm reference failed. Replacing the low-half consumer with a shift reading the upper half was refused in all 24 cases. The selected channel was 1.5, −2.0 or 0.5, while the other channels stayed at 0.5, 0.5 and 3.0.
Reproducible guest assembly generator, CPU reference and draw checks. From that revision:
For a physical run, use
hardwarewithXBOX2WINDOWS_ADAPTER=IntelorNVIDIA. Windows 11 26100.9711, WARP 10.0.26100.9711, Intel 32.0.101.5973, NVIDIA 32.0.15.9579, debug layer unavailable. AI-assisted with Codex.Pull request closed