mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #699] [CLOSED] Linux: read ahead at startup (cold start ~920 s → 70 s) #2772
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#2772
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/699
Author: @jesdga95
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:linux-load-read-ahead📝 Commits (2)
0173fc4Linux: read ahead of the mapped loads at start5949e9dLinux: read ahead of the head, embedding and vision encoder loads; time them📊 Changes
12 files changed (+174 additions, -16 deletions)
View changed files
📝
docs/DETAILS.md(+6 -0)📝
include/strata/core/expert_source.hpp(+7 -0)📝
include/strata/platform/memory.hpp(+8 -0)📝
src/core/expert_source.cpp(+31 -3)📝
src/core/mtp.cpp(+7 -0)📝
src/core/native_dense.cpp(+5 -0)📝
src/core/native_head.cpp(+3 -0)📝
src/core/peer_experts.cpp(+6 -1)📝
src/core/weights.cpp(+7 -0)📝
src/platform/memory.cpp(+33 -0)📝
src/program/generate.cpp(+38 -11)📝
tools/vision/strata_vision.cpp(+23 -1)📄 Description
On Linux every startup read went to the drive one ~128 KB request at a time (page faults through the mmap, or plain freads with the default readahead), so a cold start sat at queue depth ~2 for about fifteen minutes. Most of it was "filling the GPU's expert cache" at 30-39 MB/s from an NVMe that does ~3 GB/s with a deep queue. Windows already has an unbuffered, overlapped read path for this (
set_unbuffered/read_direct); on Linuxset_unbufferedreturns false, so these reads went through the page cache one fault at a time.This asks the kernel for the pages ahead of each read (madvise / posix_fadvise WILLNEED, in 128 KiB steps because WILLNEED only reads one readahead window per call) for the weights, the native dense matrices, the profile fill (256 pairs ahead), the peer tier's fill (
--peer-device), the resident RAM copy, the MTP draft files, the native output head and token embedding, and strata-vision's projector.STRATA_READ_AHEAD=0turns it all off, and each phase now logs how long it took.Ryzen 9 9950X, RTX 5090, 32 GB DDR5, Gen3 NVMe, Ubuntu (kernel 7.0), v0.1.38, cold page cache:
Only tested on Linux with CUDA. On Windows the new helper is a no-op (the unbuffered path covers it), and I haven't compiled it on Windows or HIP. With a layer split, the first card's fill gets the read-ahead (q8atnight measured it below); the other cards' fills don't yet.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.