Skip to content

Commit f70fef4

Browse files
committed
Adapt batch warmup to sweep-bench
From ikawrakow/ik_llama.cpp#375 Hardcoded to true to always run to avoid adding more arguments.
1 parent 7b3da05 commit f70fef4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

examples/sweep-bench/sweep-bench.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,25 @@ int main(int argc, char ** argv) {
161161
}
162162
}
163163

164+
// Adapted into mainline from original PR: https://github.com/ikawrakow/ik_llama.cpp/pull/375
165+
//if (params.batch_warmup) {
166+
if (true) {
167+
// clean up KV cache after generation
168+
llama_kv_self_clear(ctx);
169+
170+
// prepare batch of pp size for prompt processing performance measurement
171+
common_batch_clear(batch);
172+
173+
for (unsigned int i = 0; i < (unsigned int)params.n_ubatch; ++i) {
174+
common_batch_add(batch, std::rand() % n_vocab, i, { 0 }, false);
175+
}
176+
177+
if (!decode_helper(ctx, batch, ctx_params.n_ubatch)) {
178+
LOG_INF("%s: llama_decode() failed\n", __func__);
179+
return 1;
180+
}
181+
}
182+
164183
common_batch_clear(batch);
165184
//llama_batch_clear(batch);
166185
llama_kv_self_clear(ctx);

0 commit comments

Comments
 (0)