Repository navigation
Validate Blackwell shader paths and reuse constant analysis - #2
Draft
AxizDesign wants to merge 7 commits into
Draft
AxizDesign wants to merge 7 commits into
AxizDesign wants to merge 7 commits into
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blackwell shader validation
This draft builds on #1. The base branch contains the portable descriptor bound and reusable null descriptors.
Verification
The complete Release workspace run reported 878 passes, one known structured-view failure, and 13 ignored tests. The totals exclude the nested fixture runner.