Skip to content

shader: expand constant dot4 multiplicands to avoid Arc IGC miscompilation - #2536

Open
UnkwnDev wants to merge 1 commit into
Marvisak:mainfrom
UnkwnDev:arc-dot4-constant-fix
Open

UnkwnDev wants to merge 1 commit into
Marvisak:mainfrom
UnkwnDev:arc-dot4-constant-fix

Conversation

@UnkwnDev

Copy link
Copy Markdown

Fixes \ spx_programs_run_with_the_hardwares_dot_products\ (and equivalent \�_dot4_i32_i8\ / \�_dot4c_i32_i8\ sequences) failing on Intel Arc A770 hardware while passing on WARP.

Root Cause

When a packed byte dot-product multiplicand evaluates at DXIL compile time to a 16-bit constant (such as the FidelityFX \sel_hi_lo(2.0)\ operand \

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Proposed close: duplicate of #2408. This PR's head (a3a18d6) has not changed since the last review. #2408 (open, merges cleanly, CI passing) makes the same change in crates/victory-shader/src/emit/lower.rs. A new dot4_i8 expands a constant multiplicand over its non-zero bytes instead of passing it to dot4AddPacked.i32, and it is backed by a constant evaluator in emit/bitcode.rs (known_i32 there, eval_u32 here). #2408 also cites the driver evidence this PR lacked (#1829, #1896) and has the larger test suite.

Reply to the author: thanks for comparing the two. We agree that #2408 is the one to land. The _dot4_u32_u8 extension you mention fits better in #2202 once that is rebased on #2408, so nothing here needs to stay open for it.

This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.

CI: check passed (Windows).


Generated by Claude Code

@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown

#2408 (KainanP, 2644bbc, open; the triage calls it a merge candidate) makes the same change: dot4_i8 takes a constant multiplicand by hand over its non-zero bytes instead of passing it to dot4AddPacked.i32, with a constant evaluator added to emit/bitcode.rs (about 100 lines in both). Its description also cites the driver evidence the triage asks for here: #1829 (Intel Xe-LP reads a constant dot4AddPacked operand that fits in 16 bits as its low half in both halves) and #1896 (the RTX 5070 does the same for 0x4000). It may be simplest to compare the two before either goes further.

AI-assisted (Claude Code, Claude Opus 5.5). Compared the two diffs only; nothing run.

@UnkwnDev

Copy link
Copy Markdown
Author

@upipibi Thanks for the pointer.

I compared the two diffs:

  1. Both patches target the same underlying driver behavior (Test report: Intel UHD (Raptor Lake Xe-LP), 70564ae: victory-shader 201 passed, 8 failed (3 missing-feature skips, 5 different results) #1829 / Shader: the packed dot over an inline constant is taken by hand from … #1896), where Intel Xe-LP/Arc IGC and NVIDIA drivers encode constant multiplicands in 16 bits and replicate them into both halves inside dot4AddPacked.
  2. KainanP's Shader: a dot product over a constant multiplicand is taken by hand #2408 provides a thorough evaluator (known_i32 in emit/bitcode.rs) covering binary ops, casts, and selects, accompanied by the dot4_takes_every_constant_class_whole test suite for �_dot4_i32_i8 and �_dot4c_i32_i8.
  3. Our branch was developed alongside the broader packed dot products lowering (shader: lower remaining packed dot products and clamped integer forms #2202), which also adds �_dot4_u32_u8 (where unsigned constant operands into dot4AddPacked.u32 require the same scalar expansion), as well as dot2 and dot8.

Since #2408 is already designated a merge candidate by the triage for main, landing #2408 first is the cleaner approach. Once #2408 is merged into main, we can close #2536 as superseded and rebase #2202 on top of #2408's known_i32 foundation to extend constant expansion to �_dot4_u32_u8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants