shader: lower clamped integer, carry-out, MAD/SAD, and f16 pack VALU operations ("integer output modifiers") #515
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-27T23:30:25Z.
Problem
In
victory-shader(crates/victory-shader/src/emit/lower.rs),Lower::write_icurrently rejects any instruction withv.clampset outsideSATURATING = ["v_add_nc_u32", "v_sub_nc_u32", "v_subrev_nc_u32"]as"integer output modifiers"(still refusing 3 compute shaders in the #4 corpus sweep), whilevalu16andpacked16reject clamped unsigned 16-bit and packed 16-bit integer operations:write_i:v_cvt_f16_f32(whenopsel == 0invalu_op, unlikevalu16),v_cvt_pkrtz_f16_f32, andv_cvt_pknorm_{u16,i16}_f32callwrite_i, so VOP3clamp([0.0, 1.0]float clamp onv_cvt_f16_f32/v_cvt_pkrtz_f16_f32, already clamped onv_cvt_pknorm_*) is refused as"integer output modifiers".v_add_co_u32,v_sub_co_u32,v_subrev_co_u32,v_add_co_ci_u32,v_sub_co_ci_u32,v_subrev_co_ci_u32withclamp(saturatingvdstat0xffffffffor0while keeping the un-clamped carry/borrow mask insdst).v_add_nc_i32andv_sub_nc_i32(sadd.sat.i32/ssub.sat.i32withclamp, wrapping withoutclamp), plusv_cvt_pk_{u16_u32,i16_i32}andv_mad_i32_i16.v_mad_{u32_u24,i32_i24,u32_u16,i32_i16},v_mul_{u32_u24,i32_i24}, andv_sad_{u8,hi_u8,u16,u32}/v_msad_u8withclamp.clamp:v_add_nc_u16,v_sub_nc_u16,v_subrev_nc_u16,v_mul_lo_u16, andv_pk_{add,sub,mad}_{u16,i16}/v_pk_mul_lo_u16withclamp.Proposed Fix
CLAMPsemantics across these 32-bit, 16-bit, and VOP3P packed integer and float-to-half packing instructions while keepingomod != 0and non-saturating bitwise/shiftclamprefused.Refs #4, #258
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T23:30:26Z.
/claim
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T23:30:35Z.
Claimed by @Sheffy007. Open a draft pull request with
Refs #515in its description within 24 hours, or the claim expires.