ple: --ple-io ram locks the n-gram table in RAM (no SSD read on the prompt/token path)

This commit is contained in:
dsh authored and Niko1221 committed 2026-09-30 14:01:52 +02:00
1 parent 802c6619df
commit 0d40c17d2f
3 files changed
+29 -3

No files matched your search

+8 -3
View File
@@ -319,7 +319,7 @@ void usage() {
" --tokens-file PATH pretokenized prompt, commas or whitespace (alternative to --tokens)\n"
" --ple-gguf PATH required PLE table (original second GGUF shard)\n"
" --no-ple explicit diagnostic ablation of the PLE layer\n"
" --ple-io direct|mmap n-gram table reads (plan v0.3 P2). direct (default): unbuffered SSD\n"
" --ple-io direct|mmap|ram n-gram table reads (ram = mmap, locked in RAM at start); (plan v0.3 P2). direct (default): unbuffered SSD\n"
" reads, the table never enters RAM or the file cache; mmap: A/B arm\n"
" --ple-row-cache N bounded cache of fetched rows, 90 B each (default 1048576; 0 = off)\n"
" --ple-inflight N outstanding SSD reads (default 64)\n"
@@ -1195,7 +1195,7 @@ int main(int argc, char** argv) {
return 2;
}
if ((o.ple_io != "direct" && o.ple_io != "mmap") || o.ple_row_cache < 0 || o.ple_inflight < 1 ||
if ((o.ple_io != "direct" && o.ple_io != "mmap" && o.ple_io != "ram") || o.ple_row_cache < 0 || o.ple_inflight < 1 ||
o.ple_inflight > 1024 || !(o.ple_delay_us >= 0)) {
std::fprintf(stderr, "strata generate: invalid --ple-io/--ple-row-cache/--ple-inflight/--ple-delay-us\n");
return 2;
@@ -1564,7 +1564,9 @@ int main(int argc, char** argv) {
float* ple_scratch = nullptr;
if (!o.ple_gguf.empty()) {
strata::kernels::PleIoOptions pio;
pio.mode = o.ple_io == "mmap" ? strata::kernels::PleIo::Mmap : strata::kernels::PleIo::Direct;
pio.mode = o.ple_io == "mmap" || o.ple_io == "ram" ? strata::kernels::PleIo::Mmap : strata::kernels::PleIo::Direct;
pio.lock = o.ple_io == "ram"; // dual-3090: the whole table locked in RAM
const auto tpl = Clock::now();
pio.max_inflight = (uint32_t) o.ple_inflight;
pio.cache_rows = (uint64_t) o.ple_row_cache;
pio.io_thread = !o.ple_sync_submit;
@@ -1572,6 +1574,9 @@ int main(int argc, char** argv) {
std::fprintf(stderr, "strata generate: %s\n", err.c_str());
return 1;
}
if (pio.lock)
std::fprintf(stderr, "strata generate: PLE table locked in RAM (--ple-io ram) in %.1f s\n",
std::chrono::duration<double>(Clock::now() - tpl).count());
const strata::core::WeightRef* wk = wt.find("blk.1.ple_key.weight");
const strata::core::WeightRef* wv = wt.find("blk.1.ple_value.weight");
const strata::core::WeightRef* wnk = wt.find("blk.1.ple_norm_key.weight");