A Thread-Count Cliff in llama.cpp on a 24-Core Laptop CPU

While benchmarking MoE expert offloading on my laptop (main write-up), I swept the CPU thread count to find the best setting. Instead of a gradual curve, I found a cliff.

Setup

Part Spec
CPU Intel Core Ultra 9 275HX (8 P-cores, 16 E-cores, 24 threads, no hyperthreading)
RAM 96 GB DDR5-5600
GPU NVIDIA RTX 5070 Ti laptop, 12 GB
Model gpt-oss-120b Q8_0 (59.0 GiB)

llama-bench settings: -p 0 -n 126 -r 5 -ngl 99 --n-cpu-moe 32 -fa on --cache-type-k q8_0 --cache-type-v q8_0, KV cache on the GPU. Generation only, empty context.

Results

Threads Generation (t/s)
8 19.48 ± 1.64
12 18.99 ± 0.92
16 18.93 ± 0.77
17 8.27 ± 0.37
18 7.46 ± 0.34
20 6.61 ± 0.15
22 6.04 ± 0.06
24 5.58 ± 0.11
  • 8, 12 and 16 threads are within noise of each other.
  • Going from 16 to 17 threads cut generation by 56%.
  • After 17, speed keeps falling slowly, down to 5.58 t/s at 24.

What it isn't

My first guess was that using every core starves the OS and the GPU driver. That's ruled out: 20 threads, with 4 cores free, was already down to 6.61 t/s.

An earlier sweep looked different

Before this run, I kept the KV cache in system RAM (-nkvo 1, --n-cpu-moe 31, 256-token generation). That sweep dropped off sooner and more gradually:

Threads Generation (t/s)
8 21.80 ± 0.71
12 17.73 ± 2.89
16 9.63 ± 0.55
24 6.35 ± 0.03

So where the cliff falls depends on the setup, not just on the thread count.

What I don't know yet

I don't know what happens at 17 threads. Next tests:

  • Pin threads to specific cores with taskset (P-cores only, E-cores only, mixed) to see whether which cores the threads land on matters more than how many there are.
  • Fill in 19, 21 and 23 threads.
  • Repeat the sweep at a deeper context to see if the cliff moves.

For now: on this laptop, 8 to 16 threads all work, and going above 16 costs more than half the speed.