mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1639] Community benchmark: 5x Tesla P100 (sm_60), Flash-Next IQ3_S, 262K context — STRATA_STAGE_TRIM data + a Pascal Q6_K kernel #658
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#658
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?
Originally created by @thedrzinger on GitHub (Oct 9, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1639
Measured on 2026-10-08/09 on five Tesla P100s with Flash-Next IQ3_S at the native 262,144-token context. Main limitations: 2 runs per configuration in the main comparison (1 run in the context sweep), and the machine is a Proxmox LXC container with 24 CPU threads and 52 GB of RAM. Only the baseline (A0) used a stock engine. Every other number comes from a locally modified build of
fb58e0d, described under "Hardware and software".Two findings that may be useful beyond Pascal:
STRATA_STAGE_TRIM=1with explicit split points made the largest difference on this rig. With 5 cards, every card kept a full dense copy. With the trim, the expert caches went from 19,364 to 23,702 of 24,576 profiled experts (~98.0% → ~99.9% of the routed mass), and CUDA1/CUDA3 held all of theirs. Measured together with a context change (see table A).dp4aemulated per column. I measured 2-byte loads topping out at ~360 GB/s and 8-byte loads at ~600 GB/s on a P100.native_q6_k_packplanes with 8-byte loads and does FP32 math on exact small integers. It's 1.1-2.2x faster per call and was +7-20% on decode here (table A). It's not bitwise equal to the dp4a kernels (relative difference ~2e-7), so as a PR it would be opt-in.Hardware and software
fb58e0d(engine 0.1.41), built from source withSTRATA_EXPERIMENTAL_SM60=1and-DCMAKE_CUDA_ARCHITECTURES=60. Two builds were used:Stock: the engine
setup.sh --build --cuda 12compiled from unmodifiedfb58e0d. Used for config A0 only.Modified:
fb58e0dplus my local changes, not upstream. Used for A1, A2 and everything after (sections B and C, needles, HumanEval+, vision). The changes:dp4aemulation ininclude/strata/kernels/dp4a.hpp;dp4afallback (prompt-path MMQ).With the kernel off (A1), the only difference from stock is the
dp4achange, which is bit-exact. The Python server, setup and everything else are unmodified.Model and configuration
ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF, IQ3_S (both shards), prepared by the unmodified installer.mtp/rt).--resident-experts), chosen by setup for 52 GB of RAM.--expert-cache auto,--prefill auto,--spec 4 --spec-min-p 0.5. No calibration, experimental speed projection off.Configurations compared (same machine, same workload, back to back):
layer_split auto(picked K=10,19,29,38)STRATA_STAGE_TRIM=1,"layer_split": "10,19,29,38",--max-context 262144A0 → A1 changes only stock settings (trim, split points, context). The engine difference is the bit-exact
dp4achange, which measured no decode difference in isolation. A1 → A2 is the Pascal kernel alone.Method
bench/results/2026-10-06-community-2x-p100/benchmark.py, unchanged. Its synthetic code-explanation prompts are fresh for every request (0 reused tokens, checked in the engine log).Results
A. Settings comparison (2 runs each; median [range])
Decode hit rate 97.6–99.8% in all runs; drafts accepted 142–165 of 203–241 per run.
Expert slots by card (CUDA0..4) and the profiled routed mass the caches held:
At 262K context the slots are a little lower: 4531 on CUDA2, 3232 on CUDA4.
B. Context sweep (config A2; 1 run each)
--kv-resident 32768C. The Pascal kernel in isolation
Per call, measured against
native_mmvq(14, ...)on identical data. Relative max difference 1-2e-7 for 1-8 columns.Memory at A2, 262K, with GPU vision on GPU0:
No OOM, no paging.
Correctness and limitations
Needles (
tools/needle_bench.py, 262K context): 6 of 6 found at 8K (8,064 tokens) and 190K (189,451 tokens), depths 10/50/90.HumanEval+ (EvalPlus 0.1.10, greedy, thinking off, standard EvalPlus prompt, 164 problems):
Two kernel-on runs already differ on 6 problems (cache and CPU/GPU rounding between restarts), and kernel on vs off differ on 2-5. So no measurable effect from the kernel.
Vision (GPU, encoder pinned to GPU0 via
"cuda_device": 0): read the text and shapes of a test image correctly. Expert caches and decode speed were unchanged.Not tested:
--pipeline-windows;A0 differs from A1 in context (32K vs 262K) as well as the trim, so table A does not isolate the trim alone. The slot counts do.
Other gains: the stock dp4a emulation could also use PRMT + 16-bit MADs (bit-exact, 1.46x in isolation). It had no measurable effect on decode here, so I'm not proposing it.
@ruibeikaa commented on GitHub (Oct 9, 2026):
@thedrzinger Thanks for the five-P100 report. On the dp4a emulation: decode does not move here either, but the prompt path does, once the form is chosen by rows per expert. With a two-file change to ggml's sm_60 MMQ, prompt reads on four GP100 dies take 2.5–8.4% less time (34,835-token read 50.337 / 50.516 s → 49.186 s; 90-token read 1.278 / 1.277 s → 1.170 s), with replies identical bit for bit and decode unchanged.
Conditions: 2× PH402 SKU 200 (four GP100 dies, sm_60, 48 SMs, 32 GB HBM2 each), clocks locked at 1050 MHz, 140 W cap, Windows 11, driver 581.80 (TCC), CUDA 12.9. Strata 0.1.41 (
fb58e0d) source build for sm_60 that carries several open PRs (#1424, #1656 and #1674 among them) plus local commits. The two builds differ only in the llama.cpp checkout MMQ is compiled from. Swift 1.5 IQ3_XXS,--layer-split 12,24,36, every expert resident,--prefill auto,STRATA_PREFILL_PIPE=768(#1441),STRATA_MMQ_RESIDENT_SORT_NE=1, greedy. One engine start per arm and two warm-up requests, then the same five requests in a fixed order. Arms ran base → patch → base again, one request per prompt per arm.Which form wins depends on rows per expert. This is the MMQ the prompt path links, timed alone on one die. The shapes are Swift's expert shapes, gate/up 1280 × 2560 and down 2560 × 640, IQ3_XXS with random weights, 16 experts per launch and R rows per expert. The engine stayed loaded on the dies during these runs, idle as far as we know. ggml picks the MMQ tile width J from R: the smallest J with the fewest tiles, so R = 8 → J = 8, 15 → 16, 20 and 24 → 24, and 64 and more → 64. On this config the base kernel does 0.629 T MAC/s on gate/up at R = 8 and 1.616 at R = 512, so few rows per expert is where it is weakest. Time per launch against byte-wise in the same run (- = faster):
For the patch, down is -22.7 / -11.1 / -5.9 / -4.1 / -3.9% at the same R. At R = 20, 24 and 48 it is -8.2 / -7.3 / -4.4% on gate/up and -7.8 / -8.0 / -4.8% on down. In absolute terms, gate/up at R = 8 goes from 630.9 → 489.5 us per launch, gate/up at R = 256 from 8334.3 → 8015.3 us, and down at R = 8 from 250.4 → 193.5 us. Output hashes equal base at every shape and R: 16 of 16 in the patch run (R 8–256), 10 of 10 in a run of the patch exactly as built for the engine (R 8, 15, 24, 64, 256), and all of them for the six variants above.
Why it stays bit-exact: PRMT sign-extends the byte pairs into 16-bit halves, and the four 16 × 16 products give the same int32 sum as the byte-wise form. The J ≤ 16 path changes only the order of integer additions, which are exact, and keeps the float accumulation in the same k01 order.
End to end (prompt read time from the engine's per-request line):
src/prefill/prefill.cpp(v0.1.40.3), cut at 3,500 and 105,000 characters, plus a one-line question. The appended 1K is the next 3,500 characters.Where the change lives. Both pieces are in llama.cpp's ggml-cuda, not in Strata:
common.cuhholds the__CUDA_ARCH__ < 610fallback ofggml_cuda_dp4a.mmq-vec-dot.cuhholdsggml_cuda_mmq_vec_dot_q8_0_q8_1_dp4a, which the IQ3_XXS and IQ3_S tiles both go through, and so do the Q8_0 tiles the prompt path uses for the MTP draft head (code reading; IQ3_S not measured).In Strata only
src/prefillcalls that MMQ. The decode kernels take their dp4a frominclude/strata/kernels/dp4a.hpp(4× VMAD), which this change does not touch, so it cannot move decode (code reading; measured decode above agrees). You switched that file to PRMT and saw no decode change. We did not try that, but in isolation PRMT was slower than VMAD here (last table), so we would not expect a decode gain from it on this rig either (inference). Strata compiles MMQ from the llama.cpp commit it pins, 3cf03257:setup.pyunpacks it intothird_party/llama.cppand passes that as-DSTRATA_GGML_DIR, and a plain CMake build fetches it. Neither has a patch step, so a Strata PR cannot carry this as things stand. The diff against 3cf03257 (applies withgit apply; llama.cpp master still has the byte-wise fallback):The diff (two files, against 3cf03257)
What did not help (tile loader, sign masks, occupancy, I tile)
What did not help. These were tried in the same harness; the numbers are gate/up (down behaved similarly), and T MAC/s changes are throughput (- = slower). They may save you the time:
unpack_ksigns+__vcmpne4in the IQ3_XXS loader: -4.4% to +1.0% T MAC/s.The dp4a forms in isolation, and your 1.46×
In isolation (one GP100 die, 8 independent accumulators per thread). Exactness was checked on 1.07e9 cases: edge values, every byte pair in every lane, and random ones.
Over byte-wise that is 1.14× for VMAD, and 1.04× and 1.11× for the two PRMT forms; over VMAD the two PRMT forms are 0.91× and 0.97× (computed from the table). Both are well short of your 1.46×. Was that against the byte-wise form or against dp4a.hpp's VMAD? In MMQ the order also flips with R: VMAD alone is the fastest form at R = 8 and 15 but 8.7–12.2% behind byte-wise at R = 64 and 256. So an isolated number did not tell which form to use in MMQ. Why the order flips is not established: nvprof metric collection failed here with "Internal profiling error 4212:27", and only summary mode worked.
Not measured: IQ3_S or Flash-Next, P100 cards, five stages, Linux, three or more runs per arm, other MMQ types, and ggml's other sm_60 dp4a callers (MMVQ and the rest of ggml-cuda, which Strata does not build). Not affected: compute capability 6.1 (P40, P4, GTX 10 series), which has
__dp4a, so neither path is compiled there.If you're willing, a prompt-read A/B on your P100s would tell whether the J ≤ 16 path holds on IQ3_S over five stages. That means
fb58e0dwith this diff applied to the llama.cpp tree it builds MMQ from (third_party/llama.cppin a setup.sh build), against the same build without it. Your PRMT-only ggml build as a third arm would separate the two pieces.@thedrzinger commented on GitHub (Oct 9, 2026):
@ruibeikaa Had claude run the A/B you asked for on the P100s, with a fourth arm and a correction to my report.
Short version: on 5x P100 with Flash-Next IQ3_S, the dp4a fallback form accounts for the prompt-read gain (−3 to −8%). The J ≤ 16 path added nothing measurable here. Replies were identical bit for bit in every run, and decode was unchanged.
Arms. Same source (
fb58e0d+ my local P100 changes, the same build otherwise), differing only in the llama.cpp tree MMQ is compiled from, all at3cf03257:common.cuh, stockmmq-vec-dot.cuhmad.wide.s16fallback only (what I run)git applyclean): PRMT with C 16-bit products + the J ≤ 16 VMAD treemad.wide.s16fallback + your J ≤ 16 path andstrata_dp4a_vmadhelperConditions:
--layer-split 10,19,29,38withSTRATA_STAGE_TRIM=1, 262,144 context,--prefill auto,--spec 3, greedy, reasoning off, 64-token cap.STRATA_PREFILL_PIPEorSTRATA_MMQ_RESIDENT_SORT_NE.src/prefill/prefill.cpp, cut at 3,500 and 105,000 characters, plus a question;Prompt read time from the engine's per-request line (seconds, round 1 / round 2; change of the mean vs base):
mad.wide.s16one (333 vs 356 G/s). The only other difference between the two arms is the J ≤ 16 path, which j16 shows is neutral here.Your question about my 1.46×. It was against Strata's VMAD form (
dp4a.hpp), not byte-wise. And it overstates things: in my harness one operand was shared by the 8 accumulators in each iteration, so its two PRMTs were amortized. With both operands fresh on every call your numbers are the fairer ones, and they match what I saw end to end: no decode change from switchingdp4a.hppto PRMT. I'll treat that part of my report as "neutral for decode, bit-exact". The prompt-read gain above comes from ggml's fallback.@ruibeikaa commented on GitHub (Oct 9, 2026):
@thedrzinger Thanks for running it, and for the four arms. Your form wins here too, by more than I expected.
I built your
mad.wide.s16fallback into the same harness (IQ3_XXS, Swift's expert shapes, 16 experts per launch, one GP100 die, same random weights) beside the two forms I posted. Time per launch, output hashes equal in every cell:mad.wide.s16(yours)down 2560 × 640 behaves the same: 312.2 → 270.4 µs at R = 15, 409.2 → 344.1 at 24, 3255.2 → 2840.2 at 256.
So the J ≤ 16 tree only beats your form at R = 8 (by 2%), and at R = 15 it loses to it by 12%. Your reading of why the tree did nothing on your rig also holds here: it only ever runs at J ≤ 16, and with 10 of 512 experts that needs chunks under about 820 tokens. On this rig the 1K reads do use 512-token chunks (
STRATA_PREFILL_PIPE), which is why it showed up in my harness and not in yours.I've dropped the tree and switched this rig to your form alone. End to end on four GP100 dies, same requests as before, bracketed starts (previous patch → yours → previous patch), replies identical:
STRATA_PREFILL_PIPE=290, read sAgainst the closer of the two bracketing starts: −4.8% at 1K, −5.6% at 30K, −3.4% on the appended read; the two short prompts are within their own noise. The two bracketing starts disagree by 6% on the 30K read (49.456 vs 46.573; an earlier start today read it in 46.545), so the first one looks like the outlier, and I would not claim more than the −5.6%. Decode moved within 0.0–1.4 tok/s between the builds. The 1K reads here use 512-token chunks, so this is also the case where the dropped tree used to apply; your form still wins there end to end.
On the 1.46×: thanks for checking the harness, that settles it. The isolated numbers I posted had both operands fresh per call; with one operand shared across the 8 accumulators the two PRMTs of that operand are amortized, which is also the shape inside MMQ's inner loop (the y tile is reused across the x rows), so your in-MMQ result is the one that counts.
The only question left on my side is the C-products form: it is 3.8–11.5% faster than byte-wise in isolation but 10–17% slower than yours in MMQ at R ≥ 15, and I have not looked at why (register pressure or the extra I2I/SHF the compiler emits around the 16-bit products would be my guess; not measured).
@thedrzinger commented on GitHub (Oct 9, 2026):
@ruibeikaa Thanks for re-running it on your side. Good to see the
mad.wide.s16form hold up on GP100 with smaller chunks too. To close this out, here's where my 5x P100 setup ended up and how it got there.Final config. Flash-Next IQ3_S, 262,144 context, all 5 cards, served through llama-swap, vision on (encoder pinned to GPU0).
fb58e0d+ local changes.STRATA_STAGE_TRIM=1with"layer_split": "10,19,29,38";--spec 3 --spec-min-p 0.5;--mtp-draft-vocab data/draft_vocab_en.bin;--resident-experts.How it got there (engine decode tok/s, greedy, reasoning off, 256-token cap):
STRATA_STAGE_TRIM=1, explicit split, 262K context (experts in VRAM 19,364 → 23,702 of 24,576)Later steps were measured through llama-swap: 3 runs each at ~600 / 4.3K / 17K tokens, mean of the 9.
--spec 4(setup's)--spec 3+ English draft vocabAt a 200K-token prompt decode is ~36 tok/s. Needles were 6/6 at 8K and 190K. HumanEval+ was unchanged (96.3% / 93.9%, inside the run-to-run range of earlier runs).
The expert kernel may matter for your Swift IQ3_XXS.
Tried and dropped (slower than stock on P100, or no effect):
--spec2 / 5 / 6, and--spec-min-p0.3 / 0.7;STRATA_HC_Q8, a no-op here: this GGUF stores the HC projections as BF16.On the C-products question: I didn't look at it either, so I have nothing to add to your guess.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.