Repository navigation
cpu_moe: integer IQ4_NL dot product (scalar + AVX2) - #47
Merged
Merged
Conversation
int_dot had no IQ4_NL entry, so routed experts stored as IQ4_NL (the ffn_down_exps of OrcaRouter Qwen3.8-Flash-Next-Uncensored IQ3_XXS) fell back to f32 row dequantization in the CPU expert worker. Add dot_iq4nl against the Q8_K activations like dot_iq4xs: 18-byte blocks, eight per Q8_K block. The AVX2 version looks up KVALUES_IQ4NL with pshufb and handles two blocks per step plus an odd tail. int_dots_match_dequant covers it at 672 values (21 blocks, odd tail). RTX 3060 + Ryzen 7 5800XT, 8K prompt: CPU worker 75.6 -> 15.9 ms/token, decode 10.9 -> 31.6 tok/s.
Contributor
Author
|
I have been doing a TON of patches with claude code and currently have decode & prefill at 34.5 t/s and 974 t/s at 62k. 8k is at 40.2 t/s and 1012 t/s. This is all without MTP. I am happy to PR the mess if you'd like after its all complete but it is a hot mess and only really been tested on my Orca model since its mainly a personal patch. |
Member
|
@Saul5662 I tested it and merged, tysm for contribute! |
Vasyl-Trefilov
added a commit
that referenced
this pull request
Nov 17, 2026
…duct, MTP for Flash-Next and layer splits - chat page: MCP tools from an mcp.json file (serve --mcp), per-tool switches, confirm step before each call (#18) - cpu_moe: integer IQ4_NL dot product, scalar and AVX2 (#47) - experts: a long prompt no longer freezes the placement for the reply (#44) - mtp: draft head for Qwen3.8-Flash-Next on the GPU (--mtp-model), drafts with a multi-GPU layer split (#38) - vision: faster CPU encoder, image prompts prefill on the GPU with M-RoPE - startup warning when the binary has no AVX2 but the CPU does (#44) - cuda: size_t pointer offsets in moe_combine, STRATA_NVRTC_OPTS (#34) - docs: LORA.md rewritten for users (#15)
Vasyl-Trefilov
added a commit
that referenced
this pull request
Nov 18, 2026
Co-authored-by: Andrew Pavlov <100561417+andrew-pavlov-ua@users.noreply.github.com>
Vasyl-Trefilov
added a commit
that referenced
this pull request
Nov 18, 2026
…duct, MTP for Flash-Next and layer splits - chat page: MCP tools from an mcp.json file (serve --mcp), per-tool switches, confirm step before each call (#18) - cpu_moe: integer IQ4_NL dot product, scalar and AVX2 (#47) - experts: a long prompt no longer freezes the placement for the reply (#44) - mtp: draft head for Qwen3.8-Flash-Next on the GPU (--mtp-model), drafts with a multi-GPU layer split (#38) - vision: faster CPU encoder, image prompts prefill on the GPU with M-RoPE - startup warning when the binary has no AVX2 but the CPU does (#44) - cuda: size_t pointer offsets in moe_combine, STRATA_NVRTC_OPTS (#34) - docs: LORA.md rewritten for users (#15)
Vasyl-Trefilov
added a commit
that referenced
this pull request
Nov 20, 2026
…duct, MTP for Flash-Next and layer splits - chat page: MCP tools from an mcp.json file (serve --mcp), per-tool switches, confirm step before each call (#18) - cpu_moe: integer IQ4_NL dot product, scalar and AVX2 (#47) - experts: a long prompt no longer freezes the placement for the reply (#44) - mtp: draft head for Qwen3.8-Flash-Next on the GPU (--mtp-model), drafts with a multi-GPU layer split (#38) - vision: faster CPU encoder, image prompts prefill on the GPU with M-RoPE - startup warning when the binary has no AVX2 but the CPU does (#44) - cuda: size_t pointer offsets in moe_combine, STRATA_NVRTC_OPTS (#34) - docs: LORA.md rewritten for users (#15)
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.
Issue
cpu_moe::int_dothad noIQ4_NLcase, so routed experts stored as IQ4_NL fell back to f32 row dequantization in the CPU expert worker. In OrcaRouterQwen3.8-Flash-Next-Uncensored-IQ3_XXSeveryffn_down_expstensor is IQ4_NL, so this fallback dominated decode.Results
RTX 3060 12 GB, Ryzen 7 5800XT, on top of 3355cbb,
bench --gpu --mtp 0 --ctx 16384 --pp 8192 --tg 64 --reps 3 --chunk 8192:Patch (
src/cpu_moe.rs)dot_iq4nland AVX2avx2::dot_iq4nl(pshufb lookup ofKVALUES_IQ4NL, maddubs/madd, two blocks per step plus an odd tail) against the Q8_K activations, likedot_iq4xs.int_dotreturns them forGgmlType::IQ4NL.int_dots_match_dequantcovers IQ4_NL (672 values, so the odd tail runs).This patch was written by AI (Claude Code). Please check the code fully before merging.