mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1724] [CLOSED] [Engine] MXFP4 routed experts (MXFP4_MOE GGUFs) and MXFP4 PLE tables #3633
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3633
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/1724
Author: @VLOD-ZDOV
Created: 10/9/2026
Status: ❌ Closed
Base:
main← Head:mxfp4-experts📝 Commits (1)
0ea0c47engine: MXFP4 routed experts (MXFP4_MOE GGUFs) and MXFP4 PLE tables📊 Changes
8 files changed (+159 additions, -18 deletions)
View changed files
📝
include/strata/artifact/dequant.hpp(+20 -0)📝
include/strata/kernels/ngram.hpp(+2 -1)📝
src/kernels/cuda/iq_kernels.cu(+75 -7)📝
src/kernels/iq_parity.cpp(+11 -4)📝
src/kernels/native_grouped_parity.cpp(+41 -3)📝
src/kernels/ngram.cpp(+2 -0)📝
src/ngram/ple_reader_test.cpp(+1 -1)📝
tools/iq_fixture.py(+7 -2)📄 Description
Problem and result
GGUFs made with llama-quantize's
MXFP4_MOEkeep every routed expert (gate, up and down) and the PLE table in MXFP4(ggml type 39). The engine refuses them at start:
layer 0's experts are MXFP4/MXFP4 (ggml types 39/39), which this engine has no GPU kernels for. With this change such a file runs as a native pack (tools/iq_pack.py --compat-bf16,unchanged) and answers correctly. Files in the formats that already run take the same kernels as before.
Related discussion
Reopening #1724 after the tracker reset, rebased on current
main. In #1724 the maintainer wrote that format supportwas outside that speed pass and that the 16-lane fix inside it looked worth a separate look. If format support is still
out of scope, I can split the 16-lane fix into its own pull request instead.
Approach
src/kernels/cuda/iq_kernels.cu: MXFP4 as an expert format for gate/up and down (Fmt<39>,Split<39>), next toNVFP4. It is IQ4_NL's layout with the FP4 table, one E8M0 exponent per 32 values and 17-byte blocks, after llama.cpp's
vec_dot_mxfp4_q8_1. The prompt path dequantizes MXFP4 (dq_mxfp4) and takes the existing FP16 fallback.native_gu_multi_kerneltook its 16-lane path (row_dot_80_sub16, 80 dot calls per row)whenever
n_embd == 2560. That held for every gate/up format so far (256-value blocks: 10 x 8 = 80), but an MXFP4 rowis 160 calls, so only half of each gate/up row was computed. The kernel and the host's grid now test the row length
itself (
nb * ipb == 80). For the existing formats the condition is the same.include/strata/artifact/dequant.hpp:dequantize_mxfp4, after ggml'sdequantize_row_mxfp4.include/strata/kernels/ngram.hpp,src/kernels/ngram.cpp: MXFP4 as a PLE table format.iq_parity/tools/iq_fixture.py, MXFP4 innative_grouped_parityandple_reader_test, andcheck_oldinnative_grouped_parity, which compares the default kernels with the one-rowkernels at the model's shapes (2560 x 640). The v1 comparison could not catch the bug above, because both sides take
the same gate/up kernel.
Compatibility: opt-in by file format only. No default, flag or setting changes.
Validation
Passed (CUDA build, Linux, revision
b23f9851on top ofmaincbfd5b92):iq_parity: 0 failures. MXFP4 dequant rel 0.00e+00 against gguf-py, MMVQ rel 5.48e-03 (the other formats are in thesame range), multi-column calls bitwise equal to one-column calls.
native_grouped_parity: 0 failures. MXFP4 with every format pair bitwise equal to v1;check_oldat 2560 x 640rel 0.00e+00 against the one-row kernels. With the old
n_embd == 2560condition put back,check_oldfails MXFP4(rel 8.7e-01), so the check covers the bug.
ple_reader_test: every format including MXFP4 OK.gguf_reader_test: all passed.mainbuilt from thesame tree, three greedy prompts of 200 tokens each: all three answers byte-identical (md5 of the text), and
mainrun again before and after gives the same three.
same paragraph.
Failed: none observed.
Not run: HIP and SYCL builds (
iq_kernels.cuis also compiled for HIP), Windows, other GPU generations, Mac.Limits
than the native formats).
setup.pystill lists MXFP4 files as unsupported; left for a separate change.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.