mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #988] [CLOSED] Resident RAM mode with a layer split: only the experts no stage's cache holds (UD-Q4_K_XL on 2x 3090 with 64 GB) #2945
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#2945
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/988
Author: @MirkoMorello
Created: 10/5/2026
Status: ❌ Closed
Base:
main← Head:split-resident📝 Commits (1)
c330f63engine: the resident RAM mode with a layer split - only the experts no stage's cache holds📊 Changes
4 files changed (+86 additions, -14 deletions)
View changed files
📝
docs/MULTI_GPU.md(+30 -0)📝
docs/UNSLOTH_Q4.md(+3 -1)📝
src/program/generate.cpp(+47 -13)📝
tests/core/file_expert_source_test.cpp(+6 -0)📄 Description
What
With a layer split, Strata keeps every expert in RAM - also the ones the cards' caches already hold. For UD-Q4_K_XL that is 72 GiB, so setup asks for ~135 GB of RAM before it offers two GPUs (#498, #737, #806). The alternative,
--mmap-expertswith a split, needs less RAM but leaves every miss to the CPU: the cards have no mapped alias of the file pages.This PR lets the resident RAM mode run with a split, opt-in, with no change to setup or to any default:
--resident-cpu-expertsis accepted with--layer-split(still refused with the helper caches,--expert-cache-remote).pin_cache_complementgets the later stages' cached experts as itsadditional_gpu_pairs(the parameter already existed for a second GPU tier), so the page-locked copy holds only what no card holds.resident_stage_swapscopied an evicted expert back from CUDA0's cache for every layer. With a split, a swap on a later stage's layer would have read the wrong slot. It now takes the cache, device and stream of the stage that owns the layer.--resident-expertsalone with a split still runs as the plain mmap mode (#364, #384); adding--resident-cpu-expertsmakes it explicit. Removing that downgrade, and letting setup offer the split from the RAM this mode needs (experts minus what the caches hold, plus the headroom), are left to you.Measured
2x RTX 3090 (PCIe 4.0 x16, no P2P), Ryzen 9 5900X (AVX2, no AVX-512), 64 GB DDR4 (62.7 GiB usable), Ubuntu 24.04, driver 580, engine built from
6f32ec0for sm_86 in Docker (CUDA 13.0). UD-Q4_K_XL at revision38bb39e, 200K context, fp16 KV, MTP (q2_0 draft),--prefill auto, split auto (K=24; the caches hold 10,013 experts, 29 GiB).Three requests with a ~16.6K-token shared prefix, 768 tokens out each (Python, Italian prose, JSON; temperature 0.7, seed 42), measured from the client over the OpenAI streaming API:
--mmap-experts--mmap-experts --pool-workers 22STRATA_DECODE_TIMING=1: CPU expert jobs per window went from 41-64 ms (mmap) to ~0.02 ms; per window 37-45 ms in all. 2-3% of the routed experts are read over PCIe, about 90% hit the caches.MemAvailablenever went under 11.3 GiB, withSTRATA_RESIDENT_HEADROOM_GIB=2.Tests
file_expert_source_test: PASS, with a new case for the split, where the later stage's experts come in as the additional tier.stratabuilds with-DSTRATA_BUILD_TESTS=ON(sm_86); no new warnings.adaptive swap/refillfailures (a short session, not a soak test).Not done
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.