Repository navigation
dgx-spark: P1, qdot runs the host tier off x86_64 through its scalar mirrors (design S) - #15
Closed
juliankang4 wants to merge 1 commit into
Closed
juliankang4 wants to merge 1 commit into
juliankang4 wants to merge 1 commit into
Conversation
juliankang4
force-pushed
the
dgx-spark-p1
branch
from
October 10, 2026 16:16
f145d0d to
d000542
Compare
7 tasks done
…rror (design S); swiglu and dot_f32 without AVX2 keep the kernels' bits supports is has_kernel off x86_64, so fuses admits the host union's stacks and the matmul dispatch's rows there. Tile, r8 and row-lane calls keep has_features, false off x86_64, and take the scalar paths they already have; the union's r8 cost asks has_tile(Q3_K), as its siblings do, so a scalar r8 group costs its bytes once a column. swiglu and swiglu_clamp without AVX2+FMA ran silu through libm's exp, one ulp off ik's v_expf on some inputs (swiglu_clamp_matches_ik_rule); they take expf_ik_scalar, v_expf's bits, as the card rule's swiglu does. dot_f32 without AVX2+FMA returned None and its callers summed left to right, 3.8e-6 off the router pin in tests/moe.rs; it runs the kernel's eight lanes one value at a time. quantize_col_random_bit_identical, hw_v_expf_equals_expf_ik_over_f32_range and hw_card_swiglu_clamp_scalar_matches_avx2 only compare an AVX2 path with its mirror, so they are x86_64-only. hw_union_q6_k_down_matches_per_column names the row lanes a CPU lacks after its values instead of passing.
juliankang4
force-pushed
the
dgx-spark-p1
branch
from
October 10, 2026 20:42
d000542 to
3cf9bfd
Compare
Owner
|
Thank you very much, Julian. This landed on main as 021dab6, with you as the author. The fixture gate batch was green (132 items, 0 red). This is the first step that lets the engine build and run off x86_64, and the scalar mirrors keep the kernels' bits. We are truly grateful for this work. I am closing this PR because the commit is on main through our landing train. Your name will be in the release notes. |
This was referenced Oct 11, 2026
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.
What and why
The
qdotpart of P1 indocs/contrib/dgx-spark.md, with answer 1 of §5 (design S in P1). Part of #13. #14 is inmain now, and this branch is rebased on it: the change is the one commit. Design R (#14)
refuses the host tier off x86_64, but the fixture tier offloads to it (§3.4), so the fixture gates need it to run there.
The rest of P1, and how I plan to go on with the port, are in a comment on #13.
qdot::supportsishas_kernel: every type with a kernel takes the fused path through its scalarmirror, which carries the AVX2 kernels' bits.
fusesfollows, so the host union admits its stacks and the matmuldispatch fuses its rows.
has_featuresstays false there, sodot_row_cols,dot_q3k_r8_colsand the row laneskeep the paths they already take without the ISA: one column at a time through
dot_row, the r8 scalar mirror, andNoLanes, which the union's lane choice asks first. The union's r8 cost (r8_tile_cost) now askshas_tile(Q3_K)like its siblings, so a scalar r8 group is costed at its bytes once a column instead of the AVX2 tile's units.
swigluandswiglu_clampwithout AVX2+FMA computed silu with libm'sexp, one ulp off ik'sv_expfon someinputs (
swiglu_clamp_matches_ik_rulefailed on aarch64 in the dgx-spark: P0, the host crates and the engine build on aarch64 (design R) #14 run). They now takeexpf_ik_scalar(0.0 - g),v_expf's bits, as the card rule'sswiglualready does.dot_f32without AVX2+FMA returnedNone, and its callers summed left to right: 3.8e-6 off the router's exact pinin
crates/model/tests/moe.rs:81-84. It now runs the kernel's eight lanes one value at a time (mul_addfor eachfused add, then
hsum_float_8's pairs), whichdot_f32_is_the_reference_lane_orderholds to the reference order.quantize_col_random_bit_identical,hw_v_expf_equals_expf_ik_over_f32_rangeandhw_card_swiglu_clamp_scalar_matches_avx2only compare an AVX2 path with its mirror, so they are x86_64-only.hw_union_q6_k_down_matches_per_columnmet dgx-spark: P0, the host crates and the engine build on aarch64 (design R) #14's refusal of the host layer off x86_64; it now compares its valuesthere and then fails by name on the row-lane clause, as the tile and lane gates already do, instead of passing
without lanes.
On x86_64 the source change is a
cfgline onsupports, the fallback lines, ther8_tile_costpredicate (the samevalue there) and the tests. With the repo's
target-cpu=znver3,is_x86_feature_detected!("avx2")and("fma")aretrue at compile time, so the fallbacks are dead code there and the generated code does not change.
Left out on purpose. Some gates keep an AVX2-against-mirror clause beside hand or ik oracles (the
quantize_colgates,hw_q82_codes_at_bf16_round_down,hw_q8k_codes_at_subnormal_scales, thedot_rowgates' kernel-against-emulatorstep). Off x86_64 that clause compares the mirror with itself; the oracle clauses next to it are the evidence there, so
I left the tests whole.
swiglu_clamp's fallback andcard_swiglu_clamp_1now have the same body, but they transcribetwo rules (ik's and the card's), so I kept them apart.
Code shape
expf_ik_scalar; thedot_f32lanes are the kernel'sorder and the test's oracle is its independent transcription.
UnsupportedType), and a gate whoseclause has nothing to compare off x86_64 fails by name instead of passing.
mirror with itself.
cargo fmtandcargo clippyare clean on what I touched; the lint count did not go up.Duplication found or removed: none.
What I ran
On a Mac with the pinned nightly and the CUDA 13.3 headers:
The x86_64 assembly of
bloomery-qdotandbloomery-model(--emit=asm, one codegen unit) equals #14's apart fromthe line numbers in panic locations.
On a DGX Spark, in the container #14 describes, the
tools/recipes.py host-nightlyunits pass in all 19 crates; the 25tests #14 lists as P1's starting list pass, and
dot_f32_is_the_reference_lane_ordernow checks the fallback thereinstead of returning early:
The ignored tests of
qdot,unionandattn, run with plaincargo testas their recipes run them (--releaseforthe first two). Every red is a missing input or a named refusal:
/models/...or$BLOOMERY_DATA/ref.hw_q3k_r8_tile_matches_dot_row,hw_lanes_match_dot_row_synthetic,hw_union_q6_k_down_matches_per_columnafterits values, and
hw_flash_simd_bands_against_scalar(kq_dot_simd's panic).hw_lanes_refuse_bad_shapesfails onits first refusal (
NoLanescomes first), as its ignore reason says.hw_flash_split_k_bands_against_one_segment, the encoder edge gates and thecard gates with oracles.
Hardware
The DGX Spark of #14 (NVIDIA GB10, DGX OS 7.6.0, driver 595.84), in its CUDA 13.3.1 container. No speed numbers here.
AI help
An AI coding agent wrote the code changes and this description, ran the commands above on my machines, and compared
the x86_64 assembly. I did the code review of the diff and the review of this pull request myself.