mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4020] [Engine] generate: allow the elastic K/V with --peer-device #4880
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#4880
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/4020
Author: @chimpera
Created: 10/24/2026
Status: 🔄 Open
Base:
main← Head:vmm-peer-series📝 Commits (4)
bb22771vmm: create each range's chunks on the device that is current at reserve(), not the one captured by the once-only api() init3230e5cexpert cache: only the primary cache maps its arena through VMM; a peer tier's is one cudaMalloc againe0b9230peer: create the peer device's context before the arena's whole-range pinfa20b7egenerate: allow the elastic K/V with --peer-device📊 Changes
5 files changed (+56 additions, -23 deletions)
View changed files
📝
include/strata/core/expert_cache.hpp(+4 -2)📝
include/strata/core/vmm.hpp(+3 -2)📝
src/core/expert_cache.cpp(+1 -7)📝
src/core/vmm.cpp(+33 -8)📝
src/program/generate.cpp(+15 -4)📄 Description
Problem and result
--kv-growturns itself off whenever a second GPU is present — the gate readso.peer_device < 0— so adding a peer tier costs the primary its elastic K/V. Nothing in the machinery requires the exclusion; what it protected against is fixed here directly, and the two now run together.Why the gate was there.
set_vmmwas static: enabling it mapped every expert cache's arena through avmm.cpprange — including the peer tier's. And a range's physical chunks were created with the device id captured at the once-onlyapi()init (the primary's device), not the device that owns the range, so a second card's mapping failed while that card sat nearly empty. Reproduced on this PR's v0.1.45 base with only the gate line removed: with--kv-grow --peer-device 1, startup ended inon a card with ~20 GiB free — the peer's chunks were being allocated on the primary. (First seen on the strata-nvfp4 fork's 2× RTX 3090 pair; the same
vmm.cppships here with the elastic K/V.)Related discussion
Repost of #1223, closed in the 0.2.0-beta tracker reset of 2026-10-19 rather than declined ("a fix of a restriction, not a speed change, so it is outside this round"). Rebased onto current main (0.2.4.2); the restriction the series removes is still there (
generate.cpp's elastic gate still readso.peer_device < 0), the four commits apply clean, and everything below was re-measured on the submitted revision.Approach
vmm_chunk_newtakes the device; a range creates its chunks on the device current atreserve(), not the one captured at init. Device 0 is granted access to a peer range only whencudaDeviceCanAccessPeersays a path exists, with an owner-only fallback (cuMemSetAccessrejects an unreachable remote location outright, failing the whole map).set_vmmis per-instance: only the cache the K/V borrows from maps through VMM; a peer tier's cache is one plaincudaMalloc. This is what makes the gate unnecessary.cuMemMap/cuMemSetAccesson a peer range need it to already exist).o.peer_device < 0clause. Layer splits,--batchand--vram-elasticstill turn the elastic K/V off, as before.Single-GPU behavior is unchanged: a range on the current device creates its chunks exactly as before, and the single-card outputs below are identical between main and this branch.
Validation
Environment: 2× RTX 3090 (a PHB pair, no NVLink), ThreadRipper Pro 5965WX, Qwen3.8-Flash-Next 125B IQ3_S, CUDA 13.4 (archs 86;120). Revision: this branch's four commits on 0.2.4.2 (
7dd5cf18);mainside =7dd5cf18. The same physical rig the original PR was measured on, with the same deck — re-run today on the submitted code.Passed:
cmake -DCMAKE_BUILD_TYPE=Release -DSTRATA_ENABLE_CUDA=ON— the engine builds clean on bare7dd5cf18+ the four commits.strata generate: --kv-grow is off (one GPU, a profile, the whole K/V in VRAM, every expert in RAM, no --batch, --vram-elastic or --peer-device)— with the peer tier otherwise healthy (peer GPU 1: 11789 experts, 22.50 GiB).--kv-grow --peer-device 1): no refusal line; peer attaches (11776 experts, 22.50 GiB); the elastic K/V grows under load —strata: K/V grown to 65536 cells (0.86 GiB); the expert cache gave 318 slots for it, 94 hotter experts moved to colder ones' slots— with a 45K-token prompt through it.Failed:
atarsvsatarts, reversing "strata"). The single-GPU path is identical, and the flip tracks expert residency, which this branch changes on the primary (8737 vs 7105 resident — the peer/VMM changes free VRAM the primary cache takes): which experts are resident is documented to be able to move a reply (the 2026-09-27 cache-parity result, quoted at boot). Stated as observed; not investigated further here.Not run:
vmm.cppis CUDA virtual memory).cudaDeviceCanAccessPeerwas true over the root complex).Limits
--batchand--vram-elastic, as before.cudaMalloc(not VMM): its size is whatever--peer-reserve-mib/--peer-slotsleave, as before.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.