setup: recommend P-cores + half the E-cores as CPU expert workers on hybrid CPUs (#642)
On a hybrid CPU (Intel 12th gen+, AMD Zen 5 + Zen 5c) setup writes --pool-workers N into the run config: the performance cores but the host loop's one, plus half of the efficiency cores. An E-core runs the expert kernels ~2.2x slower and each layer waits for its slowest part; Hardin22 measured 15 workers at 165 / 116 tok/s against 106 / 84 with all 23 on an i9-14900KF (#642). A recommendation only: the line is in the config, a saved calibration's measured count wins, and a CPU whose cores are all alike gets the same config as before. The engine's pool, with every core allowed (the default affinity), now orders the P-cores first on a hybrid CPU, so a smaller pool runs on the P-cores and the first E-cores rather than on whatever the OS numbered first (from Hardin22's fork). Non-hybrid CPUs: unchanged. Co-Authored-By: Hardin22 <119073350+Hardin22@users.noreply.github.com>
This commit is contained in:
1 parent
09817da397
commit
ad0df801ae
5 files changed
+141
No files matched your search
@@ -95,6 +95,12 @@ CpuTopology detect_cpu_topology(bool skip_first, PoolAffinity affinity) {
|
||||
}
|
||||
|
||||
if (affinity == PoolAffinity::All || !topo.is_hybrid) {
|
||||
// #642 (from Hardin22's fork): on a hybrid CPU the P-cores first (the host takes the first of them), so a
|
||||
// pool smaller than the core count (setup's --pool-workers for a hybrid CPU) runs on the P-cores and the
|
||||
// first E-cores rather than on whatever the OS numbered first. All cores alike: the order is unchanged.
|
||||
if (topo.is_hybrid)
|
||||
std::stable_sort(descs.begin(), descs.end(),
|
||||
[](const CoreDesc& x, const CoreDesc& y) { return x.efficiency > y.efficiency; });
|
||||
for (const auto& c : descs) topo.worker_cores.push_back(c.lps[0]);
|
||||
if (skip_first && !topo.worker_cores.empty()) {
|
||||
topo.host_core = topo.worker_cores.front();
|
||||
@@ -219,6 +225,9 @@ CpuTopology detect_cpu_topology(bool skip_first, PoolAffinity affinity) {
|
||||
}
|
||||
|
||||
if (affinity == PoolAffinity::All || !topo.is_hybrid) {
|
||||
if (topo.is_hybrid) // #642: the P-cores first (see the Windows branch)
|
||||
std::stable_sort(all_cpus.begin(), all_cpus.end(),
|
||||
[](const CoreLinux& x, const CoreLinux& y) { return x.cap > y.cap; });
|
||||
for (const auto& cl : all_cpus) {
|
||||
if (!cl.is_sibling) topo.worker_cores.push_back(cl.cpu);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user