Recompiler: a constant multiplicand reaches dot4AddPacked as an immediate (misread by RTX 5070 / Intel Xe-LP drivers elsewhere; probe for RTX 50) #2473
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2473
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?
@KainanP on GitHub · 2026-11-25 19:39 UTC · original
Both backends pass a compile-time constant multiplicand of the 8-bit dot products straight into
dot4AddPacked. Two drivers have been seen to misread such an immediate in another project's translator. I could not reproduce it on the GPUs I have that run XCL, so this is a request for a run on an RTX 50-series card before anyone writes a fix.What XCL emits (
main2898511,dxc -dumpbinof the kernels, HLSL path andXCL_DIRECT_DXIL=1):v_dot4_i32_i8 v2, v0, 0x4000, v1→dot4AddPacked.i32(i32 163, i32 %acc, i32 %a, i32 16384)(HLSL path,recomp/emit.rs)v_dot4_u32_u8 v3, v0, 2, v1→dot4AddPacked.i32(i32 164, i32 %acc, i32 %a, i32 2)(HLSL path)v_dot8_u32_u4 v4, v0, 2, v1→ twodot4AddPacked(164, …, i32 2)/(…, i32 0)calls (direct DXIL,dxil/lower_wide.rs, since #2173)What was measured elsewhere (VIctory, a different translator, same DXIL shape):
dot4AddPacked(i32 163, i32 2147483632, i32 50526978, i32 16384)returnsacc − 128, RDNA 2 givesacc − 320, as if the driver fed the low half of the immediate into both halves (0x40004000). WARP is right. Marvisak/VIctory#18968086:a78b, driver 31.0.101.5445), my probe there: every constant multiplicand that fits in 16 bits (inline 1, 2, 64, −2, −16; literals0x4000,0x7F00,0xFF80,0xFFFF8000) is read as its low half repeated; the same values from root constants are right. Marvisak/VIctory#2408In XCL, on this laptop
SKIPPED … no wave64), and preflight refuses 16-lane GPUs, so the Intel half does not concern XCL.Probe: branch
KainanP/xcl:probe/dot4-constant-multiplicand(one commit onmain2898511, test only): 25 constants (inline integers, literals, inline floats) as one multiplicand ofv_dot4_i32_i8(src0 and src1),v_dot4_u32_u8,v_dot4c_i32_i8andv_dot8_u32_u4, the other operand and the accumulator from registers, checked against the RDNA 2 definition.It prints
N mismatchesand each wrong lane. If an RTX 50-series (or another) card shows mismatches, the fix VIctory#2408 uses would apply here: when a multiplicand is a known constant, sum its non-zero bytes times the other operand's bytes by hand and keepdot4AddPackedfor register operands. If nobody sees a mismatch, this can be closed.Not related to the world load as far as I know: a wrong dot product gives wrong values, not a stall.
AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran it on the RTX 4060, Intel UHD and WARP here, read the DXIL and wrote this issue.