Merge branch 'f-133-choice' into rel-0.1.33
This commit is contained in:
commit
decfc96c98
12 files changed
+1837
-84
No files matched your search
@@ -272,6 +272,7 @@ struct Options {
|
||||
bool resident_pin = false;
|
||||
uint64_t resident_headroom = 8ull << 30;
|
||||
bool resident_soft = false;
|
||||
bool resident_cpu_explicit = false; ///< #384: --resident-cpu-experts given by itself (not only implied)
|
||||
/// CS-T `--resident-budget-gib N`: the resident mode with a RAM budget - the N GiB of experts the GPU cache does
|
||||
/// not hold that the expert profile ranks hottest are copied into RAM, the rest are read from the files in place
|
||||
/// (the GGUF shards when the pack has no experts.bin). 0 = the whole complement (--resident-experts).
|
||||
@@ -1212,7 +1213,7 @@ int main(int argc, char** argv) {
|
||||
else if (a == "--gpu-stages") o.gpu_stages = true;
|
||||
else if (a == "--mmap-experts") o.mmap_experts = true;
|
||||
else if (a == "--shared-expert-arena") o.shared_expert_arena = next("--shared-expert-arena");
|
||||
else if (a == "--resident-cpu-experts") o.resident_cpu_experts = true;
|
||||
else if (a == "--resident-cpu-experts") o.resident_cpu_experts = o.resident_cpu_explicit = true;
|
||||
else if (a == "--resident-experts") {
|
||||
o.mmap_experts = o.resident_cpu_experts = o.resident_pin = o.resident_soft = true;
|
||||
o.resident_headroom = 4ull << 30;
|
||||
@@ -1320,9 +1321,20 @@ int main(int argc, char** argv) {
|
||||
std::fprintf(stderr, "strata generate: --resident-cpu-experts requires --mmap-experts and a static --expert-profile\n");
|
||||
return 2;
|
||||
}
|
||||
if (o.resident_cpu_experts &&
|
||||
(!o.layer_split.empty() || o.expert_cache_remote[0] > 0 || o.expert_cache_remote[1] > 0 ||
|
||||
o.expert_cache_remote[2] > 0)) {
|
||||
const bool remote_caches = o.expert_cache_remote[0] > 0 || o.expert_cache_remote[1] > 0 ||
|
||||
o.expert_cache_remote[2] > 0;
|
||||
if (o.resident_cpu_experts && !o.layer_split.empty() && !remote_caches && o.resident_soft &&
|
||||
!o.resident_cpu_explicit && o.resident_budget == 0) {
|
||||
// #364 #384: setup's --resident-experts with a layer split (--gpus at start, or a config edited by hand) runs
|
||||
// as the plain mmap mode - the placement those users measured 1.3-1.6x faster than one GPU - instead of
|
||||
// refusing. Exactly --mmap-experts: nothing else reads these flags (the headroom only sizes the copy).
|
||||
std::fprintf(stderr, "strata generate: WARNING: the resident RAM mode (--resident-experts) does not support a "
|
||||
"layer split yet: the experts the GPUs do not hold are read through the OS file cache "
|
||||
"(--mmap-experts), and RAM may fill up during long prompts\n");
|
||||
o.resident_cpu_experts = o.resident_pin = o.resident_soft = false;
|
||||
o.resident_headroom = 8ull << 30;
|
||||
}
|
||||
if (o.resident_cpu_experts && (!o.layer_split.empty() || remote_caches)) {
|
||||
std::fprintf(stderr, "strata generate: --resident-cpu-experts does not support layer splits or remote expert caches\n");
|
||||
return 2;
|
||||
}
|
||||
@@ -2682,9 +2694,11 @@ int main(int argc, char** argv) {
|
||||
const int64_t reserve = ((int64_t) o.vram_reserve_mib + prefill_mib) << 20;
|
||||
const int64_t fit = std::max<int64_t>(((int64_t) free_b - reserve) / (int64_t) strata::kernels::cpu::expert_layout().max_blob, 0);
|
||||
if (o.expert_cache > fit) {
|
||||
std::fprintf(stderr, "strata generate: layer split: --expert-cache %d leaves no room for the prompt path's "
|
||||
"buffers (%lld MiB) on CUDA0: %lld slots\n", o.expert_cache, (long long) prefill_mib,
|
||||
(long long) fit);
|
||||
// a WARNING that names the knob: the user asked for this size, and gets fewer slots
|
||||
std::fprintf(stderr, "strata generate: WARNING: layer split: --expert-cache %d leaves no room for the "
|
||||
"prompt path's buffers (%lld MiB) and the %d MiB reserve on CUDA0: %lld slots instead "
|
||||
"(a smaller --vram-reserve-mib leaves more of them)\n", o.expert_cache,
|
||||
(long long) prefill_mib, o.vram_reserve_mib, (long long) fit);
|
||||
o.expert_cache = (int) fit;
|
||||
}
|
||||
}
|
||||
@@ -3784,6 +3798,12 @@ int main(int argc, char** argv) {
|
||||
std::fprintf(stderr, "strata generate: WARNING: the resident RAM mode does not fit (%s); the experts the "
|
||||
"GPU does not hold are read from the model folder through the OS file cache "
|
||||
"(--mmap-experts), which is slower when the RAM cannot keep them\n", err.c_str());
|
||||
} else if (o.resident_budget > 0) {
|
||||
// #403: a RAM budget that cannot be kept is not a reason to stop - the experts it would have held are
|
||||
// read from the files like the ones outside it (pin_cache_complement leaves nothing half-built)
|
||||
std::fprintf(stderr, "strata generate: WARNING: the RAM budget (--resident-budget-gib) cannot be kept (%s); "
|
||||
"every expert the GPU does not hold is read from the model files through the OS file "
|
||||
"cache (--mmap-experts), which is slower\n", err.c_str());
|
||||
} else {
|
||||
std::fprintf(stderr, "strata generate: CPU expert residency: %s\n", err.c_str());
|
||||
return 1;
|
||||
|
||||
Reference in new issue
Block a user