mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #80] [CLOSED] Add --tiered-experts: run with less RAM than the experts need (32 GB works) #2442
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#2442
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/80
Author: @andrewcoul
Created: 9/28/2026
Status: ❌ Closed
Base:
main← Head:tiered-experts-32gb📝 Commits (1)
e6486e8Add --tiered-experts: run with less RAM than the experts need📊 Changes
7 files changed (+655 additions, -17 deletions)
View changed files
📝
CMakeLists.txt(+1 -1)📝
include/strata/core/expert_source.hpp(+84 -0)📝
src/core/expert_cache.cpp(+41 -3)📝
src/core/expert_source.cpp(+1 -1)➕
src/core/tiered_source.cpp(+467 -0)📝
src/prefill/prefill.cpp(+20 -7)📝
src/program/generate.cpp(+41 -5)📄 Description
Why
The docs say 32 GB of RAM is not enough: the arena keeps all 24,576 experts pinned in RAM. But once the profile has filled the VRAM cache, those experts' RAM copies are never read again (the cache does not evict, prefill skips resident experts, verify windows compute them from VRAM). On a 16 GB card that is ~5-7k experts, and the coldest ones in the profile are rarely routed at all.
--tiered-expertsuses that. After the cache fill, every expert is sorted into a tier:--host-budget-gib(auto =MemAvailableminus--host-reserve-gib, default 8). The driver refusescudaHostRegisteron file-backed pages ("operation not supported"), so each run is remapped to anonymous memory in place (MAP_FIXED, same addresses, soblob_offsetis unchanged), filled withpread, then registered.experts.binand page in from the SSD. A routed cold expert is prefetched (MADV_WILLNEED) from helper threads so the CPU pool does not stall on it.Results (one machine)
Ryzen 7 7800X3D, RTX 4080 SUPER 16 GB, 32 GB RAM, NVMe (~6.5 GB/s), Linux, ISTA-DASLab GSQ-RCO IQ3_XXS. Engine args: the usual ones plus
--tiered-experts --host-reserve-gib 14 --vram-reserve-mib 1500 --adapt-every 0 --spec-min-p 0.7.Other changes
ExpertCache::fill_slot/fill_slot_blocking: a blob that straddles the end of a registered run makescudaMemcpyAsyncfail with "invalid argument"; falls back to a locked pinned bounce buffer. Serve-mode adaptive swaps now go throughfill_slot.ExpertSource::dma_capable()replaces thedevice_alias(layer, 0)probe when deciding whether misses can be read over PCIe (with tiers, expert 0 of a layer may not be pinned).experts.binfrom shard 1 on first use of the tiered source.streams_from_ssd()): ring 16 -> 48, up to 8 threads (STRATA_STAGER_THREADS), and unpinned experts are read withO_DIRECTpread.TieredExpertSourcecompiles to a stub andopen()reports "not available".Defaults are unchanged without
--tiered-experts.Testing and limits
main(engine 0.1.20,c1e9033). It also builds on its own, without #79 (my numbers include #79).dma_capable()refactor and afill_slotfallback that only triggers oncudaErrorInvalidValue); Windows (stub only, not compiled there); the parity tests (-DSTRATA_BUILD_TESTS=ONdoes not configure onmain:tests/and severalbench/microsources are missing).Questions
--adapt-every 0was clearly better in tiered mode in my A/B runs (34 -> 44 and 44 -> 49 tok/s), since each swap refills VRAM slots from cold experts. Should tiered mode turn it off by default?setup.pystill refuses below 44 GB. I did not touch it; happy to add a tiered path (RAM check plus the flags in the generated config) if you want this in the installer.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.