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:
1 parent
2de94bca5e
commit
cb33c0bac5
10 files changed
+137
-10
No files matched your search
@@ -2,6 +2,7 @@
|
||||
#include "strata/core/weights.hpp"
|
||||
|
||||
#include "strata/kernels/f16_bits.hpp"
|
||||
#include "strata/platform/memory.hpp"
|
||||
|
||||
#include <cuda_runtime.h>
|
||||
|
||||
@@ -279,6 +280,12 @@ bool WeightTable::load(const std::string& pack_dir, void* arena_base, uint64_t a
|
||||
cur = std::fopen(p.c_str(), "rb");
|
||||
if (!cur) { err = "cannot open " + p; cudaFreeHost(stage_in); cudaFreeHost(stage_out); return false; }
|
||||
cur_file = r.file;
|
||||
#if !defined(_WIN32)
|
||||
// ask for this file's remaining rows up front so their reads overlap
|
||||
for (size_t j = row_i; j < rows.size(); ++j)
|
||||
if (rows[j].file == r.file && !skipped[j])
|
||||
strata::platform::advise_willneed(fileno(cur), rows[j].src_off, rows[j].src_bytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ---- the segment list: what this tensor's bytes are, plane by plane, in both forms
|
||||
|
||||
Reference in new issue
Block a user