mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #1254] [Optimization] Support CPPC / configurable core placement for host loop and expert pool #516
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#516
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 @bceenaeiklmr on GitHub (Oct 6, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1254
Feature / Optimization: Support CPPC preferred core placement for host loop and expert pool (avoid pinning host loop to slowest core)
Context
In
src/kernels/cpu/pool.cpp,CorePlacement::CorePlacementinitializes the placement for the host loop and the worker pool:Problem
On modern multi-core x86 processors with asymmetric core performance (AMD Zen 3/4/5 ACPI CPPC preferred cores, Intel hybrid P/E architectures), silicon binning varies across physical cores on the die.
Hardcoding
host_ = cores_.back().front()blindly pins the latency-critical host thread to the highest-numbered physical core (e.g. Core 7 on an 8-core CPU).On an AMD Ryzen 7 5800X3D (8C/16T, dual RTX 3090 setup), querying the Windows kernel ACPI CPPC power capabilities (Kernel-Processor-Power Event ID 55) reveals:
Because the host thread runs
session_loop, spins oncudaEventQuery, schedules CUDA kernels across GPUs, conducts MTP verification, and handles token sampling, pinning it to the slowest silicon core caps its single-threaded boost frequency and introduces unnecessary scheduling latency.Proposed Solution
Allow runtime overrides via environment variables (
STRATA_HOST_PROCandSTRATA_WORKER_PROCS) inCorePlacement::CorePlacement:This allows setting in
strata-<model>.json:Alternatively, query OS CPPC information at startup:
GetSystemCpuSetInformation/ ACPI_CPCobjects/sys/devices/system/cpu/cpu*/acpi_cppc/highest_perfand sort cores by performance before allocating
host_andworkers_.Verification & Benchmarks
Testing with Qwen3.8-Flash-Next on Dual RTX 3090s and Ryzen 7 5800X3D:
6,2,8,10,12,14):@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.
@bceenaeiklmr commented on GitHub (Oct 14, 2026):
Hi @Niko1221,
Thank you for following up. I tested this on the official 0.1.44 release (and 0.1.44.1). The issue
persists because
detect_cpu_topology()insrc/kernels/cpu/pool.cpponly handles IntelEfficiencyClass(P-core vs E-core separation).
On desktop processors where all physical cores report
EfficiencyClass = 0, the engine's core allocationoffers only two hardcoded placements:
--host-core first(Core 0) or--host-core last(highest-numberedcore).
1. Engine Log on Official 0.1.44
Running the official prebuilt
strata 0.1.44:--host-core first:strata generate: 7 pool workers on logical processors 2,4,6,8,10,12,14, the host thread on 0 (draining too) (--
host-core first)
strata generate: session is up (engine 0.1.44)
--host-core last(orSTRATA_HOST_CORE=last):strata generate: 7 pool workers on logical processors 0,2,4,6,8,10,12, the host thread on 14 (draining too) (--
host-core last)
strata generate: session is up (engine 0.1.44)
2. Why this affects all modern asymmetric & ranked x86 CPUs
This isn't limited to the 5800X3D; it fundamentally affects any modern multi-core architecture with core
ranking or asymmetry:
via Windows Kernel-Processor-Power ACPI CPPC capabilities), Core 2 and Core 3 are rated at 158% (Gold Star
preferred), whereas Core 7 is 133% (the lowest-binned core on the entire chip).
higher frequency (5.7 GHz). Blind placement crosses the interconnect or lands on the wrong CCX.
200–400 MHz higher than the rest. Current logic sorts P vs E, but treats all P-cores as identical.
and system DPCs are routed to Core 0 (logical processors 0 and 1).
--host-core firstforces the timing-critical host loop (which spins on CUDA events, orchestratesmulti-GPU streams, and verifies MTP drafts) to compete directly with high-frequency PCIe interrupts on Core 0.
--host-core lastavoids Core 0, but blindly lands on the lowest-binned silicon core on the chip.3. Empirical Benchmarks (Dual RTX 3090 + Ryzen 7 5800X3D)
Testing with Qwen3.8-Flash-Next (262K context, dual RTX 3090 layer split):
and assigning 6 pool workers to Cores 3, 1, 4, 5, 6, 7 (
STRATA_HOST_PROC=4,STRATA_WORKER_PROCS=6,2,8,10,12, 14):traffic.
4. Proposed Solution
Adding a zero-overhead runtime environment variable override in
detect_cpu_topology()(
src/kernels/cpu/pool.cpp) gives users an immediate escape hatch without breaking any existing defaults:The requested log