Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

perf(runtime): size intra-op threads to performance cores on Apple Silicon (#170) (#256)

2 months ago

316ef50
Authored
Davy7/26/2026, 6:42:48 AM
The static `available_parallelism().min(8)` intra-op thread policy was flagged
for removal in #170 once measured data existed. A decisive alternating A/B
benchmark on an M3 (4 P-cores + 4 E-cores) showed t=4 (the physical
performance-core count) beat t=8 (all logical cores) on all six pairwise runs,
for both the CPU EP and XNNPACK (num_threads also sizes the XNNPACK worker
pool). Intra-op threads that spill onto the efficiency cores hurt this
latency-sensitive workload.

Replace the inline policy with a pure, unit-tested `intra_thread_count`:
override (OPENKARA_INTRA_THREADS, a bench/diagnostic knob) wins; else the
physical performance-core count when the platform exposes it (Apple Silicon:
hw.perflevel0.physicalcpu via sysctlbyname); else the historical
`available.min(8)` fallback (floored at 1). On every non-Apple-Silicon target
the performance-core helper is a None stub, so behavior there is exactly
unchanged.

Refs #170

Parent02c067a

1 file changed
  • src-tauri/src/separator/model.rs+163−2