DeepSeek engine: the copy-all fit check is one tested rule (copy_all_fits) and also needs the Windows commit room (RAM + page file beside its margin), not only the free RAM, so a 64 GB PC with a 12 GB card, or a big-RAM PC with a small page file, never copies the lane in by itself; the auto store says (verbose) when it holds less than the CPU lane

This commit is contained in:
Niko1221 committed 2026-10-25 10:18:53 +01:00
1 parent 6b5d593639
commit 025cf7d954
3 files changed
+29 -1

No files matched your search

+9
View File
@@ -50,6 +50,15 @@ inline int prefill_chunk_default(bool own_default, double gpu_share, bool gguf_c
return file_experts ? big : 2048;
}
// --mmap-experts auto copies all the CPU lane's experts into RAM at load (no demand store) only when they fit: lane_bytes of experts,
// ram_avail the RAM this process can still get (~0: unknown -> no), ram_margin left to the rest, commit_room what Windows still lets it
// commit beside its margin (1e300: no such limit, Linux). All or none: a lane that does not fit both leaves the demand store as it was.
// Measured 1 x R9700 + 251 GB, 2.00 pack: decode +10-25% (the copies sit on huge pages, the store's page-locked arena does not).
inline bool copy_all_fits(double lane_bytes, uint64_t ram_avail, double ram_margin, double commit_room) {
if (!(lane_bytes > 0.0) || ram_avail == ~uint64_t{0}) return false;
return lane_bytes + ram_margin <= (double) ram_avail && lane_bytes <= commit_room;
}
// DS4_TOPK=N (a test, not for users): over the flag and the rule; returns the count to use
inline int experts_test_override(int chosen, int model_k) {
if (const char* v = std::getenv("DS4_TOPK")) {
+1 -1
View File
@@ -4584,7 +4584,7 @@ struct Model::Impl {
const double share = gpu_expert_share(&exp_b, &room, &other_b);
if (exp_b <= 0) return false;
const double lane = exp_b * (1.0 - std::min(1.0, share));
return lane > 0 && lane + (double) kRamMargin <= (double) avail;
return copy_all_fits(lane, avail, (double) kRamMargin, commit_room()); // (Windows: the commit room too, not only the free RAM)
}
mutable bool auto_copy_all = false; // (set by store_gb(): the auto size is the CPU lane's experts copied in, no demand store)
double store_cap_gb() const {