KVA: allow batch slots and read cold batch prompts in one run (0.1.55)
This commit is contained in:
1 parent
c62d5e3a15
commit
2d955e652f
1 file changed
+8
-3
@@ -6268,7 +6268,6 @@ int main(int argc, char** argv) {
|
||||
"every prompt is read exactly\n");
|
||||
if (kc.on) {
|
||||
if (multi_gpu) ke.blocked = "a layer split across GPUs";
|
||||
else if (o.batch > 0) ke.blocked = "batch slots (--batch)";
|
||||
else if (o.peer_device >= 0) ke.blocked = "a peer device (--peer-device)";
|
||||
if (!ke.blocked.empty()) {
|
||||
if (kc.explicit_on)
|
||||
@@ -15130,6 +15129,11 @@ int main(int argc, char** argv) {
|
||||
// the request ends with `YIELDED <slot> <tokens>` + DONE cancel, and the server sends it again later: it
|
||||
// continues from the slot with the same chunks. #656's cooperative preemption, with a slot as the park.
|
||||
int64_t req_chunk = 0, req_chunk_len = 0; // the DONE line's chunk=: the longest batched segment's first chunk
|
||||
auto kva_cold = [&](int64_t at, int64_t to) -> bool {
|
||||
const auto& kc = strata::prefill::kva_config();
|
||||
return o.batch > 0 && kc.on && strata::prefill::kva_engine().blocked.empty() &&
|
||||
at == 0 && (to - at) >= kc.min_prompt && (to - at) > kc.effective_suffix() + 64;
|
||||
};
|
||||
auto read_part = [&](int64_t a0, int64_t b0, std::string& e) -> bool {
|
||||
// --prefill-pipe on a layer split: the segment's chunk is planned ONCE, on its whole length (or taken
|
||||
// from the read it goes on from: resume_plan), and every run of it reads in that chunk (force_chunk) -
|
||||
@@ -15652,9 +15656,10 @@ int main(int argc, char** argv) {
|
||||
return v != nullptr ? std::max(0.0, std::atof(v)) : 0.0;
|
||||
}();
|
||||
const bool pr_on = piped && pr_piece > 0;
|
||||
const bool kva_whole = kva_cold(a0, b0);
|
||||
auto piece_now = [&]() -> int64_t {
|
||||
return pr_on ? strata::program::piped_read_piece(pr_piece, C)
|
||||
: strata::program::batch_read_piece(o.batch > 0, piped, !stages.empty(), batch_on(), C,
|
||||
: strata::program::batch_read_piece(o.batch > 0 && !kva_whole, piped, !stages.empty(), batch_on(), C,
|
||||
yield_chunks);
|
||||
};
|
||||
// the slots decode through the pipeline for budget_ms, drained before the next read
|
||||
@@ -15912,7 +15917,7 @@ int main(int argc, char** argv) {
|
||||
for (const int64_t to : cuts) {
|
||||
if (to <= at) continue;
|
||||
err.clear();
|
||||
const bool win = windows_ok(at, to);
|
||||
const bool win = windows_ok(at, to) && !kva_cold(at, to);
|
||||
if (win && !refill(err)) {
|
||||
std::printf("ERR refilling a lent slot failed: %s\n", err.c_str());
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user