Recompiler: a constant multiplicand reaches dot4AddPacked as an immediate (misread by RTX 5070 / Intel Xe-LP drivers elsewhere; probe for RTX 50) #2463

Closed
opened 2026-11-25 19:39:37 +00:00 by KainanP · 2 comments
KainanP commented 2026-11-25 19:39:37 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by KainanP on 2026-11-25T19:39:37Z.


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 (main 2898511, dxc -dumpbin of the kernels, HLSL path and XCL_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 → two dot4AddPacked(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):

  • RTX 5070: dot4AddPacked(i32 163, i32 2147483632, i32 50526978, i32 16384) returns acc − 128, RDNA 2 gives acc − 320, as if the driver fed the low half of the immediate into both halves (0x40004000). WARP is right. Marvisak/VIctory#1896
  • Intel UHD (Xe-LP 8086:a78b, driver 31.0.101.5445), my probe there: every constant multiplicand that fits in 16 bits (inline 1, 2, 64, −2, −16; literals 0x4000, 0x7F00, 0xFF80, 0xFFFF8000) is read as its low half repeated; the same values from root constants are right. Marvisak/VIctory#2408

In XCL, on this laptop

  • RTX 4060 Laptop (driver 32.0.16.1047): the probe below gives 0 mismatches on the HLSL path and on direct DXIL, so this card is not affected.
  • The Intel UHD and WARP cannot run XCL's GPU tests (16- and 4-lane waves; the probe prints 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 on main 2898511, test only): 25 constants (inline integers, literals, inline floats) as one multiplicand of v_dot4_i32_i8 (src0 and src1), v_dot4_u32_u8, v_dot4c_i32_i8 and v_dot8_u32_u4, the other operand and the accumulator from registers, checked against the RDNA 2 definition.

cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture
set XCL_DIRECT_DXIL=1 & cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture

It prints N mismatches and 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 keep dot4AddPacked for 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.

<!-- greyfinch-sync:ivall/xcl:issue:6612268575 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2473). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-25T19:39:37Z. --- 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** (`main` `2898511`, `dxc -dumpbin` of the kernels, HLSL path and `XCL_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` → two `dot4AddPacked(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): - RTX 5070: `dot4AddPacked(i32 163, i32 2147483632, i32 50526978, i32 16384)` returns `acc − 128`, RDNA 2 gives `acc − 320`, as if the driver fed the low half of the immediate into both halves (`0x40004000`). WARP is right. [Marvisak/VIctory#1896](https://github.com/Marvisak/VIctory/pull/1896) - Intel UHD (Xe-LP `8086:a78b`, driver 31.0.101.5445), my probe there: every constant multiplicand that fits in 16 bits (inline 1, 2, 64, −2, −16; literals `0x4000`, `0x7F00`, `0xFF80`, `0xFFFF8000`) is read as its low half repeated; the same values from root constants are right. [Marvisak/VIctory#2408](https://github.com/Marvisak/VIctory/pull/2408) **In XCL, on this laptop** - RTX 4060 Laptop (driver 32.0.16.1047): the probe below gives 0 mismatches on the HLSL path and on direct DXIL, so this card is not affected. - The Intel UHD and WARP cannot run XCL's GPU tests (16- and 4-lane waves; the probe prints `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`](https://github.com/KainanP/xcl/tree/probe/dot4-constant-multiplicand) (one commit on `main` `2898511`, test only): 25 constants (inline integers, literals, inline floats) as one multiplicand of `v_dot4_i32_i8` (src0 and src1), `v_dot4_u32_u8`, `v_dot4c_i32_i8` and `v_dot8_u32_u4`, the other operand and the accumulator from registers, checked against the RDNA 2 definition. ``` cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture set XCL_DIRECT_DXIL=1 & cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture ``` It prints `N mismatches` and 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 keep `dot4AddPacked` for 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.
andrewDoing commented 2026-11-26 20:21:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-26T20:21:20Z.


Tested the requested probe on an RTX 5070, driver 616.92, Ryzen 7 5700X3D, Windows build 26300.10075, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11. The reporter's unmodified probe commit was 48618ec07e11e51858137c09f6e0b46cc20b7c25 (parent 2898511af1c038a2ef809719e9b6f89e5675c422).

cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture reported the RTX 5070 adapter, wave32 and 0 mismatches: 1 passed, 0 failed, 0 ignored, no skips. Repeating with XCL_DIRECT_DXIL=1 gave the same result. The probe covers 25 constants across five forms and four lanes (500 comparisons per backend). This driver/configuration did not reproduce the reported behavior; other drivers were not tested.

AI use: OpenAI Codex with GPT-6.2 Astra ran the tests and reported results; Codex coordinated and prepared this summary.

<!-- greyfinch-sync:ivall/xcl:comment:7202575616 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2473#issuecomment-7202575616). Originally posted by [andrewDoing](https://github.com/andrewDoing) on 2026-11-26T20:21:20Z. --- Tested the requested probe on an RTX 5070, driver 616.92, Ryzen 7 5700X3D, Windows build 26300.10075, Rust 1.100.0 MSVC, SDK DXC/DXIL 1.8.2502.11. The reporter's unmodified probe commit was `48618ec07e11e51858137c09f6e0b46cc20b7c25` (parent `2898511af1c038a2ef809719e9b6f89e5675c422`). `cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture` reported the RTX 5070 adapter, wave32 and **0 mismatches**: 1 passed, 0 failed, 0 ignored, no skips. Repeating with `XCL_DIRECT_DXIL=1` gave the same result. The probe covers 25 constants across five forms and four lanes (500 comparisons per backend). This driver/configuration did not reproduce the reported behavior; other drivers were not tested. AI use: OpenAI Codex with GPT-6.2 Astra ran the tests and reported results; Codex coordinated and prepared this summary.
KainanP commented 2026-11-28 06:29:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by KainanP on 2026-11-28T06:29:02Z.


Re-ran the probe on current main (e429936c; the probe commit rebased onto it with no conflicts) on the three adapters in this laptop, with the HLSL path (XCL_DIRECT_DXIL=0) and direct DXIL (XCL_DIRECT_DXIL=1), selecting each with XCL_ADAPTER. Windows build 26200, DXC/DXIL 1.8.2502.11, Rust 1.97.0 MSVC.

XCL_ADAPTER=nvidia|intel|warp  XCL_DIRECT_DXIL=0|1  cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture
Adapter Driver HLSL path Direct DXIL
RTX 4060 Laptop (10de:28a0) 32.0.16.1047 wave32: 0 mismatches (500 comparisons) wave32: 0 mismatches
Intel UHD (Xe-LP 8086:a78b) 31.0.101.5445 not run: SKIPPED … no wave64 not run: SKIPPED … no wave64
WARP (OS) not run: SKIPPED … no wave64 not run: SKIPPED … no wave64

The Intel UHD and WARP results are skips, not passes: their waves are narrower than the 32/64 lanes XCL's GPU tests need, and preflight refuses those GPUs anyway, so the Intel driver behaviour seen in VIctory#2408 cannot reach XCL.

With @andrewDoing's RTX 5070 (driver 616.92: 0 mismatches on both backends) and the RTX 4060 here, no GPU that can run XCL has reproduced the misread, including the RTX 50 card this issue asked for. Closing as not reproduced; if a mismatch shows up on another driver (RDNA 2 was the other one seen in VIctory#1896), the probe branch still applies and the issue can be reopened with its output.

AI use: Claude Code (Claude Opus 5.5) rebased the probe, ran it on the three adapters and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7235322979 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/2473#issuecomment-7235322979). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-28T06:29:02Z. --- Re-ran the probe on current `main` (`e429936c`; the probe commit rebased onto it with no conflicts) on the three adapters in this laptop, with the HLSL path (`XCL_DIRECT_DXIL=0`) and direct DXIL (`XCL_DIRECT_DXIL=1`), selecting each with `XCL_ADAPTER`. Windows build 26200, DXC/DXIL 1.8.2502.11, Rust 1.97.0 MSVC. ``` XCL_ADAPTER=nvidia|intel|warp XCL_DIRECT_DXIL=0|1 cargo test -p xcl --lib gpu_dot4_constant_multiplicands -- --nocapture ``` | Adapter | Driver | HLSL path | Direct DXIL | |---|---|---|---| | RTX 4060 Laptop (`10de:28a0`) | 32.0.16.1047 | wave32: **0 mismatches** (500 comparisons) | wave32: **0 mismatches** | | Intel UHD (Xe-LP `8086:a78b`) | 31.0.101.5445 | not run: `SKIPPED … no wave64` | not run: `SKIPPED … no wave64` | | WARP | (OS) | not run: `SKIPPED … no wave64` | not run: `SKIPPED … no wave64` | The Intel UHD and WARP results are skips, not passes: their waves are narrower than the 32/64 lanes XCL's GPU tests need, and preflight refuses those GPUs anyway, so the Intel driver behaviour seen in VIctory#2408 cannot reach XCL. With @andrewDoing's RTX 5070 (driver 616.92: 0 mismatches on both backends) and the RTX 4060 here, no GPU that can run XCL has reproduced the misread, including the RTX 50 card this issue asked for. Closing as not reproduced; if a mismatch shows up on another driver (RDNA 2 was the other one seen in VIctory#1896), the probe branch still applies and the issue can be reopened with its output. AI use: Claude Code (Claude Opus 5.5) rebased the probe, ran it on the three adapters and wrote this comment.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl#2463
No description provided.