mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #255] [CLOSED] Q8 0 support #2530
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#2530
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/255
Author: @gopinath87607
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:q8-0-support📝 Commits (2)
c439f9bMulti-GPU: the session carve and the per-stage prompt loansee878b2Q8_0: the checkpoint quant the engine did not know📊 Changes
21 files changed (+1063 additions, -426 deletions)
View changed files
📝
include/strata/core/expert_source.hpp(+34 -1)📝
include/strata/core/remote_experts.hpp(+5 -1)📝
include/strata/core/session.hpp(+25 -4)📝
include/strata/kernels/cpu/expert_layout.hpp(+7 -2)📝
include/strata/kernels/ngram.hpp(+20 -5)📝
include/strata/ngram/ple_reader.hpp(+16 -9)📝
serve/server.py(+25 -1)📝
src/core/expert_source.cpp(+72 -32)📝
src/core/mtp.cpp(+3 -3)📝
src/core/native_head.cpp(+17 -2)📝
src/core/pinned.cu(+14 -1)📝
src/core/remote_experts.cpp(+12 -2)📝
src/core/session.cpp(+50 -28)📝
src/core/verify.cpp(+4 -4)📝
src/kernels/cpu/expert_layout.cpp(+19 -2)📝
src/kernels/cuda/iq_kernels.cu(+33 -1)📝
src/kernels/ngram.cpp(+55 -21)📝
src/ngram/ple_reader.cpp(+23 -16)📝
src/prefill/prefill.cpp(+7 -7)📝
src/program/generate.cpp(+570 -275)...and 1 more files
📄 Description
Q8_0: the checkpoint quant the engine did not know
Stacked on #216 (the session carve) - merge that first. Until it merges, this diff shows both changes;
afterwards GitHub shrinks it to the Q8_0 commit alone.
Qwen3.8-Flash-Next-Q8_0is the sameqwen4exptopology as the IQ3_S build, but every expert, embedding andPLE tensor arrives Q8_0 - a type three hard gates refused. All of this is code: no data ships with the PR
(
.gitignorekeeps/packs/and/mtp/out), so other users pack their own GGUF locally, the same flowIQ3_S/OrcaRouter users already follow (docs/ORCA.md).
Fmt<8>in iq_kernels.cu (qk 32, 4 ints per block,vec_dot_q8_0_q8_1), adq_q8_0dequantizer, and
case 8in the grouped gate/up/down switches:native_expert_groupedruns Q8_0 experts,the embedding table is Q8_0, and parity against ggml-cpu's own
vec_doton identical weights holds to 1e-7.ROW_BYTESbecomes a runtimerow_bytes(90 B at IQ4_NL, 170 B atQ8_0) everywhere it was compile-time - row cache, page bounds,
issue()- so the per-layer token tablereads either quant.
blk.1.ple_conv1d.weightas F32 (163,840 B) but theengine's PLE kernel reads F16, so half of every f32 word was decoded as a weight: mean |w| 0.43 against the
true 0.0062, layer-1 routing flipped, and the output was PLAUSIBLE GARBAGE, not a crash. iq_pack.py now
writes that tensor as pack index kind 3 (the loader narrows F32 to F16 round-to-nearest-even; proven
bit-exact against the IQ3_S pack's own tensor), narrowing happens whether or not
--compat-bf16is given,and generate.cpp refuses to boot a pack whose conv1d is still wide instead of decoding it as garbage.
neighbours; the pack index carries a per-role shard column and the engine resolves each role's file, so
--nativenames any shard of the family and the head is auto-located byoutput.weight.reserve()falls back fromMAP_HUGETLBto plain 4 KB pages and stayedthere;
MADV_HUGEPAGEcosts nothing and needs no hugetlb pool or privilege, and 116.3 of the arena's119.5 GiB lands on transparent 2 MB pages. Measured neutral on the reference rig - the expert streams are
multi-MB sequential reads, so TLB reach was never the wall - kept for the documented design intent
(include/strata/core/pinned.hpp), A/B with
STRATA_NO_THP=1like the Windows large-pages switch.native_experts.txt header (128 GB; the named shard holds 49) with the shard-family sum as fallback.
HOW OTHERS GET IT - nothing is uploaded, every byte of model data is produced on their machine:
Three things worth saying out loud:
--compat-bf16is mandatory for the plain Q8_0 checkpoint (the routersand projections ship Q8_0 but the engine reads BF16; the packer refuses without the flag, by design); the
conv1d fix lives in the packer, so every rebuilt pack is correct and every OLD broken pack is refused at
boot; and the MTP drafter is per model family, not per quant - build it once, share it between IQ3_S and
Q8_0.
qwen4exp) fedthe exact token ids the engine processed, greedy: the fixed build's first tokens match it exactly and the
two then split on a genuine near-tie (Strata's GPU experts quantize activations to Q8_1; llama.cpp CPU uses
Q8_0 for Q8_0 weights) - the "divergence from IQ3_S" that started this was IQ3_S being a different
quantization, not a bug.
against IQ3_S's 38.7 on the reference 4-card rig, with ~51% expert-cache hits (3,637 of 24,576 pairs
resident at 5.22 MB an expert). Prefill is chunk-bound: 115 tok/s at the 2048-token chunk the first config
shipped, 202 tok/s at 4096 (+75%) - the engine clamps an explicit chunk to what every cache participant can
lend. The 119.5 GiB expert arena needs
numactl --interleave=0,1on dual-socket boards. Quality is thepoint of Q8_0; the trade is deliberate.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.