engine: a RAM budget clamped to the free RAM no longer fails its own safety check (#403)
FileExpertSource::pin_cache_complement read the available RAM twice: the budget was clamped to the first reading (less the 4 GiB headroom) and the resident-memory check then failed it on a second reading a few MB lower, so a 64 GB PC with setup's --resident-budget-gib 40 could exit at start. With a budget, the check now reuses the reading the budget was sized from, and a clamped budget stops 256 MiB under the room. An unclamped budget holds the same experts as before (the lend region is off with a budget, so `budget` there is unused). If the budget still cannot be kept (no RAM reading, an allocation that fails), generate.cpp warns and serves every expert the GPU does not hold from the files through the OS file cache (--mmap-experts) instead of exiting; the complement is left unbuilt on every failure path.
This commit is contained in:
1 parent
18a0ec2d47
commit
152f7198b9
2 files changed
+20
-5
No files matched your search
@@ -3775,6 +3775,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