cpp-migration: lower v_sad_u8, v_sad_hi_u8, v_sad_u16, v_sad_u32 and v_msad_u8 in the direct C++ compute path #2987
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#2987
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?
@legacy-code-archaeologist on GitHub · 2026-11-27 03:23 UTC · original
Target branch
cpp-migration. Part of #2935 (instruction coverage: integer ALU). I am taking this; please say if you already have it locally and I will drop it.Gap: the direct compute path refuses the five sum-of-absolute-differences operations that
gfx2hlsl.pylowers:v_sad_u8,v_sad_hi_u8,v_sad_u16,v_sad_u32andv_msad_u8. I compiled each throughcompile_dxil ... gfx1013-direct-cs@0fromcpp-migration05438d65, as a VOP3 instruction on VGPRs in a source-built request. All five fail withdirect DXIL lowering for <name>. I found them with the same per-opcode VOP3 probe as #2985.Plan: use the
gfx2hlsl.pyhelperssad_u8,sad4_u8,sad_u16andsad_u32, which matchtools/pixel_aot.py.v_sad_u8: the sum of the four unsigned byte differences, plus S2.v_sad_hi_u8: that sum shifted left by 16, plus S2.v_sad_u16: the two unsigned halfword differences, plus S2.v_sad_u32: |S0 - S1| unsigned, plus S2.v_msad_u8: likev_sad_u8, but skipping each byte whose S1 byte is zero.All results wrap modulo 2^32. Source abs/neg and clamp are refused, as
gfx2hlsl.pyrefuses the modifiers. The fixture is a source-built dispatch with per-lane operands against a CPU reference, plus mutated references: signed byte differences, msad without its mask, sad_hi without its shift, and S2 dropped.AI-assisted.
@MasterDomino on GitHub · 2026-11-27 03:47 UTC · original
Completed by #2990, merged into
cpp-migrationasb69c111f. Merges into a non-default branch do not close issues automatically.