shader: follow known 16-bit VGPR halves across compressed exports, packed/half ops, and phis ("the first half of an interpolation") #455
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T20:31:11Z.
Refs #4, #258
In world runs (#4), 8 pixel programs are refused as
"the first half of an interpolation"(and #374 noted 2 pixel programs newly stopping at"the first half of an interpolation"afterv_fma_mixlo_f16/v_fma_mixhi_f16pairing).Cause
When a 16-bit write (
v_fma_mixlo_f16orv_fma_mixhi_f16) writes one 16-bit half of a VGPR that still holds av_interp_p1ll_f16/v_interp_p1_f32partial value (Val::Missing("the first half of an interpolation")) or another untranslated input,Lowerrecords the known half inlow16orhigh16while keepingVal::Missinginvals. Several 16-bit readers and writers do not yet consultlow16/high16:exp mrtN ... compr) and 16-bit parameter exports (Lower::export): exporting an odd channel count (RGBwithen = 0x7, orRwithen = 0x1) afterv_fma_mixlo_f16(or an high-half channel afterv_fma_mixhi_f16) callsself.i32_of(value)unconditionally even whenhalfisSome(false)orSome(true).high16has nohigh16_srccounterpart tolow16_src, and neither is consulted byv_pack_b32_f16,Lower::packed_src(v_pk_*), VOP1v_cvt_f32_f16(opsel == 0),v_fma_mix_*high-half sources (opsel_hi && opsel),Lower::half_src(high), SDWA high-half selects insrc/fsrc,v_lshrrev_b32/v_ashrrev_i32by>= 16, half-maskv_and_b32, or half-only constantv_perm_b32.write_halfandlow_half): pairingv_fma_mixlo_f16/v_fma_mixhi_f16withv_interp_p2_f16,v_cvt_f16_f32, orv_add_f16drops the knownlow16/high16half and zeroes it instead of preserving it;reset_for_rect_corneralso omitshigh16.clear().fill_phis) andoverwritten_movreld_edge: phis whose consumers only read one 16-bit half refuseVal::Missingedges even whenlow16/high16holds that half on every live edge, andoverwritten_movreld_edgeonly matches"barycentrics read directly"and not"the first half of an interpolation".Plan
high16_srcalongsidelow16_src, consultlow16/high16across all single-half readers (export,v_pack_b32_f16,packed_src,half_src,v_fma_mix_*,v_cvt_f32_f16, SDWAsrc/fsrc,>= 16right shifts, half-maskv_and_b32, constantv_perm_b32), preserve known halves inwrite_half/low_half, clearhigh16inreset_for_rect_corner, and resolve single-half phi reads and"the first half of an interpolation"inoverwritten_movreld_edgewhile keeping any read of an unknown half refused.victory-shaderand an end-to-end Metal GPU pixel readback test invictory-gpu.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T20:31:12Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T20:31:22Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #455in its description within 24 hours, or the claim expires.