Compare commits
1
Commits
kva-batch
...
kva-batch2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4935569376 |
@@ -14940,6 +14940,11 @@ int main(int argc, char** argv) {
|
|||||||
// the request ends with `YIELDED <slot> <tokens>` + DONE cancel, and the server sends it again later: it
|
// 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.
|
// 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
|
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 {
|
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
|
// --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) -
|
// from the read it goes on from: resume_plan), and every run of it reads in that chunk (force_chunk) -
|
||||||
@@ -15323,9 +15328,10 @@ int main(int argc, char** argv) {
|
|||||||
return v != nullptr ? std::max(0.0, std::atof(v)) : 0.0;
|
return v != nullptr ? std::max(0.0, std::atof(v)) : 0.0;
|
||||||
}();
|
}();
|
||||||
const bool pr_on = piped && pr_piece > 0;
|
const bool pr_on = piped && pr_piece > 0;
|
||||||
|
const bool kva_whole = kva_cold(a0, b0);
|
||||||
auto piece_now = [&]() -> int64_t {
|
auto piece_now = [&]() -> int64_t {
|
||||||
return pr_on ? strata::program::piped_read_piece(pr_piece, C)
|
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);
|
yield_chunks);
|
||||||
};
|
};
|
||||||
// the slots decode through the pipeline for budget_ms, drained before the next read
|
// the slots decode through the pipeline for budget_ms, drained before the next read
|
||||||
@@ -15583,7 +15589,7 @@ int main(int argc, char** argv) {
|
|||||||
for (const int64_t to : cuts) {
|
for (const int64_t to : cuts) {
|
||||||
if (to <= at) continue;
|
if (to <= at) continue;
|
||||||
err.clear();
|
err.clear();
|
||||||
const bool win = windows_ok(at, to);
|
const bool win = windows_ok(at, to) && !kva_cold(at, to);
|
||||||
if (win && !refill(err)) {
|
if (win && !refill(err)) {
|
||||||
std::printf("ERR refilling a lent slot failed: %s\n", err.c_str());
|
std::printf("ERR refilling a lent slot failed: %s\n", err.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in new issue
Block a user