Repository navigation
Conversation
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-ep
branch
from
November 8, 2026 08:39
8a5b2b5 to
d3283ae
Compare
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-offload
branch
2 times, most recently
from
November 9, 2026 06:17
5b2a2bd to
550a985
Compare
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-ep
branch
2 times, most recently
from
November 10, 2026 02:20
5ac6332 to
85653e0
Compare
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-offload
branch
from
November 10, 2026 02:20
550a985 to
2274f07
Compare
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-ep
branch
from
November 10, 2026 08:11
85653e0 to
3cf8acc
Compare
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-offload
branch
from
November 10, 2026 08:16
2274f07 to
c5b16ce
Compare
…ed 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
BBaditi
force-pushed
the
qmoe-packed-gguf-cpu-offload
branch
from
November 10, 2026 18:26
c5b16ce to
ad4314d
Compare
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
Depends on #33975.
Extends
cuda::MoEPacked<T>to implementIMoeOffloadNodefor hybrid GPU-hot / CPU-cold expert execution on block-packed GGUF MoE models (Qwen3.8-Flash-NextUD-IQ1_S,UD-IQ2_XS,UD-IQ3_XXS), integrated withQMoESessionControllerHBM admission planning (expert-profile.binSTRP popularity ranking).Key Changes
expert_to_slotIndirection:expert_to_slotmap toLaunchMoEPackedHotExpertsCuda(moe_packed.cu); tokens routed to cold experts (slot < 0) are skipped on GPU and accumulated on CPU viaExecuteMoEPackedColdRoutesCpuWithScratch.cudaEvent_t):pinned_d2h_,pinned_h2d_) and usesCUDA_EVENT_DISABLE_TIMINGevents (d2h_event_,h2d_consumed_event_) soLaunchMoEPackedHotExpertsCudaruns concurrently on the CUDA stream while CPU worker threads execute cold experts.Table A: 48-Layer
Qwen3.8-Flash-NextStandard Autoregressive Decode (M = 1)E=512, k=10)gpu_experts)GiB/GB)GiB/GB)M=1Decode (ms/tok/tok/s)~11 GiBVRAM)M=1Decode64/64)UD-IQ1_S100% GPU(512)31.10 GiB(33.40 GB)—100.0%20.26 ms(49.4 tok/s)—100%(Ref)UD-IQ1_S75/25 Hybrid(384)23.33 GiB(25.05 GB)-7.78 GiB(-8.35 GB)91.0%21.61 ms(46.3 tok/s)—64 / 64(100%)UD-IQ1_S50/50 Hybrid(256)15.55 GiB(16.70 GB)-15.55 GiB(-16.70 GB)77.3%23.03 ms(43.4 tok/s)27.57 ms(36.3 tok/s)64 / 64(100%)UD-IQ2_XS100% GPU(512)39.38 GiB(42.28 GB)—100.0%19.34 ms(51.7 tok/s)—100%(Ref)UD-IQ2_XS75/25 Hybrid(384)29.53 GiB(31.71 GB)-9.84 GiB(-10.57 GB)91.6%20.52 ms(48.7 tok/s)—64 / 64(100%)UD-IQ2_XS50/50 Hybrid(256)19.69 GiB(21.14 GB)-19.69 GiB(-21.14 GB)78.7%22.00 ms(45.5 tok/s)29.09 ms(34.4 tok/s)64 / 64(100%)UD-IQ3_XXS100% GPU(512)46.84 GiB(50.29 GB)—100.0%20.55 ms(48.7 tok/s)—100%(Ref)UD-IQ3_XXS75/25 Hybrid(384)35.13 GiB(37.72 GB)-11.71 GiB(-12.57 GB)86.8%21.69 ms(46.1 tok/s)—64 / 64(100%)UD-IQ3_XXS50/50 Hybrid(256)23.42 GiB(25.15 GB)-23.42 GiB(-25.15 GB)68.1%24.37 ms(41.0 tok/s)32.38 ms(30.9 tok/s)64 / 64(100%)Table B: 48-Layer
Qwen3.8-Flash-Next+dflash2.onnxSpeculative Decoding (64Generated Tokens / Prompt)100% GPU+Adaptive M={4,8}:81.6–94.4 tok/s3-prompt mean (1.88x–2.12xvsM=1), reaching140.3–151.3 tok/s(2.90x–3.09x) onAdaptive M={4,8}and149.5–157.5 tok/s(3.05x–3.23x) onFixed M=8for structured sequences.50/50 Hybrid+Adaptive M={4,8}:62.1–74.9 tok/s3-prompt mean (1.73x–1.82xvsM=1), reaching88.1–99.1 tok/s(2.44x–2.53x) onAdaptive M={4,8}and89.5–103.1 tok/s(2.48x–2.63x) onFixed M=8— outperforming100% GPUM=1decoding (48.7–51.7 tok/s) while cutting MoE GPU VRAM by50%, with64/64(100%) exact token parity.M=1Baseline (ms/tok/tok/s)Fixed M=8(ms/tok/tok/s/Speedup/Match)Fixed M=4(ms/tok/tok/s/Speedup/Match)Adaptive M={4,8}(ms/tok/tok/s/Speedup/Match)UD-IQ1_S100% GPUP1_structured20.57 ms(48.6)7.22/6.37 ms/156.9/3.23x/100%3.82/9.01 ms/110.9/2.28x/100%6.50/6.67 ms/150.0/3.09x/100%UD-IQ1_S100% GPUP2_factual20.47 ms(48.9)2.91/16.31 ms/61.3/1.26x/100%2.37/14.49 ms/69.0/1.41x/100%2.78/13.30 ms/75.2/1.54x/100%UD-IQ1_S100% GPUP3_technical20.46 ms(48.9)4.00/11.88 ms/84.2/1.72x/100%2.78/12.42 ms/80.5/1.65x/100%3.35/11.82 ms/84.6/1.73x/100%UD-IQ1_S100% GPU3-Prompt Mean20.50 ms(48.8)4.71/11.52 ms/86.8/2.07x/100%2.99/11.97 ms/83.5/1.78x/100%4.21/10.59 ms/94.4/2.12x/100%UD-IQ1_S50/50 HybridP1_structured25.53 ms(39.2)7.00/9.70 ms/103.1/2.63x/100%3.71/12.72 ms/78.6/2.01x/100%6.30/10.09 ms/99.1/2.53x/100%UD-IQ1_S50/50 HybridP2_factual21.86 ms(45.7)2.91/18.97 ms/52.7/1.15x/100%2.46/16.06 ms/62.2/1.36x/100%2.78/15.30 ms/65.3/1.43x/100%UD-IQ1_S50/50 HybridP3_technical22.03 ms(45.4)3.15/16.46 ms/60.7/1.34x/100%2.62/14.30 ms/69.9/1.54x/100%2.86/14.64 ms/68.3/1.50x/100%UD-IQ1_S50/50 Hybrid3-Prompt Mean23.14 ms(43.2)4.35/15.04 ms/66.5/1.71x/100%2.93/14.36 ms/69.6/1.64x/100%3.98/13.35 ms/74.9/1.82x/100%UD-IQ2_XS100% GPUP1_structured19.35 ms(51.7)7.22/6.35 ms/157.5/3.05x/100%3.82/8.92 ms/112.1/2.17x/100%6.50/6.61 ms/151.3/2.93x/100%UD-IQ2_XS100% GPUP2_factual19.35 ms(51.7)2.03/23.28 ms/43.0/0.83x/100%1.91/17.58 ms/56.9/1.10x/100%1.91/18.52 ms/54.0/1.05x/100%UD-IQ2_XS100% GPUP3_technical19.32 ms(51.8)3.30/14.21 ms/70.4/1.36x/100%2.87/11.73 ms/85.3/1.65x/100%3.30/11.63 ms/86.0/1.66x/100%UD-IQ2_XS100% GPU3-Prompt Mean19.34 ms(51.7)4.18/14.61 ms/68.4/1.75x/100%2.87/12.74 ms/78.5/1.64x/100%3.90/12.25 ms/81.6/1.88x/100%UD-IQ2_XS50/50 HybridP1_structured25.49 ms(39.2)7.22/10.11 ms/98.9/2.52x/100%3.82/12.90 ms/77.5/1.98x/100%6.50/10.39 ms/96.3/2.45x/100%UD-IQ2_XS50/50 HybridP2_factual21.46 ms(46.6)2.83/20.74 ms/48.2/1.03x/100%2.41/16.84 ms/59.4/1.27x/100%2.50/17.76 ms/56.3/1.21x/100%UD-IQ2_XS50/50 HybridP3_technical21.37 ms(46.8)3.40/15.37 ms/65.1/1.39x/100%2.87/12.97 ms/77.1/1.65x/100%3.40/12.92 ms/77.4/1.65x/100%UD-IQ2_XS50/50 Hybrid3-Prompt Mean22.77 ms(43.9)4.48/15.41 ms/64.9/1.65x/100%3.03/14.24 ms/70.2/1.63x/100%4.13/13.69 ms/73.0/1.77x/100%UD-IQ3_XXS100% GPUP1_structured20.64 ms(48.5)7.00/6.69 ms/149.5/3.08x/100%3.71/9.61 ms/104.0/2.15x/100%6.30/7.13 ms/140.3/2.90x/100%UD-IQ3_XXS100% GPUP2_factual20.51 ms(48.8)4.12/11.78 ms/84.9/1.74x/100%2.95/12.13 ms/82.5/1.69x/100%2.95/13.50 ms/74.1/1.52x/100%UD-IQ3_XXS100% GPUP3_technical20.50 ms(48.8)2.86/17.09 ms/58.5/1.20x/100%2.62/13.44 ms/74.4/1.53x/100%2.74/14.12 ms/70.8/1.45x/100%UD-IQ3_XXS100% GPU3-Prompt Mean20.55 ms(48.7)4.66/11.85 ms/84.4/2.01x/100%3.10/11.73 ms/85.3/1.79x/100%4.00/11.58 ms/86.3/1.96x/100%UD-IQ3_XXS50/50 HybridP1_structured27.68 ms(36.1)7.00/11.17 ms/89.5/2.48x/100%3.71/14.15 ms/70.7/1.96x/100%6.30/11.35 ms/88.1/2.44x/100%UD-IQ3_XXS50/50 HybridP2_factual28.17 ms(35.5)4.12/19.80 ms/50.5/1.42x/100%2.95/18.87 ms/53.0/1.49x/100%2.95/21.55 ms/46.4/1.31x/100%UD-IQ3_XXS50/50 HybridP3_technical22.27 ms(44.9)3.05/17.84 ms/56.1/1.25x/100%2.62/14.91 ms/67.1/1.49x/100%2.74/15.43 ms/64.8/1.44x/100%UD-IQ3_XXS50/50 Hybrid3-Prompt Mean26.04 ms(38.4)4.72/16.27 ms/61.5/1.72x/100%3.10/15.97 ms/62.6/1.65x/100%4.00/16.11 ms/62.1/1.73x/100%Notes on Multi-Token (
M > 1) Speculative Verificationbanks[0]/banks[1]) +libqwen38_plane.so(0.19 msSingle-Launch Replay):CausalConvWithState(causal_conv_with_state_impl.cu), whenseq_len > 1andkernel_size = 10(past_key_values.1.ple_conv_state),CausalConvProjectionKernellaunches withgridDim.z = seq_lenandblockIdx.z == 0writespresentin place whileblockIdx.z > 0readspast. Binding distinct double-bufferedpast(banks[cur_bank]) andpresent(banks[1 - cur_bank]) state banks eliminates this in-place aliasing race and removes pre-verify D2D state copy overhead, whileqwen38_plane_replay_state_updatesreplays the accepted prefix (kept_count = k_acc) across all 36GatedDeltaNetlayers, 37CausalConvWithStatestates, and 12PackedSparseAttentionIndexerbuffers in a single0.19 mslaunch.A100)RouterGateUpProjcublasGemmExDispatch:A100),RouterGateUpProjdispatchescublasGemmEx(CUBLAS_COMPUTE_32F), which selects a SIMT GEMV kernel atrows = 1vs anmma.sync.m16n8k16Tensor Core GEMM kernel atrows >= 2. Evaluating all speculative horizons (Fixed M=8,Fixed M=4,Adaptive M={4,8}) against thekept_count = 1Tensor Core greedy reference (matchingORT_QWEN38_FORCE_REJECT=1inonnxruntime-genai) yields64/64(100%) exact greedy token sequence parity across all models, placements, and prompts.