Skip to content

Commit 4bbce1e

Browse files
committed
benches : update
1 parent f5b477a commit 4bbce1e

3 files changed

Lines changed: 127 additions & 120 deletions

File tree

examples/bench/bench.cpp

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,38 @@ static int whisper_bench_full(const whisper_params & params) {
8585
fprintf(stderr, "error: failed to set mel: %d\n", ret);
8686
return 3;
8787
}
88-
// heat encoder
89-
if (int ret = whisper_encode(ctx, 0, params.n_threads) != 0) {
90-
fprintf(stderr, "error: failed to encode: %d\n", ret);
91-
return 4;
92-
}
9388

9489
whisper_token tokens[512];
9590
memset(tokens, 0, sizeof(tokens));
9691

97-
// prompt heat
98-
if (int ret = whisper_decode(ctx, tokens, 256, 0, params.n_threads) != 0) {
99-
fprintf(stderr, "error: failed to decode: %d\n", ret);
100-
return 4;
101-
}
92+
// TODO: need 2 loops because of the current graph capture logic in the CUDA backend
93+
// https://github.com/ggml-org/llama.cpp/pull/19754
94+
for (int h = 0; h < 2; ++h) {
95+
// heat encoder
96+
if (int ret = whisper_encode(ctx, 0, params.n_threads) != 0) {
97+
fprintf(stderr, "error: failed to encode: %d\n", ret);
98+
return 4;
99+
}
102100

103-
// text-generation heat
104-
for (int i = 0; i < 256; i++) {
105-
if (int ret = whisper_decode(ctx, tokens, 1, i, params.n_threads) != 0) {
101+
// prompt heat
102+
if (int ret = whisper_decode(ctx, tokens, 256, 0, params.n_threads) != 0) {
106103
fprintf(stderr, "error: failed to decode: %d\n", ret);
107104
return 4;
108105
}
109-
}
110106

111-
// batched heat
112-
if (int ret = whisper_decode(ctx, tokens, 5, 0, params.n_threads) != 0) {
113-
fprintf(stderr, "error: failed to decode: %d\n", ret);
114-
return 4;
107+
// text-generation heat
108+
for (int i = 0; i < 256; i++) {
109+
if (int ret = whisper_decode(ctx, tokens, 1, i, params.n_threads) != 0) {
110+
fprintf(stderr, "error: failed to decode: %d\n", ret);
111+
return 4;
112+
}
113+
}
114+
115+
// batched heat
116+
if (int ret = whisper_decode(ctx, tokens, 5, 0, params.n_threads) != 0) {
117+
fprintf(stderr, "error: failed to decode: %d\n", ret);
118+
return 4;
119+
}
115120
}
116121

117122
whisper_reset_timings(ctx);

0 commit comments

Comments
 (0)