cpp-migration: lower v_perm_b32 and v_lerp_u8 in the direct C++ compute path #3015
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#3015
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?
@archielcqp-a11y on GitHub · 2026-11-27 05:22 UTC · original
Problem
Target branch
cpp-migration. Part of #2935 (instruction coverage: integer ALU). I'm taking this; the pull request follows.The direct compute path refuses two VOP3 byte operations,
v_perm_b32andv_lerp_u8, withdirect DXIL lowering for <name>. A compute request that uses either falls back togfx2hlsl.py. Both havegfx2hlsl.pypull requests from the start-up census (#2875, #2873), and neither had an issue or pull request for the direct path.I found them with a local per-opcode probe: one instruction per VOP3 name of
src/gfx1013_isa_tables.inl, compiled throughcompile_dxil ... gfx1013-direct-cs@0on999e17cd. It refused 68 of 120 names.Proposal
Lower both in
src/gfx1013_direct_compute.inlwith the RDNA 2 ISA definitions, as #2875 and #2873 state them:v_perm_b32: selector byte s of S2 picks byte s of {S0, S1} for 0..7 (S1 low). For 8..11 it gives 0xff or 0x00 from bit 15 or 31 of S1 or S0. 12 gives 0x00, and 13..255 give 0xff.v_lerp_u8: each byte is (S0 + S1 + S2[8i]) >> 1.Source modifiers and
clampstay refused.Alternatives
Keep the refusal and the
gfx2hlsl.pyfallback. That leaves every request that uses either opcode on the Python path, which the migration is meant to replace. Both operations are integer-only with a fully specified result, so a direct lowering has no rounding or format question to settle first.Verification
A source-built dispatch (
tests/native_perm_lerp_check.py controls|hardware):v_perm_b32selectors, with a secondv_perm_b32that exchanges S0 and S1;v_lerp_u8gets per-lane operands;The controls check that these references differ from the expected words: exchanged sources, the sign read from the wrong bit, selector 12 as 0xff, and the lerp rounding bit dropped or widened. Mutated lowerings must fail the readback.
AI-assisted.
Checklist