cpp-migration: lower v_permlane16_b32 and v_permlanex16_b32 in the direct C++ compute path #3021
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#3021
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?
@Leyukaka on GitHub · 2026-11-27 05:55 UTC · original
Target branch
cpp-migration. Part of #2935 (instruction coverage). I would like to take this; please say if you already have it locally and I will drop it. #1543 covers these ops intools/compute_store_aot.py; this is the direct C++ path.Gap. Direct compute refuses
v_permlane16_b32andv_permlanex16_b32with "direct DXIL lowering for v_permlane16_b32" (andx16).Measured on a local capture of 2,689 compute requests (counts and instruction shape only), with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requestsoncpp-migration999e17cdplus #3010.v_permlane16_b32, 15 atv_permlanex16_b32..sadword 4 clear. That makes them wave64 requests under #2999/#3006, which is not merged.op_selv_permlane16_b32[0,1](BOUND_CTRL)v_permlane16_b32[0,1]v_permlanex16_b32v_permlanex16_b32[0,1]Those 47 programs contain 244 occurrences:
op_selv_permlanex16_b32[0,1]v_permlanex16_b32[0,1]v_permlanex16_b32v_permlane16_b32[0,1]v_permlane16_b32[0,1]disasm_rdna2.pyprints the literal form as "unsupported VOP3A encoding". The encoding is the two VOP3A words followed by the 32-bit literal (12 bytes), which gfx10 VOP3 allows; the LLVM 15 gfx1013 assembler does not accept a literal in that operand.Plan:
v_permlane16_b32 D, S0, S1, S2: laneiin a 16-lane row readsS0from laneselof the same row, wheresel = ({S2, S1} >> (4 * (i & 15))) & 15. S1 holds the selectors of row lanes 0..7, and S2 those of row lanes 8..15.v_permlanex16_b32reads laneselof the other row in the same 32-lane half: 0-15 with 16-31, and 32-47 with 48-63.op_sel[0]is FI andop_sel[1]is BOUND_CTRL. For an inactive source lane, I assume the rule the DPP lowering uses:A D3D12 readback checks the lowering against that model, not RDNA2 itself. The measured
x160,0form has FI and BOUND_CTRL clear, so it depends on this case.op_selbits,abs/neg/clamp/omod, and a VGPR selector.Tests: a hardware readback against a CPU reference, in wave32 and wave64 requests.
v_permlanex16_b32with BOUND_CTRL and literal-plus-SGPR or SGPR selectors;v_permlanex16_b32with inline 0 selectors and noop_sel;v_permlane16_b32with BOUND_CTRL and literal-plus-SGPR or SGPR selectors.x16;Measurement: the census and the run's requests, before and after, with the next refusal of the requests that move.
AI-assisted.