Repository navigation
DS4.1: MXFP8 dense weights, exact IQ2_XXS/IQ3_XXS HIP decode, mixed-type streamed cache, batch-invariant DSpark verify - #800
Conversation
…8.25 bpw GGML_TYPE_MXFP8 (117): per row, 256 E4M3 codes with one E8M0 scale per 32 (264 B, 8.25 bpw). The checkpoint's 32x32 FP8 blocks convert losslessly by repeating each block scale on its rows, so dense weights keep their native values at about Q8_0's size instead of BF16's. - Decode is exact everywhere: the E4M3 bits read as FP16 are the value * 2^-8, and the E8M0 scale absorbs the 2^8. - CPU reference quantize/dequantize/validate (NaN codes and scales > 246 are rejected) and a vec_dot against F32 activations. - CUDA/HIP: a register-decode GEMV with F32 activations and output for up to 8 columns (batch invariant, 3-D channels for the grouped wo_a); wider batches dequantize to BF16 (exact) for a BF16 GEMM with F32 accumulation and output. No F16 conversion is registered, so no path can underflow small scales; no MMVQ/MMQ, and the grouped wo_b path is skipped for this type. - gguf-py knows the type. - test_ds41_mxfp8: exact decode of every code through both device paths, accuracy against a double reference (GEMV <= 2e-7 relative on H200), batch invariance, validation, requantization. Passes on CPU and H200. (cherry picked from commit 496ddf26568fcb2c6242c048ea18f63b5211907e) (cherry picked from commit 2a8285d)
… sharing type Layers of different weight types share the streamed expert slots, each through its own view whose expert stride is the slot stride; the matvec kernels index experts in whole quant blocks (stride / type size). The stride was the largest expert of the role, which is not a multiple of the smaller types' block sizes (a 4,515,840 B IQ3_XXS gate slot is 68,421.8 IQ2_XXS blocks), so every layer with another type read wrong expert offsets: a conditioned DS4.1 GGUF with per-layer types decoded to empty text on the cached path while the uniform public Q2 was fine. Round each role's stride up to the lcm of the block sizes sharing it (moe_expert_slot_stride): +31 KB per gate/up slot, +0.9 MB per down slot for the DS4.1 conditioned mix. Lucebox 6, conditioned MXFP8-dense GGUF, 12 GiB cache on the Strix: canary correct, coherent output (matches the uncached text for the first 480 characters), decode 9.6-12.0 tok/s against 4.3-5.2 uncached. (cherry picked from commit 4f409550c16d2e67037380277498bda6fac387ff) (cherry picked from commit 64ab306)
…ixed-K launch Found by a geo-evo run on Lucebox 6 (target lucebox_ds41_iq2xxs_mmvq, geo-evo e41f0ca, iteration 3). On HIP the resident IQ2_XXS expert matvec was VALU bound on the per-byte sign expansion; every grid byte is 8, 25 or 43, so the signed grid is selected with v_perm_b32 (selector from one carry-free multiply plus the popcount parity), the grid table is staged in LDS, and the DS4.1 shapes (K = 5120 / 2304) use a fixed-K launch with several one-wave rows per workgroup. Integer dot products are bit-identical and each row's float accumulation and wave-reduction order is unchanged; other targets keep the existing code. Lucebox 6 (gfx1201 + gfx1151, conditioned MXFP8-dense DS4.1, 12 GiB Strix stream cache): IQ2_XXS matvec time 29.4 -> 15.2 ms/token (1.93x, rocprofv3); canary and all four golden answers byte-identical to the previous engine; decode 10.4-12.2 -> 12.1-13.9 tok/s. CUDA builds; test_ds41_mxfp8 passes on H200, gfx1201 and gfx1151. (cherry picked from commit 688ffe7134004d9dd59aa96da35f2b7ca2c695db) (cherry picked from commit a7b02b7)
…t the model MUL_MAT_ID at decode width (1 token, 6 of E experts) for IQ3_XXS and IQ2_XXS on DS4.1's gate/up and down shapes, on every GPU: median/best time per op over chained nodes and an FNV hash of the outputs for bit-exactness against a baseline build. Lets kernel work continue on a box without the 150 GB GGUF. (cherry picked from commit 00871ce71030860c3e24ba83ff30a96dc5ce8f39) (cherry picked from commit 3968f9e)
…aunch The IQ3_XXS decode matvec reuses the IQ2_XXS path (one 8-byte index load, perm-based sign expansion, 1 KiB grid in LDS, 8 waves x 2 rows per workgroup, packed K=2304 tail, DPP reduction); integer dot products are regrouped only, so outputs are bit-identical. Measured (geo-evo lucebox_ds41_iq3xxs_mmvq c2): lucebox6 full DS4.1 decode, IQ3_XXS kernel time 5334 -> 3358 us/token with the exact-token gate passing; lucebox5 bench_ds41_iq_mmid (6 of 64 experts, 1 token), identical output hashes to the base: R9700 down 113.0 -> 58.3 us (1.94x), gate/up 91.3 -> 57.9 us (1.58x); Strix down 214.2 -> 124.3 us (1.72x), gate/up 159.7 -> 128.5 us (1.24x); IQ2_XXS unchanged. The LDS sign-selector variant (c3) measured no faster. (cherry picked from commit 307a6ea246f32e0cbf561bb7db718e4949b6847c) (cherry picked from commit 4ee10b6)
…on routed experts Verification sets ggml_backend_cuda_set_mmvq_batch_invariant and documents every verified token as bit-identical to plain decode, but the width-invariant launch excluded MUL_MAT_ID: a multi-token routed-expert product went to the dedicated MoE kernel (or MMQ past the per-type MMVQ limit), which reduces in another order than the single-token decode kernel (and on HIP bypasses the IQ2_XXS/IQ3_XXS fixed-K decode kernels, which apply at one column only). In batch-invariant mode each token of a MUL_MAT_ID now runs the single-token path, and small batches stay on MMVQ. test_ds41_mmid_width_invariance compares a T-token batch with T single-token products bit for bit per expert format and DS4.1 surface. H200 (sm_90), T = 2..5: IQ2_XXS, IQ2_XS, IQ3_XXS, Q2_K and MXFP4 differ without the fix and match with it; Q8_0 routed experts still differ (another dispatch; not used by DS4.1 plans). (cherry picked from commit 91a6cb9)
BF16 output head, F16 indexer/compressor, F32 router, MXFP8 and Q8_0 MUL_MAT: under ggml_backend_cuda_set_mmvq_batch_invariant all are bit-identical between a q-wide batch and single columns on sm_90; without it the BF16/F16 products differ. (cherry picked from commit 751c63e5)
751c63e to
f582053
Compare
The fused verify graph represented the six routed experts of a q>1 batch as a 4 + 2 decomposition (head and tail owner graphs added afterwards), while the q=1 graph sums all six routes in one combine. The two orders round differently, so a DSpark verify built with the decomposition was not bit-identical to the fused q=1 decode it is documented to match: on an H200 pair with DS4.1-Flash the first differing cache bytes appear at layer 1 of the first verify, and greedy traces with the drafter diverge from plain decode on 8 of 8 items. With whole routes (formerly opt-in through LUCE_DS4_TP_NATIVE_ROUTE_WIDTH) the q=3 verify and the q=1 decode agree bit for bit at every compared cache field and argmax. Tokenwise verify lanes (hc_staggered_pre models) now keep the routes whole by default; LUCE_DS4_TP_HEAD4_TAIL2=1 restores the decomposition for bisection. The layered verify path was unaffected: against a layered decode baseline (LUCE_DS4_FUSED_VERIFY=0 LUCE_DS4_FUSED_HYBRID_DECODE=0) the drafter is byte-identical on 8 of 8 items with the default rollback.
- mmvq: the IQ2_XXS/IQ3_XXS multi-row block is a wave32 kernel; a wave64 target (gfx9) now compiles it to an inert stub instead of failing a static_assert, and the host launch requires wave32 plus the kernel's own one-wave/one-row table conditions so a mismatch is declined rather than launched. - ggml-cuda: batch-invariant MUL_MAT_ID routes to MMVQ only for types that have an MMVQ case (the mix formats keep their own dispatch instead of aborting); the MXFP8 cuBLAS branch is gated on BF16 GEMM support and its comments say that wide batches round the activations to BF16 (the <=8-column GEMV keeps F32). - test_ds41_mmid_width_invariance: only the batch-invariant mode of the contract formats decides the exit status; the non-invariant runs and routed Q8_0 (known to differ on CUDA) are diagnostics. H200: 16/16 contract cases identical, exit 0. - fused verify: the whole-routes decision for tokenwise lanes is computed once per graph next to the lane count.
…never the model has a candidate source The candidate source publishes [top_k + candidate_topk_blocks, n] once a query sees more than candidate_topk_blocks * candidate_block_size rows: a condition on the context at that layer's ratio (V4.1-Flash: ratio 1 at layer 20, so from position 16,384 inside an 18,432 context). Ds4IndexSelectionStore::ensure reserved those rows only when its column count exceeded that product, a condition on the step width that happens to hold for the load-time store (18,432 columns) and not for the hybrid step's runtime store (10,240). The first hybrid-path graph past position 16,384 then aborted in ds4_publish_index_selection (selection [2560, 1] into a [512, 10240] store; reproduced on the B300 with a diagnostic build, 2026-10-05). Reserve the rows whenever the model has a candidate source: 8 KiB per column.
|
One crash with the final MXFP8 GGUF, with a one-line fix.
- bool use_mul_mat_vec_q = ggml_is_quantized(src0->type) && !bad_padding_clear && src1->type == GGML_TYPE_F32 &&
+ // MXFP8 has its own matvec (ggml_cuda_mxfp8_mul_mat_vec); MMVQ has no kernel for it.
+ bool use_mul_mat_vec_q = ggml_is_quantized(src0->type) && src0->type != GGML_TYPE_MXFP8 && !bad_padding_clear &&
+ src1->type == GGML_TYPE_F32 &&With it, the final GGUF runs 2K, 15K and 30.7K prompts end to end on an R9700 + Ryzen AI Max box, with coherent outputs. Happy to push it to the branch if you turn on maintainer edits. |
|
Opened it as a follow-up stacked on this branch, with a regression test: #813. |
|
Rebased onto main in #813 so it can land there (this PR targets feat/ds41-engine, which is 102 commits ahead of and 22 behind main). Your ten commits keep their authorship; on top: the 107-character subject shortened, the new tests moved to main's server/test/unit layout, and the MXFP8 fused-MMVQ fix with its regression test. |
on main) (#813) * feat(ggml): MXFP8 type keeps DS4.1 native FP8 dense weights exact at 8.25 bpw GGML_TYPE_MXFP8 (117): per row, 256 E4M3 codes with one E8M0 scale per 32 (264 B, 8.25 bpw). The checkpoint's 32x32 FP8 blocks convert losslessly by repeating each block scale on its rows, so dense weights keep their native values at about Q8_0's size instead of BF16's. - Decode is exact everywhere: the E4M3 bits read as FP16 are the value * 2^-8, and the E8M0 scale absorbs the 2^8. - CPU reference quantize/dequantize/validate (NaN codes and scales > 246 are rejected) and a vec_dot against F32 activations. - CUDA/HIP: a register-decode GEMV with F32 activations and output for up to 8 columns (batch invariant, 3-D channels for the grouped wo_a); wider batches dequantize to BF16 (exact) for a BF16 GEMM with F32 accumulation and output. No F16 conversion is registered, so no path can underflow small scales; no MMVQ/MMQ, and the grouped wo_b path is skipped for this type. - gguf-py knows the type. - test_ds41_mxfp8: exact decode of every code through both device paths, accuracy against a double reference (GEMV <= 2e-7 relative on H200), batch invariance, validation, requantization. Passes on CPU and H200. (cherry picked from commit 496ddf26568fcb2c6242c048ea18f63b5211907e) (cherry picked from commit 2a8285d) * fix(ds4): streamed expert cache slot strides in whole blocks of every sharing type Layers of different weight types share the streamed expert slots, each through its own view whose expert stride is the slot stride; the matvec kernels index experts in whole quant blocks (stride / type size). The stride was the largest expert of the role, which is not a multiple of the smaller types' block sizes (a 4,515,840 B IQ3_XXS gate slot is 68,421.8 IQ2_XXS blocks), so every layer with another type read wrong expert offsets: a conditioned DS4.1 GGUF with per-layer types decoded to empty text on the cached path while the uniform public Q2 was fine. Round each role's stride up to the lcm of the block sizes sharing it (moe_expert_slot_stride): +31 KB per gate/up slot, +0.9 MB per down slot for the DS4.1 conditioned mix. Lucebox 6, conditioned MXFP8-dense GGUF, 12 GiB cache on the Strix: canary correct, coherent output (matches the uncached text for the first 480 characters), decode 9.6-12.0 tok/s against 4.3-5.2 uncached. (cherry picked from commit 4f409550c16d2e67037380277498bda6fac387ff) (cherry picked from commit 64ab306) * perf(hip): IQ2_XXS decode matvec with v_perm sign decode, LDS grid, fixed-K launch Found by a geo-evo run on Lucebox 6 (target lucebox_ds41_iq2xxs_mmvq, geo-evo e41f0ca, iteration 3). On HIP the resident IQ2_XXS expert matvec was VALU bound on the per-byte sign expansion; every grid byte is 8, 25 or 43, so the signed grid is selected with v_perm_b32 (selector from one carry-free multiply plus the popcount parity), the grid table is staged in LDS, and the DS4.1 shapes (K = 5120 / 2304) use a fixed-K launch with several one-wave rows per workgroup. Integer dot products are bit-identical and each row's float accumulation and wave-reduction order is unchanged; other targets keep the existing code. Lucebox 6 (gfx1201 + gfx1151, conditioned MXFP8-dense DS4.1, 12 GiB Strix stream cache): IQ2_XXS matvec time 29.4 -> 15.2 ms/token (1.93x, rocprofv3); canary and all four golden answers byte-identical to the previous engine; decode 10.4-12.2 -> 12.1-13.9 tok/s. CUDA builds; test_ds41_mxfp8 passes on H200, gfx1201 and gfx1151. (cherry picked from commit 688ffe7134004d9dd59aa96da35f2b7ca2c695db) (cherry picked from commit a7b02b7) * bench(ds4): routed-expert decode matvec timing and output hash without the model MUL_MAT_ID at decode width (1 token, 6 of E experts) for IQ3_XXS and IQ2_XXS on DS4.1's gate/up and down shapes, on every GPU: median/best time per op over chained nodes and an FNV hash of the outputs for bit-exactness against a baseline build. Lets kernel work continue on a box without the 150 GB GGUF. (cherry picked from commit 00871ce71030860c3e24ba83ff30a96dc5ce8f39) (cherry picked from commit 3968f9e) * perf(hip): IQ3_XXS decode matvec on the IQ2_XXS shared-grid fixed-K launch The IQ3_XXS decode matvec reuses the IQ2_XXS path (one 8-byte index load, perm-based sign expansion, 1 KiB grid in LDS, 8 waves x 2 rows per workgroup, packed K=2304 tail, DPP reduction); integer dot products are regrouped only, so outputs are bit-identical. Measured (geo-evo lucebox_ds41_iq3xxs_mmvq c2): lucebox6 full DS4.1 decode, IQ3_XXS kernel time 5334 -> 3358 us/token with the exact-token gate passing; lucebox5 bench_ds41_iq_mmid (6 of 64 experts, 1 token), identical output hashes to the base: R9700 down 113.0 -> 58.3 us (1.94x), gate/up 91.3 -> 57.9 us (1.58x); Strix down 214.2 -> 124.3 us (1.72x), gate/up 159.7 -> 128.5 us (1.24x); IQ2_XXS unchanged. The LDS sign-selector variant (c3) measured no faster. (cherry picked from commit 307a6ea246f32e0cbf561bb7db718e4949b6847c) (cherry picked from commit 4ee10b6) * fix(ds4): batch-invariant MUL_MAT_ID so DSpark verify matches decode on routed experts Verification sets ggml_backend_cuda_set_mmvq_batch_invariant and documents every verified token as bit-identical to plain decode, but the width-invariant launch excluded MUL_MAT_ID: a multi-token routed-expert product went to the dedicated MoE kernel (or MMQ past the per-type MMVQ limit), which reduces in another order than the single-token decode kernel (and on HIP bypasses the IQ2_XXS/IQ3_XXS fixed-K decode kernels, which apply at one column only). In batch-invariant mode each token of a MUL_MAT_ID now runs the single-token path, and small batches stay on MMVQ. test_ds41_mmid_width_invariance compares a T-token batch with T single-token products bit for bit per expert format and DS4.1 surface. H200 (sm_90), T = 2..5: IQ2_XXS, IQ2_XS, IQ3_XXS, Q2_K and MXFP4 differ without the fix and match with it; Q8_0 routed experts still differ (another dispatch; not used by DS4.1 plans). (cherry picked from commit 91a6cb9) * test(ds4): width invariance of the dense verify-batch products BF16 output head, F16 indexer/compressor, F32 router, MXFP8 and Q8_0 MUL_MAT: under ggml_backend_cuda_set_mmvq_batch_invariant all are bit-identical between a q-wide batch and single columns on sm_90; without it the BF16/F16 products differ. (cherry picked from commit 751c63e5) * fix(ds4): keep all six routes in one graph for tokenwise verify lanes The fused verify graph represented the six routed experts of a q>1 batch as a 4 + 2 decomposition (head and tail owner graphs added afterwards), while the q=1 graph sums all six routes in one combine. The two orders round differently, so a DSpark verify built with the decomposition was not bit-identical to the fused q=1 decode it is documented to match: on an H200 pair with DS4.1-Flash the first differing cache bytes appear at layer 1 of the first verify, and greedy traces with the drafter diverge from plain decode on 8 of 8 items. With whole routes (formerly opt-in through LUCE_DS4_TP_NATIVE_ROUTE_WIDTH) the q=3 verify and the q=1 decode agree bit for bit at every compared cache field and argmax. Tokenwise verify lanes (hc_staggered_pre models) now keep the routes whole by default; LUCE_DS4_TP_HEAD4_TAIL2=1 restores the decomposition for bisection. The layered verify path was unaffected: against a layered decode baseline (LUCE_DS4_FUSED_VERIFY=0 LUCE_DS4_FUSED_HYBRID_DECODE=0) the drafter is byte-identical on 8 of 8 items with the default rollback. * fix(cuda): review fixes for the DS4.1 engine changes - mmvq: the IQ2_XXS/IQ3_XXS multi-row block is a wave32 kernel; a wave64 target (gfx9) now compiles it to an inert stub instead of failing a static_assert, and the host launch requires wave32 plus the kernel's own one-wave/one-row table conditions so a mismatch is declined rather than launched. - ggml-cuda: batch-invariant MUL_MAT_ID routes to MMVQ only for types that have an MMVQ case (the mix formats keep their own dispatch instead of aborting); the MXFP8 cuBLAS branch is gated on BF16 GEMM support and its comments say that wide batches round the activations to BF16 (the <=8-column GEMV keeps F32). - test_ds41_mmid_width_invariance: only the batch-invariant mode of the contract formats decides the exit status; the non-invariant runs and routed Q8_0 (known to differ on CUDA) are diagnostics. H200: 16/16 contract cases identical, exit 0. - fused verify: the whole-routes decision for tokenwise lanes is computed once per graph next to the lane count. * fix(ds4): reserve index-selection candidate rows whenever the model has a candidate source The candidate source publishes [top_k + candidate_topk_blocks, n] once a query sees more than candidate_topk_blocks * candidate_block_size rows: a condition on the context at that layer's ratio (V4.1-Flash: ratio 1 at layer 20, so from position 16,384 inside an 18,432 context). Ds4IndexSelectionStore::ensure reserved those rows only when its column count exceeded that product, a condition on the step width that happens to hold for the load-time store (18,432 columns) and not for the hybrid step's runtime store (10,240). The first hybrid-path graph past position 16,384 then aborted in ds4_publish_index_selection (selection [2560, 1] into a [512, 10240] store; reproduced on the B300 with a diagnostic build, 2026-10-05). Reserve the rows whenever the model has a candidate source: 8 KiB per column. * test(ds41): keep the DS4.1 tests and bench in main's test layout Main keeps unit tests in server/test/unit and benches in server/test/bench. Move the MXFP8 width-invariance test and the IQ MUL_MAT_ID bench there, and point the registry and Laguna daemon checks back at their test/unit paths. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(cuda): keep MXFP8 out of the fused MMVQ path ggml_cuda_should_fuse_mul_mat_vec_q accepted any ggml_is_quantized type, and MXFP8 counts as quantized, so a one-column MXFP8 MUL_MAT followed by an ADD or GLU was fused into MMVQ. MMVQ has no MXFP8 kernel and aborts at the default case of mul_mat_vec_q_switch_type. MXFP8 now keeps its own GEMV there. test_ds41_mxfp8 gains fused_add: a one-column MXFP8 product feeding an ADD, checked bit for bit against the plain product plus the bias. It aborts without the fix and passes with it. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Deano Calver <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Engine support for serving DeepSeek-V4.1-Flash GGUFs whose dense weights keep the checkpoint's native
FP8 and whose routed experts mix stock ggml IQ2_XXS / IQ3_XXS / IQ2_XS per layer, on the Lucebox
(R9700 + Strix Halo). Ten commits on top of
feat/ds41-engine(dbb179d); theds41-luceboxprofile, router bias, protected experts, DSpark anddirect_allstreaming are usedunchanged. The research tooling these were developed with stays in the GeometricAGI fork.
The main pieces: a new
GGML_TYPE_MXFP8(117) that repacks the model's 32x32 FP8 blocks losslesslyat 8.25 bpw with an exact decode (so attention and shared experts stay native at about Q8_0's size);
a fix to the streamed expert cache for stacks of mixed quant types (slot strides were not whole
blocks of every sharing type, so mixed-type GGUFs decoded to empty text on the cached path);
faster bit-identical IQ2_XXS and IQ3_XXS decode matvecs on HIP (gfx1201 / gfx1151); and
batch-invariant
MUL_MAT_IDand whole six-route graphs in the fused verifier, so DSpark verify batchesreproduce single-token decode bit for bit (layered and fused graphs); and a one-line fix to the V4.1
index-selection store, which reserved the candidate-block rows only when its own width exceeded the
candidate window (a condition on the step, not the context), so the hybrid tier's runtime store had
none and the first graph past position 16,384 aborted in
ds4_publish_index_selection(the candidatesource runs at compress ratio 1, so its rows are tokens).
With these, a geo-quant allocation of DS4.1-Flash at antirez's public Q2 byte budget scores
164 vs 141 of 177 reasoning items against that Q2 (paired exact McNemar p = 6.6e-5) and decodes
faster on the Lucebox. Model card and files: Geometric-AI/DeepSeek-V4.1-Flash-Lucebox-GGUF.
Impact
Implementation
GGML_TYPE_MXFP8(117): 256 E4M3 codes + 8 E8M0 scales per 264-byte block; CPU reference quantize/dequantize/validate; CUDA/HIP register-decode GEMV with F32 activations for up to 8 columns (batch invariant) and an exact BF16 dequant + GEMM for wider batches; gguf-py knows the type.moe_expert_slot_stride), so layers of different quant types index experts correctly through their views.bench_ds41_iq_mmid: MUL_MAT_ID timing and output hash at decode width without the model, for kernel work on boxes without the GGUF.LUCE_DS4_TP_NATIVE_ROUTE_WIDTH=1), because the legacy 4 + 2 decomposition sums the routes in another order than the q=1 graph;LUCE_DS4_TP_HEAD4_TAIL2=1restores it for bisection.MUL_MAT_ID: underggml_backend_cuda_set_mmvq_batch_invarianteach token of a routed-expert batch runs the single-token path and small batches stay on MMVQ;test_ds41_mmid_width_invariancechecks T-token batches against single tokens per format and surface.Runtime Flags / Configuration
Default-on paths:
Disable path:
LUCE_CUDA_MMVQ_MOE_KERNEL=0: previous multi-token MoE kernel outside batch-invariant mode (unchanged behaviour).LUCE_DS4_TP_HEAD4_TAIL2=1: the previous 4 + 2 route decomposition of the fused q>1 verifier (not bit-identical to q=1 decode).Debug/profiling-only flags:
bench_ds41_iq_mmidandtest_ds41_mmid_width_invarianceare standalone binaries; no server flags.One default changes on every backend: the fused q>1 verifier keeps its six routes in one owner graph
(the previous
LUCE_DS4_TP_NATIVE_ROUTE_WIDTH=1behaviour). Validated bit-for-bit against q=1 decode onCUDA (H200 pair); the ROCm Lucebox run of the same check is listed under Validation when done.
Validation
test_ds41_mxfp8 cpu/gpu(exact decode of every code, GEMV <= 2e-7 relative vs double, batch invariance, validation, requantization)test_moe_expert_slot_stride,test_packed_experts,test_ds41_hc_f32,test_ds41_attention_cuda,test_ds41_fp8_iotest_ds41_mmid_width_invariance 3 64(T-token batch vs single tokens, batch-invariant mode; routed MUL_MAT_ID and dense MUL_MAT)bench_ds41_iq_mmidoutput hashes, R9700 and Strixtest_ds41_mmid_width_invariance 3 64: 16/16 contract cases identical, exit 0 (routed Q8_0 reported as a diagnostic); HIP configure + full ggml-hip build for gfx90a (wave64) on the Lucebox toolchain: exit 0; gfx1201/gfx1151 rebuild: exit 0LUCE_DS4_FUSED_VERIFY=0 LUCE_DS4_FUSED_HYBRID_DECODE=0): 8/8 identical with the default rollback and with full snapshots; fused graphs (profile defaults): 0/8 before the route-order fix, 8/8 after, verify 26.4 vs 22.7 tok/sNotes
Methodology: Lucebox6 = Radeon AI PRO R9700 (gfx1201) + Ryzen AI Max 395 Strix Halo (gfx1151), stock
power limits, geo-quant DS4.1-Flash final GGUF (366 GB) with the 12 GiB streamed expert cache; one
warm-up canary then four fixed reasoning prompts, greedy, 8,192-token cap, decode tok/s from the
server's own per-request timing, each arm a fresh server; kernel times from rocprofv3 over a 128-token
decode. H200 panels: 96 + 32 + 49 reasoning items, greedy, high reasoning effort, same engine build
and flags for every arm, paired exact McNemar on the per-item outcomes.
The store fix was found on a single B300 serving the all-native V4.1-Flash GGUF in the hybrid tier
(streamed cold experts): the lossless arm of a gate aborted on a hard-panel item after a 15.6k-token
generation, and a diagnostic build showed layer 20 publishing a [2560, 1] selection into a [512, 10240]
store. Resident loads never hit it because their store is sized for the whole context (18,432 columns).
One PR for the five pieces by maintainer request; each is its own conventional commit, so the
compact-commitsbot can fold by type. Suggested order for review: MXFP8, cache stride, HIP matvecsresearch types) so existing GGUFs load; happy to renumber if upstream prefers 108.
Known caveats:
--profile ds41-luceboxchanges outputs relative to exact decoding (router bias andprotected experts change expert selection; dense prefill is chunk-dependent; the fused whole-model graphs
round differently from the layered ones). The DSpark drafter does not: with the last two commits its output is
byte-identical to the same engine's plain greedy decode on 8/8 traced items, for the layered graphs and for
the fused graphs the profile uses (default rollback included). The two things that made it look otherwise:
the fused verifier summed a q>1 batch's six routed experts as 4 + 2 while the q=1 graph sums them whole, and
with
LUCE_DS4_FUSED_HYBRID_DECODE=1plain decode runs that fused q=1 graph, so a layered verify had nomatching baseline (
LUCE_DS4_SPEC_REFERENCE_EXACTmatched only because its n=1 forwards take the same fusedgraph). The 158/177 panel above was measured before the fix, with the drafter rounding differently from the
no-drafter profile; it needs no gate of its own now. Gotcha kept:
LUCE_DS4_FULL_SNAP=1alone raises q to 6,which verify refuses; pin
LUCE_DS4_SPEC_Q. Lucebox speed with the route-order fix is not yet measured(the box needs a reboot first: a server killed mid-load left ~65 GiB of host memory pinned).
Two follow-ups left out of this PR on purpose: the batch-invariant MUL_MAT_ID path launches the
single-token kernel once per token from the host rather than through the existing
LUCE_CUDA_MMVQ_MOE_TOKENWISEsample-dimension launch, because that launch bypasses the AMD fixed-KIQ2_XXS/IQ3_XXS route decode takes (so it would not be bit-identical on the Lucebox); folding the
fixed-K kernels into the sample dimension would cut the launch count at q=5. And MXFP8 products past
8 columns dequantize the weight to BF16 per op, so dense prefill re-converts each MXFP8 tensor per chunk;
a per-tensor BF16 cache would remove that bandwidth. MXFP8 is not in upstream llama.cpp.