Skip to content

Commit 816eeda

Browse files
committed
fix(bench): gracefully flush sequences between benchmark iterations
1 parent 33002d0 commit 816eeda

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mistralrs-cli/src/commands/bench.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ pub async fn run_bench(
102102
}
103103
info!("Warmup complete.");
104104

105+
// Clear any residual KV cache from warmup
106+
let sender = mistralrs.get_sender(None).unwrap();
107+
let _ = sender.send(mistralrs_core::Request::TerminateAllSeqsNextStep).await;
108+
105109
// Reset logger counters so benchmark stats are clean
106110
if let Ok(logger) = mistralrs.get_logger(None) {
107111
logger.reset();
@@ -142,6 +146,10 @@ pub async fn run_bench(
142146
let ms_per_tok = 1000.0 / tok_per_sec;
143147
decode_results.push((tok_per_sec, ms_per_tok));
144148
}
149+
150+
// Extremely aggressive cache sweep. Flush the sequences out of the engine.
151+
let sender = mistralrs.get_sender(None).unwrap();
152+
let _ = sender.send(mistralrs_core::Request::TerminateAllSeqsNextStep).await;
145153
}
146154

147155
// Calculate statistics

0 commit comments

Comments
 (0)