Linux: io prefetch + decode gate by default for experts.bin packs when the page cache has room for 55% of the experts
Zero-copy does not apply to experts.bin (one contiguous blob the kernels already read from the mapping), but the io_fill_ prefetch path does. RTX 3060, IQ3_XXS 43 GB pack, 32 GB cgroup: decode 1.38/1.21/1.33x (5/5 pairs), prompts 1.04/1.06x. At 16 GB the cold 4K prompt was 4-6% slower, so it stays off below the room test and the log says how to force it. Identity gates 10/10, exact_pp 4K/20K identical.
This commit is contained in:
1 parent
74e25e165b
commit
ecf2bdcb7f
4 files changed
+37
-6
No files matched your search
@@ -5515,18 +5515,26 @@ int main(int argc, char** argv) {
|
||||
// ahead on I/O threads while the current layer computes (see FileExpertSource::set_io_prefetch). 0.2.0: on by
|
||||
// default on Linux, with the decode gate (STRATA_IO_PF_GATE) and zero-copy page-cached experts
|
||||
// (STRATA_COLD_OVERLAP=4); STRATA_IO_PREFETCH=0 / STRATA_IO_PF_GATE=0 / STRATA_COLD_OVERLAP=0 turn them off.
|
||||
// the defaults are for the GGUF read in place (what was measured); an experts.bin pack keeps them off unless set
|
||||
// io prefetch + the gate: the GGUF read in place and (0.2.1) an experts.bin pack; zero-copy only for the GGUF in place
|
||||
const char* io_pf_env = std::getenv("STRATA_IO_PREFETCH");
|
||||
const bool io_pf_default = (io_pf_env == nullptr || io_pf_env[0] == '\0') && src.linux_file_defaults();
|
||||
const bool io_pf_default = (io_pf_env == nullptr || io_pf_env[0] == '\0') && src.linux_io_defaults();
|
||||
#if defined(__linux__)
|
||||
if ((io_pf_env == nullptr || io_pf_env[0] == '\0') && !io_pf_default && !src.linux_file_defaults() && !src.unbuffered())
|
||||
std::fprintf(stderr, "strata generate: file tier (experts.bin): io prefetch stays off by default here: the page cache has room "
|
||||
"for %.0f%% of the experts (it helps from 55%%: 32 GB-class RAM, decode +20..34%% measured); "
|
||||
"STRATA_IO_PREFETCH=1 turns it on anyway\n", src.cache_room_ratio() * 100.0);
|
||||
#endif
|
||||
if (io_pf_default || (io_pf_env != nullptr && std::atoi(io_pf_env) != 0)) {
|
||||
const char* th = std::getenv("STRATA_IO_PF_THREADS");
|
||||
src.set_io_prefetch(true, th != nullptr ? std::atoi(th) : 0);
|
||||
if (src.io_prefetch() && io_pf_default) {
|
||||
const char* cv = std::getenv("STRATA_COLD_OVERLAP");
|
||||
std::fprintf(stderr, "strata generate: file tier (Linux defaults, the GGUF read in place): page-cached experts "
|
||||
std::fprintf(stderr, "strata generate: file tier (Linux defaults, %s): page-cached experts "
|
||||
"computed from the mapping (STRATA_COLD_OVERLAP=%s), io prefetch with whole-blob preads on %s I/O threads, "
|
||||
"the decode's read-ahead %s; off: STRATA_COLD_OVERLAP=0, STRATA_IO_PREFETCH=0, "
|
||||
"STRATA_IO_PF_GATE=0\n", cv != nullptr && cv[0] != '\0' ? cv : "4", th != nullptr ? th : "8",
|
||||
"STRATA_IO_PF_GATE=0\n",
|
||||
src.linux_file_defaults() ? "the GGUF read in place" : "experts.bin: its pages are read from the mapping as they are",
|
||||
cv != nullptr && cv[0] != '\0' ? cv : (src.linux_file_defaults() ? "4" : "0"), th != nullptr ? th : "8",
|
||||
src.gate_on() ? "only while the page cache has room for it and it pays (STRATA_IO_PF_GATE=1)"
|
||||
: "always (STRATA_IO_PF_GATE=0)");
|
||||
} else if (src.io_prefetch())
|
||||
|
||||
Reference in new issue
Block a user