mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#3441
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/1416
Author: @architectds
Created: 10/7/2026
Status: ❌ Closed
Base:
main← Head:pr/cpu-share-gpuquant📝 Commits (3)
4555263prefill: the CPU share up to 3,072-token chunks, from mapped experts too, and on a layer split's stagesca6fbfadocs: the CPU share up to 3,072-token chunks, from mapped experts, on a split - and what it measured6848915prefill: the CPU share's activations quantized on the GPU, copied down beside the routing sync📊 Changes
4 files changed (+179 additions, -48 deletions)
View changed files
📝
docs/DETAILS.md(+25 -7)📝
include/strata/prefill/prefill.hpp(+9 -3)📝
src/prefill/prefill.cpp(+138 -36)📝
src/program/generate.cpp(+7 -2)📄 Description
Title
Issue: none - builds on #1414 (this branch carries its two commits; the new one is the last,
6848915).Summary
With
STRATA_PREFILL_CPU_SHAREon, every layer of a staged chunk copied its MoE input to the host as floats (T x n_embdx 4 bytes) before the layer's routing sync, and the share's thread then quantized the tokens the CPU's experts read.
Now a layer whose gate/up take Q8_K or Q8_0 activations has them quantized on the GPU (
quantize_q8_K/quantize_q8_0, ggml's bytes) into a small device buffer, which is copied down on a stream of its own: about a quarterof the bytes, and the routing sync no longer waits for them. The thread waits for that copy instead of quantizing.
Q2_0 gate/up layers (ActQ activations) copy the floats as before.
Measured against #1414 in the same window (Windows 11, Ryzen 9 5900XT, 96 GB DDR4-3200, PCIe 3.0 x8,
--mmap-experts,q4_0 KV): fresh prompts after an 8K prewarm, medians of 5 interleaved rounds, #1414 / this, ms:
Up to 1,000 tokens the two are the same within noise; the larger the chunk, the more floats it no longer copies. The
same arms run in two windows two hours apart differed by up to 4%, so these are small gains, measured on one PC.
What changed
src/prefill/prefill.cppImpl:cpu_qdev/cpu_qhost(T xkNativeActBytes, on the device and page-locked; at most 12 MB of VRAM at a3,071-token chunk, allocated on first use), a stream
cpu_csand two events;releasefrees them.mixedis quantized on the main stream once the previous layer's copy has finishedreading
cpu_qdev, and T xact_bytesare copied down oncpu_cs. The CPU thread waits for that copy and pointsits jobs at those bytes.
Extra Notes
quantize_q8_Kis ggml'squantize_row_q8_K_reftranscribed (with its parity test), andquantize_q8_0writes ggml's bytes. So the CPU's experts should read the same bytesnative_quant_actgave them,and the output should match #1414's. I did not compare outputs here.
measured its own share 3% / 5% ahead of #1414 at 2,000 / 3,000 tokens on one card; this closes most of that.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.