perf: use available cores for embedding ONNX session intra-op threads - #6
perf: use available cores for embedding ONNX session intra-op threads#6ryoma0421 wants to merge 1 commit into
Conversation
With intra_threads(1) the CPU pipeline is bottlenecked by embedding inference and runs at ~1-2x realtime on Apple Silicon. Allowing ORT to use up to 6 cores brings the full pipeline to ~8-9x realtime (measured on M-series with a 5.7-minute meeting recording, batched ONNX models present) with identical diarization output.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesEmbedding session threading
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| src/inference/embedding/session.rs | Replaces the fixed one-thread embedding session configuration with a bounded available-core count; no actionable correctness issue was identified. |
Reviews (1): Last reviewed commit: "perf: use available cores for embedding ..." | Re-trigger Greptile
34993d5 to
b0756b1
Compare
What
The embedding ONNX session is created with
with_intra_threads(1), which bottlenecks CPU-mode execution: on Apple Silicon the full pipeline runs at only ~1-2x realtime (measured with a 5.7-minute meeting recording; embedding inference dominates wall time). This PR lets ORT use up to 6 cores (available_parallelism().min(6), same cap as the segmentation session).Measurements (M-series, CPU mode, 5.7 min Japanese meeting audio, 4 speakers)
Speaker assignment agreement against a labeled ground-truth set is unchanged (96.1% in all three configs, same speaker count).
Happy to adjust the cap or gate it behind a config option if you prefer.
Summary by CodeRabbit