mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2751] [CLOSED] cpu pool: STRATA_POOL_FUSED=1 - a native layer's gate/up and down without the barrier between them; pool_layer_bench #4243
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#4243
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/2751
Author: @aslater3
Created: 10/16/2026
Status: ❌ Closed
Base:
main← Head:a770/up-pool-fused📝 Commits (1)
ae51f92cpu pool: STRATA_POOL_FUSED=1 - a native layer's gate/up and down without the barrier between them; pool_layer_bench📊 Changes
7 files changed (+293 additions, -0 deletions)
View changed files
📝
CMakeLists.txt(+4 -0)📝
include/strata/kernels/cpu/pool.hpp(+11 -0)📝
src/kernels/cpu/pool.cpp(+81 -0)➕
src/kernels/cpu/pool_layer_bench.cpp(+187 -0)📝
src/program/generate.cpp(+3 -0)📝
sycl/CMakeLists.txt(+4 -0)📝
sycl/src/program/generate.cpp(+3 -0)📄 Description
CPU pool: a native layer's gate/up and down without the barrier between them (STRATA_POOL_FUSED=1, opt-in)
run_split_multi_nativeruns a layer's CPU experts in two phases: every expert's gate/up rows across all threads,then the host quantizes the intermediates, then every expert's down rows. With
STRATA_POOL_FUSED=1the pool runs anew task mode instead (mode 7):
STRATA_POOL_FUSED_LAG, default 1), so the flag isusually already set when a thread claims one.
Every row goes through the same
native_gu_rows/native_down_rowscall as before, only cut differently, and a row'sresult does not depend on the cut. The output is the same bit for bit (the hash below). Q2_0 layers keep the two phases.
The existing claim protocol is unchanged. Off by default: it is measured on one CPU so far.
Why
On a Ryzen 7 3800X (Zen 2, AVX2, 2 x DDR4-3200) the two halves of an expert are limited by different things.
kq_cpu_bench(fixed in #2750), 7 threads on cores 1-7, 1 token:Gate/up is compute-bound on the i-quant decode (one core: 4-4.6 GB/s, IPC 3.3-3.7 under
perf), and the down rows runat RAM speed. With the barrier, each phase leaves the other's resource idle. Using the SMT siblings as well gave
0-8% (14 threads), so more threads are not the fix.
Measured
pool_layer_bench(new, in this PR) drives the realExpertPoolthe way decode does: one layer's CPU experts per call,6 or 7 distinct experts, a quarter of them with 2 tokens, drawn from 4 GB of blobs. Pinned like the engine (7 workers
on cores 1-7, the host on core 0). It prints a hash of every output over 300 fixed layers. Ryzen 7 3800X, nothing else
running:
1c64c600a48b3217fc3f11e3f60dea422f5f9c94d2c599c5Lag 2 measured the same or 1-2% slower; 8/4 parts were as good as 12/6 and better than 4/2 or 16/8.
In the engine (SYCL build on an Arc A770, Coder IQ1_M, 8K code prompt, 3 same-day pairs, reference tokens in all six
runs) the CPU pool call went from 25.45 / 21.83 / 21.62 to 23.01 / 20.42 / 20.50 ms a round and decode from 37.57 /
39.97 / 40.23 to 38.16 / 41.07 / 41.04 tok/s (+2.1%). That A/B also turned on a separate change to the single-token
IQ2_S gate/up rows (+7% on that kernel alone), which is not in this PR, so the engine numbers are not this change alone.
Also
generate.cpp(CUDA/HIP and SYCL): one stats line saying how many layer calls ran fused, because their down rowsare then counted in the "gate/up" column.
pool_layer_benchin both CMake files.Not measured: AVX-512 CPUs, Intel hybrid CPUs, CUDA/HIP engine runs. The CUDA/HIP
generate.cppline is the samethree lines as the SYCL one; I could not compile the CUDA build here.
STRATA_POOL_FUSED_PARTS=<gu>,<down>overridesthe cut for testing.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.