Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions tools/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3591,13 +3591,13 @@ struct server_context {
// next, batch any pending prompts without exceeding n_batch
if (params_base.cont_batching || batch.n_tokens == 0) {
for (auto & slot : slots) {
if (!slot.is_processing()) {
continue;
}

// check if we can batch this slot with the previous one
if (slot.is_processing()) {
if (!slot_batched) {
slot_batched = &slot;
} else if (!slot_batched->can_batch_with(slot)) {
continue;
}
if (slot_batched && !slot_batched->can_batch_with(slot)) {
continue;
}

// this slot still has a prompt to be processed
Expand Down Expand Up @@ -4028,6 +4028,10 @@ struct server_context {
}
}

if (!slot_batched) {
slot_batched = &slot;
}

if (batch.n_tokens >= n_batch) {
break;
}
Expand Down
Loading