From 0cf3d51030e3c80f51a1224692b0a3f2dd33fcd3 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Mon, 12 Oct 2026 09:44:07 +0200 Subject: [PATCH] ple: the slow-direct probe only warns on every platform (#2040: a SATA SSD tops out under the NVMe-calibrated 15K rows/s bar and mmap was 7x slower there); STRATA_PLE_AUTO_MMAP=1 keeps the 0.1.42 switch --- docs/DETAILS.md | 2 +- src/program/generate.cpp | 9 ++++----- sycl/src/program/generate.cpp | 9 ++++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/DETAILS.md b/docs/DETAILS.md index 7b8bc701..2b55a404 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -1844,7 +1844,7 @@ the document, +0.4% on the chat. Details: `bench/results/2026-09-27-esp/`. - **RAM:** all 24,576 experts, pinned. The CPU computes the experts that are not on the GPU **in place**, at the same time as the GPU works on the cached ones (AVX-512 / AVX2 kernels, ggml's for the i-quants). - **SSD:** the 28.8 GB n-gram table, a few rows per token, read unbuffered past the OS cache (`--ple-io direct`, the - default, made for SSDs; on a rotational disk `--ple-io ram` keeps the table in RAM, #605). The engine reads the table + default, made for SSDs; on a rotational disk `--ple-io ram` keeps the table in RAM, #605). A start-up probe warns when direct reads measure slow (under 15K rows/s) but never switches by itself (since 0.1.43.1; `STRATA_PLE_AUTO_MMAP=1` brings back the 0.1.42 switch to `--ple-io mmap`): the bar is calibrated for NVMe, a SATA SSD tops out at 10-14K rows/s with direct's 16 reads in flight, and on one (Linux, 77.8K-token prompt) mmap read 2.1K rows/s against direct's 14.4K (#2040), while on a Windows box with a slow mapped file mmap stalled prompts (#1984). The engine reads the table in the format the GGUF has it: IQ4_NL (the default table), Q4_0, Q5_0, Q5_1, Q8_0, FP8 (E4M3 with a scale) or BF16. Measured on 4,000 random rows against the checkpoint's own BF16 table, the mean per-row error is Q8_0 0.53%, FP8 2.64%, Q5_1 3.78%, Q5_0 4.25%, IQ4_NL 7.60%, Q4_1 7.80%, Q4_0 8.55% (a Q8_0 table is 54 GB, an IQ4_NL one 28.8 GB). On the Q2_0 model, 700 teacher-forced tokens, the mean KL against the BF16 table is 0.0117 (Q5_0), 0.0121 (Q5_1), 0.0125 diff --git a/src/program/generate.cpp b/src/program/generate.cpp index 339128cc..1b330b6e 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -3186,13 +3186,12 @@ int main(int argc, char** argv) { if (rps >= kSlowRowsPerS) std::fprintf(stderr, "strata generate: PLE direct read probe: %.0f rows/s (fine)\n", rps); if (rps > 0 && rps < kSlowRowsPerS) { - // #1984 #1971: on Windows the mapped reads stalled prompts (the first chunk waits for 16 serial page faults - // a token from a cold table with no progress mark), so there the switch is only made when asked for + // #1984 #1971 #2040: on no platform is the switch made on its own. Windows: the mapped reads stalled prompts (the first chunk waits for 16 serial page faults + // a token from a cold table with no progress mark). Linux SATA SSD: the 15K rows/s bar is NVMe-calibrated, a SATA SSD + // tops out at 10-14K with direct's 16 reads in flight and mapped reads were 7x slower. The switch is only made when asked for // (STRATA_PLE_AUTO_MMAP=1, the 0.1.42 behaviour); otherwise the slow probe warns and direct is kept. bool auto_mmap = !o.ple_io_explicit; -#if defined(_WIN32) if (const char* am = std::getenv("STRATA_PLE_AUTO_MMAP"); am == nullptr || std::atoi(am) == 0) auto_mmap = false; -#endif if (auto_mmap) { std::fprintf(stderr, "strata generate: --ple-io direct measures slow here (%.0f rows/s, about %.0f MB/s of " "random 4 KiB reads): using --ple-io mmap instead (the OS file cache holds the pages; " @@ -3208,7 +3207,7 @@ int main(int argc, char** argv) { } else { std::fprintf(stderr, "strata generate: WARNING: --ple-io direct measures slow here (%.0f rows/s, about %.0f " "MB/s of random 4 KiB reads): a prompt can spend minutes reading layer 1 and trip the " - "stall watchdog (#1425, #1629). --ple-io mmap was 40-100x faster on such drives; " + "stall watchdog (#1425, #1629). --ple-io mmap was 40-100x faster on some DRAM-less NVMe drives but 7x slower on a SATA SSD (#2040), so it is not chosen for you; " "--ple-io ram needs the RAM for the table%s\n", rps, rps * 4096.0 / 1e6, o.ple_io_explicit ? "" : " (kept direct: pass --ple-io mmap or --ple-io ram to change it)"); } diff --git a/sycl/src/program/generate.cpp b/sycl/src/program/generate.cpp index 32488963..b1a77d5b 100644 --- a/sycl/src/program/generate.cpp +++ b/sycl/src/program/generate.cpp @@ -3003,13 +3003,12 @@ int main(int argc, char **argv) try { if (rps >= kSlowRowsPerS) std::fprintf(stderr, "strata generate: PLE direct read probe: %.0f rows/s (fine)\n", rps); if (rps > 0 && rps < kSlowRowsPerS) { - // #1984 #1971: on Windows the mapped reads stalled prompts (the first chunk waits for 16 serial page faults - // a token from a cold table with no progress mark), so there the switch is only made when asked for + // #1984 #1971 #2040: on no platform is the switch made on its own. Windows: the mapped reads stalled prompts (the first chunk waits for 16 serial page faults + // a token from a cold table with no progress mark). Linux SATA SSD: the 15K rows/s bar is NVMe-calibrated, a SATA SSD + // tops out at 10-14K with direct's 16 reads in flight and mapped reads were 7x slower. The switch is only made when asked for // (STRATA_PLE_AUTO_MMAP=1, the 0.1.42 behaviour); otherwise the slow probe warns and direct is kept. bool auto_mmap = !o.ple_io_explicit; -#if defined(_WIN32) if (const char* am = std::getenv("STRATA_PLE_AUTO_MMAP"); am == nullptr || std::atoi(am) == 0) auto_mmap = false; -#endif if (auto_mmap) { std::fprintf(stderr, "strata generate: --ple-io direct measures slow here (%.0f rows/s, about %.0f MB/s of " "random 4 KiB reads): using --ple-io mmap instead (the OS file cache holds the pages; " @@ -3025,7 +3024,7 @@ int main(int argc, char **argv) try { } else { std::fprintf(stderr, "strata generate: WARNING: --ple-io direct measures slow here (%.0f rows/s, about %.0f " "MB/s of random 4 KiB reads): a prompt can spend minutes reading layer 1 and trip the " - "stall watchdog (#1425, #1629). --ple-io mmap was 40-100x faster on such drives; " + "stall watchdog (#1425, #1629). --ple-io mmap was 40-100x faster on some DRAM-less NVMe drives but 7x slower on a SATA SSD (#2040), so it is not chosen for you; " "--ple-io ram needs the RAM for the table%s\n", rps, rps * 4096.0 / 1e6, o.ple_io_explicit ? "" : " (kept direct: pass --ple-io mmap or --ple-io ram to change it)"); }