prefill: the CPU share up to 3,072-token chunks, from mapped experts too, and on a layer split's stages
STRATA_PREFILL_CPU_SHARE handed the CPU pool its share of a chunk below 1,024 tokens only, only experts in page-locked RAM, and only on one GPU. With it set: - the chunks staged after their routing (the only ones the share applies to) go up to STRATA_PREFILL_CPU_SHARE_MAX tokens (default 3072, at least 1024) instead of 1024; Prefill::arm_cpu_share sets the limit before any loan is sized, and init sets it too; - an expert whose blob the CPU reads from RAM without assembling it (the arena's unpinned part, the mapped experts.bin's pages) can go to the CPU, not only a page-locked one; the blob pointers are taken when the experts are chosen, and one without a stable blob stays on the GPU; - on a layer split every stage has the pool (serve, no --batch), and one stage at a time takes it for a chunk while the other reads its chunk on the GPU alone. Unset, nothing changes.
This commit is contained in:
1 parent
f2a3b946e9
commit
92bce20e4b
3 files changed
+69
-24
No files matched your search
@@ -6087,6 +6087,10 @@ int main(int argc, char** argv) {
|
||||
// confirms every emitted token against the real model regardless of where the draft came from.
|
||||
const bool use_mtp = !o.mtp.empty();
|
||||
strata::prefill::Prefill sp;
|
||||
// the pool is idle while a prompt is read unless batch slots decode between its parts; with
|
||||
// STRATA_PREFILL_CPU_SHARE the staged-chunk limit before the chunk below sizes the loans (bytes_needed reads it)
|
||||
const bool share_pool = o.batch <= 0 && !o.no_pool;
|
||||
strata::prefill::Prefill::arm_cpu_share(share_pool);
|
||||
void* borrow = nullptr;
|
||||
uint64_t borrow_bytes = 0;
|
||||
int32_t lend_first = -1; // the first slot the prompt path may borrow (its largest chunk)
|
||||
@@ -6373,6 +6377,7 @@ int main(int argc, char** argv) {
|
||||
sb = st.cache.device_slot(pf_parts[i + 1].first);
|
||||
sbb = part_bytes(pf_parts[i + 1], pf_parts[i + 1].first);
|
||||
}
|
||||
if (share_pool) st.sp.set_cpu_pool(&pool); // one stage at a time takes it for a chunk (prefill.cpp)
|
||||
if (!st.sp.init(st.wt, g, st.ss, srcp, &st.cache, host_res.data(), o.prefill_chunk, (void*) st.stream,
|
||||
err, sb, sbb)) {
|
||||
err = "layer split, CUDA" + std::to_string(st.dev) + " prompt path: " + err;
|
||||
@@ -6380,8 +6385,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
if (multi_gpu) sp.set_stage(0, split_at[0], &stages[0]->sp);
|
||||
// the pool is idle while a prompt is read unless batch slots decode between its parts
|
||||
if (!multi_gpu && o.batch <= 0 && !o.no_pool) sp.set_cpu_pool(&pool);
|
||||
if (share_pool) sp.set_cpu_pool(&pool);
|
||||
if (!sp.init(wt, g, ss, srcp, &xcache, host_res.data(), o.prefill_chunk, main_cs, err, borrow, borrow_bytes))
|
||||
return err.find("do not fit") != std::string::npos ? 2 : 1;
|
||||
return 0;
|
||||
@@ -10917,6 +10921,7 @@ int main(int argc, char** argv) {
|
||||
int64_t pos_start = 0;
|
||||
int64_t spec_pos = 0; // plan v0.3 P6: where the speculative loop starts (0 = not used)
|
||||
strata::prefill::Prefill prefill;
|
||||
strata::prefill::Prefill::arm_cpu_share(!multi_gpu && !o.no_pool); // before the chunk below sizes the loan
|
||||
bool kvg_started = false; // the elastic K/V took this run's cells
|
||||
double prefill_batched_ms = 0;
|
||||
std::FILE* final_r = o.dump_final_r.empty() ? nullptr : std::fopen(o.dump_final_r.c_str(), "wb");
|
||||
|
||||
Reference in new issue
Block a user