Skip to content

Validate Blackwell shader paths and reuse constant analysis - #2

Draft
AxizDesign wants to merge 7 commits into
codex/texture-copyfrom
codex/blackwell-shaders
Draft

AxizDesign wants to merge 7 commits into
codex/texture-copyfrom
codex/blackwell-shaders

Conversation

@AxizDesign

@AxizDesign AxizDesign commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Blackwell shader validation

This draft builds on #1. The base branch contains the portable descriptor bound and reusable null descriptors.

Verification

  • Release build and CLI smoke checks passed. All-features workspace Clippy and asset policy passed.
  • The five original failures pass on NVIDIA RTX 5070 Ti Laptop GPU with the explicit adapter preference. The packed-dot fixture also passes on the local Intel adapter.
  • The separate structured-buffer read by element still returns incorrect values on NVIDIA, including on the previous candidate with only adapter selection applied.
  • Native FP16 has separate experimental benchmark results in BENCHMARKS.md. Its implementation is outside this change.

The complete Release workspace run reported 878 passes, one known structured-view failure, and 13 ignored tests. The totals exclude the nested fixture runner.

KainanP and others added 7 commits November 26, 2026 14:59
On an Intel UHD (Xe-LP, 8086:a78b, driver 31.0.101.5445),
`fspx_programs_run_with_the_hardwares_dot_products` gives acc - 128 where
RDNA 2 gives acc - 320 (Marvisak#1829). The case is `v_dot4_i32_i8 v0, v1, 2.0`
with `sel_hi_lo`, a multiplicand of 0x4000. The DXIL is right: the op_sel
selection is integer arithmetic on 0x40000000, and the driver folds it to
`dot4AddPacked(acc, a, 0x4000)`. The device then multiplies by 0x40004000:
-5 * 64 + 3 * 64 = -128.

A probe over constant multiplicands on that device shows the rule. Every
constant that fits in 16 bits (signed or not) is read as its low half in
both halves: 1, 2, 64, -2, -16, 0x4000, 0x7F00, 0xFF80 and 0xFFFF8000 all
give the replicated value. 0 and -1 are right only because their
replication is themselves. Constants wider than 16 bits (the inline floats
as 32-bit patterns, 0x00800000, 0x12345678) are right, and so is every
run-time multiplicand. A constant moved into a VGPR or an SGPR first
fails the same way, and so does `v_dot4c_i32_i8`. Marvisak#1896 reports the same
symptom on an RTX 5070.

Both dot lowerings now go through `dot4_i8`. When a multiplicand is
something the host compiler can work out before the program runs, the
lowering sums the other operand's sign-extended bytes times the
constant's non-zero bytes by hand, which is V_DOT4_I32_I8 and
V_DOT4C_I32_I8 in the RDNA 2 ISA (November 2020, pp. 140 and 173), so no
`dot4AddPacked` sees a constant. `bitcode::Module::known_i32` decides
this. It folds constants through integer arithmetic, casts and selects,
which covers the op_sel half selection the lowering itself emits. Run-time
multiplicands keep the intrinsic. The constant's value is unchanged: an
inline float is its 32-bit pattern and op_sel picks its halves, as on
`main`.

`dot4_takes_every_constant_class_whole` checks against `dot4_ref`, one
program per class with its dot products chained through v0: inline
integers 0, 1, 2, 15, 16, 63, 64, -1, -2 and -16; the nine inline floats;
16-bit and wider literals (each constant in src1 with four op_sel
choices and in src0); constants in a VGPR or an SGPR; `v_dot4c` with
literal and inline sources; constant accumulators; and run-time operands
with four op_sel choices. With `main`'s lowering the Intel UHD fails the
first six classes and passes the last two. With this change it passes
all of them, and the FSPX test passes too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9ea9e00)
…raw view

gathers_at_a_level_match_the_hardware reads each lane's record (offset,
u, v, level) by byte offset through a structured view (stride 16). On
NVIDIA a raw load through a structured descriptor multiplies the offset by
the stride (Marvisak#2178), so every lane read zeros and every lane failed with the
gather of (0, 0) at level 0, [0, 1, 0, 0], including the native gather the
test compares against: it looked like a gather bug, and is none.

The records go through a raw view, as Marvisak#2178 does for stride_tests. On an
RTX 5090 the test then passes on the hardware and on WARP; the gathers
were right all along.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9c6e094)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants