mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #202] [CLOSED] ple: --ple-io ram locks the n-gram table in RAM (no SSD read on the prompt/token path) #2508
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2508
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/202
Author: @q8atnight
Created: 9/30/2026
Status: ❌ Closed
Base:
main← Head:pr/ple-io-ram📝 Commits (2)
7f78060ple: --ple-io ram locks the n-gram table in RAM (no SSD read on the prompt/token path)6499768ple: --ple-io ram: refused on Windows (no mlock), 'locked' only when mlock succeeded else 'loaded (not locked)', neutral comments + --help (review)📊 Changes
3 files changed (+46 additions, -4 deletions)
View changed files
📝
include/strata/kernels/ngram.hpp(+5 -0)📝
src/kernels/ngram.cpp(+24 -0)📝
src/program/generate.cpp(+17 -4)📄 Description
Summary
A third
--ple-iomode:ram= themmapmapping with the whole tablemlocked at open, so no SSD read eversits on the prompt or token path.
madvise(MADV_WILLNEED)first, thenmlock; a start log line reports the timeit took. One commit on top of 0.1.27 (
a790805).directstays the default andmmapis unchanged; the ngramfiles are untouched upstream, so the change is the
PleIoOptions::lockflag, itsopen()handling, and theoption plumbing.
Measured
On 2x RTX 3090, IQ3_S, 121 GB RAM: stock
--ple-io directreads the 28.8 GB table with O_DIRECT, and a cold 32Kprompt waited ~3 s on those reads. With
ramthe table is mapped and locked once at start, and no table readtouches the SSD again. In use on our box since 2026-09-28 with no issue.
Cost and failure mode
ramcosts host RAM = the table size (28.8 GB here; our IQ3_S dual setup uses ~82 of 121 GB). Ifmlockisrefused —
ulimit -ltoo low, Docker's default memlock is 64 KB — the engine does NOT fail: it printsstrata: PLE table mlock failed (...): touching its pages insteadand touches every page, so the table stillenters the page cache but the kernel may evict it under memory pressure. For the lock itself to hold, start with
ulimit -l unlimited(Docker:--ulimit memlock=-1). The log linestrata generate: PLE table locked in RAM (--ple-io ram) in X sdistinguishes the two outcomes.Switch
--ple-io ramis opt-in;direct(andmmap) behave exactly as before.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.