Repository navigation
Conversation
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-ep
branch
2 times, most recently
from
November 9, 2026 06:17
d3283ae to
5ac6332
Compare
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-ep
branch
from
November 10, 2026 02:20
5ac6332 to
85653e0
Compare
Contributor
|
Please fix CI failures |
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-ep
branch
from
November 10, 2026 08:11
85653e0 to
3cf8acc
Compare
…acked weights Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-ep
branch
from
November 10, 2026 18:26
3cf8acc to
feddfe1
Compare
Co-authored-by: BBaditi <312674131+BBaditi@users.noreply.github.com>
This branch has not been deployed
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.
Description
Adds a native CPU Execution Provider implementation for
com.microsoft::MoEPackedalong with a header-only 32-wide AVX2 INT8 (_mm256_maddubs_epi16/vpmaddubsw) GGUF block-quantized dot-product library (gguf_vec_dot_cpu.h) supporting all 12 quantized GGUF formats ingguf_quant_tables.h(Q2_0,Q4_0,Q5_0,Q8_0,Q5_K,Q6_K,IQ2_XXS,IQ2_XS,IQ2_S,IQ3_XXS,IQ4_NL,IQ4_XS) plusF32,F16, andBF16.Key Optimizations
GgufQ8BlockActivation Quantization & 32-Wide AVX2 INT8 (vpmaddubsw):x) once per active token and intermediate SwiGLU tiles (inter) on the fly into 32-elementGgufQ8Block(int8_t qs[32],float d,int32_t bsum, matching CUDAblock_q8_1)._mm256_maddubs_epi16+_mm256_madd_epi16across codebook grid formats (IQ2_XXS,IQ2_XS,IQ2_S,IQ3_XXSvia 2-KB L1D sign LUT +vpsignb), non-linear LUT formats (IQ4_NL,IQ4_XSviapshufb+ signed×signedvpsignb), and uniform/superblock formats (Q2_0,Q4_0,Q5_0,Q8_0,Q5_K,Q6_K), deferring horizontal reduction (HsumAvx2) andbsumzero-point correction to the end of each row.2x Gate/Up+4x Down) & 2D Low-Latency Worker Pool:VecDotGgufGateUpRow2xQ8Cpuprocesses 2 intermediate rows (4weight rows:gate_r0, gate_r1, up_r0, up_r1) in lockstep in Phase 1 (kFc1Tile = 32), andVecDotGgufRow4xQ8Cpuprocesses 4 output rows in lockstep in Phase 2 (kFc2Tile = 64).M > 1) Reuse (ColdExpertGroup):expert_idwhenM > 1so allBtokens routed to the same expert reuse each GGUF weight row pair/quad hot in L1D/L2 cache (2.20x–3.60xspeedup atM = 16), while keeping a zero-overhead direct path forM = 1decode.Single-Layer
Qwen3.8-Flash-Next(E=512, H=2560, I=640, k=10) CPUMoEPackedLatency & ParityGate/Up + DownFormat)MB/exp)M=1CPUMoEPacked(us)M=16Ungrouped (ms)M=16Expert-Grouped (ms/ Speedup)UD-IQ1_S L00(IQ2_XXS + Q2_0)1.31 MB0.9999351.14%370.6 us3.92 ms1.09 ms(3.60x)UD-IQ1_S L04(IQ2_S + Q2_0)1.51 MB0.9999291.19%434.4 us4.18 ms1.42 ms(2.94x)UD-IQ2_XS L00(IQ2_XXS + IQ4_NL)1.77 MB0.9999331.16%376.3 us4.05 ms1.28 ms(3.16x)UD-IQ2_XS L03(IQ2_S + IQ4_NL)1.97 MB0.9999281.20%446.6 us4.29 ms1.61 ms(2.66x)UD-IQ2_XS L04(IQ2_S + Q5_0)2.18 MB0.9999301.18%476.9 us4.41 ms1.78 ms(2.48x)UD-IQ3_XXS L14(IQ3_XXS + IQ4_NL)2.18 MB0.9999341.15%533.7 us4.30 ms1.95 ms(2.20x)UD-IQ3_XXS L47(IQ4_XS + IQ4_NL)2.66 MB0.9999321.17%327.6 us3.84 ms1.21 ms(3.17x)Verification
ctest -R GgufQuantPackedTest: Verifies single-row, fusedGate+Up,2x Gate/Up, and4x Downdot products across all 12 quantized GGUF formats (plusF32/F16/BF16) andMoEPackedCPU vs reference dequantization (M = 1andM = 8with bit-exact grouped vs ungrouped parity).pytest onnxruntime/test/python/transformers/test_gguf_packed_ops.py:11 passed, 174 subtests passed.