Linux: read ahead of the mapped loads at start

On Linux every load phase read its files one page fault (one 128 KB readahead)
at a time, so a cold start spent most of its time waiting on the drive at
queue depth ~2. A new platform::advise_willneed asks the kernel for a range in
128 KiB steps (WILLNEED reads at most one readahead window per call), and is
called before the weight load, the native dense upload, the profile fill (256
pairs ahead, STRATA_FILL_AHEAD), the peer tier's fill (--peer-device), the
resident RAM copy and the MTP draft files. STRATA_READ_AHEAD=0 turns it off.
Each phase logs its time.

Gen3 NVMe, RTX 5090, 32 GB, Q2_0 resident at 262K: ready in 70 s, was ~920 s.
This commit is contained in:
Jesus Gulfo authored and Niko1221 committed 2026-10-05 15:58:38 +02:00
1 parent 2de94bca5e
commit cb33c0bac5
10 files changed
+137 -10

No files matched your search

+5
View File
@@ -3,6 +3,7 @@
#include "strata/core/weights.hpp"
#include "strata/artifact/gguf_reader.hpp"
#include "strata/kernels/native_mmvq.hpp"
#include "strata/platform/memory.hpp"
#include <cuda_runtime.h>
#include <algorithm>
@@ -150,6 +151,10 @@ bool NativeDense::load(const std::vector<std::string>& shards, WeightTable& tabl
if (next != offsets.end() && bytes > *next - tensor.offset) {
err = "native dense: overlapping payload " + tensor.name; return false;
}
// the uploads below read these: ask for them now so the reads overlap
if (eligible(tensor, include_ple_key) && !outside(tensor.name) &&
strata::kernels::native_mmvq_supported(tensor.type))
strata::platform::advise_willneed(gguf.tensor_data(tensor), bytes);
}
for (const auto& tensor : gguf.tensors()) {
if (!eligible(tensor, include_ple_key) || outside(tensor.name)) continue;