Skip to content

Commit

Permalink
effectively cancel the request on the executor
Browse files Browse the repository at this point in the history
  • Loading branch information
mfuntowicz committed Dec 4, 2024
1 parent b6dbf60 commit 460f290
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions backends/trtllm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@ mod ffi {
fn pull_tokens(
self: Pin<&mut TensorRtLlmBackendImpl>,
) -> Result<UniquePtr<CxxVector<GenerationStep>>>;

fn cancel(self: Pin<&mut TensorRtLlmBackendImpl>, request_id: u64);
}
}
4 changes: 3 additions & 1 deletion backends/trtllm/src/looper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ fn executor_status_looper(
}

if backend.num_tokens_ready() > 0 {
match backend.pin_mut().pull_tokens() {
let backend = backend.pin_mut();
match backend.pull_tokens() {
Ok(responses) => {
// Iterate through all the decoded token
for step in responses.deref() {
Expand All @@ -140,6 +141,7 @@ fn executor_status_looper(

if posted.is_err() || step.is_final {
debug!("Removing {}", step.request_id);
backend.cancel(step.request_id);
let _ = in_flights.remove(&step.request_id);
}
} else {
Expand Down

0 comments on commit 460f290

Please sign in to comment.