setup: recommend the hybrid worker count only with more E-cores than P-cores (#642)

docs/AMD_HIP.md's gfx1030 report measured an i7-13700KF (8P + 8E) at 38-42 tok/s with
all 15 workers against 36 with 8, so a CPU with no more E-cores than P-cores keeps the
engine's own count; the E-heavy chips the fork measured (i9-14900KF: 15 of 23 faster)
get the recommendation.
This commit is contained in:
Niko1221 committed 2026-10-03 19:12:20 +02:00
1 parent 89bad9a4ec
commit fc38595c65
2 files changed
+8 -3

No files matched your search

+6 -2
View File
@@ -341,11 +341,15 @@ def cpu_cores():
def hybrid_pool_workers(cores) -> int | None:
"""#642 (Hardin22's measurement): on a hybrid CPU the expert pool runs best on the P-cores but the host loop's one
plus HALF of the E-cores - an E-core runs the expert kernels ~2.2x slower and each layer waits for its slowest
part (i9-14900KF, 8P + 16E: 15 workers decoded 165 / 116 tok/s against 106 / 84 with all 23). None: not hybrid
(the engine's own default, one worker per physical core but the host's, stays)."""
part (i9-14900KF, 8P + 16E: 15 workers decoded 165 / 116 tok/s against 106 / 84 with all 23). Only on a CPU with
more E-cores than P-cores: on an i7-13700KF (8P + 8E, docs/AMD_HIP.md's gfx1030 report) all 15 workers decoded
38-42 tok/s against 36 with 8, so there the engine's own count stays. None: the engine's own default (one worker
per physical core but the host's) stays."""
if not cores:
return None
p, e = cores
if e <= p:
return None
return max(1, p - 1 + e // 2)
+2 -1
View File
@@ -23,7 +23,8 @@ class HybridWorkers(unittest.TestCase):
self.assertEqual(setup.hybrid_pool_workers((8, 16)), 15) # i9-14900K: the fork's measured 15
self.assertEqual(setup.hybrid_pool_workers((6, 8)), 9) # i5-13600K
self.assertEqual(setup.hybrid_pool_workers((4, 8)), 7) # Ryzen AI 9 HX 370 (Zen 5 + Zen 5c)
self.assertEqual(setup.hybrid_pool_workers((1, 1)), 1)
self.assertIsNone(setup.hybrid_pool_workers((8, 8))) # i7-13700K: all cores measured faster (AMD_HIP.md)
self.assertIsNone(setup.hybrid_pool_workers((8, 4)))
def test_recommend_keeps_a_given_count(self):
with mock.patch.object(setup, "cpu_cores", lambda: (8, 16)), mock.patch.object(setup, "ok", lambda *a: None):