Skip to content

Commit 3b653c7

Browse files
committed
Make whisperfile go 2x faster on 96 core cpu
When decoding a small batch, it's mostly only doing matvec ops. In these cases, using more cores hurts more than it helps.
1 parent 13e647b commit 3b653c7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

whisper.cpp/whisper.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2774,7 +2774,7 @@ static bool whisper_decode_internal(
27742774
whisper_context & wctx,
27752775
whisper_state & wstate,
27762776
const whisper_batch & batch,
2777-
const int n_threads,
2777+
int n_threads,
27782778
bool save_alignment_heads_QKs,
27792779
ggml_abort_callback abort_callback,
27802780
void * abort_callback_data) {
@@ -2866,6 +2866,11 @@ static bool whisper_decode_internal(
28662866

28672867
logits = gf->nodes[gf->n_nodes - 1];
28682868

2869+
if (batch.n_tokens < 16) {
2870+
if (n_threads > 20)
2871+
n_threads = 20;
2872+
}
2873+
28692874
if (!ggml_graph_compute_helper(sched, gf, n_threads)) {
28702875
return false;
28712876
}

0 commit comments

Comments
 (0)