Repository navigation
feat(rdna2): opt-in routed-expert DRAM residency cache - #37
Draft
BlivionIaG wants to merge 2 commits into
Draft
BlivionIaG wants to merge 2 commits into
BlivionIaG wants to merge 2 commits into
Conversation
Hot routed experts stay in VRAM and a miss is copied from a pinned host buffer on a side stream. The cache is default-off, serve-side, and stays dead when the routed experts already fit. Shared experts, dense leftovers, and PLE / n-gram tables are not expert pages. The existing fdot2 / sdot4 path is unchanged. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Prefetch the next routed MoE layer's local misses with an async copy of pinned host pages on a side stream, into a staging bank the in-flight GEMM is not reading. The resident GEMM does not wait. The next MoE GEMM waits on the copy event before it uses that slot. Dense, GDN, KDA, and QSA-only blocks are not the next miss set. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This was referenced Oct 6, 2026
cursor Bot
pushed a commit
that referenced
this pull request
Oct 11, 2026
Keep hot routed experts and primary KV on the fast tier, send only cold pairs to the gfx1030 pool, and add an LRU KV block tier that copies blocks back before attention. With VLLM_HETERO_MOE unset the MoE forward is unchanged. Replayed onto rdna_extras after the v0.31 port. Engine startup still publishes hetero env only when a knob is set, and keeps the v0.31 logging setup. Cold W4A16 stays on moe_gptq_gemm_rdna2 (fdot2). RDNA3 WMMA objects are refused on gfx1030. A non-tensor quant_method.apply result is refused. The PR #37 residency bridge still fails closed. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Opt-in VRAM residency cache for routed MoE experts, in the spirit of Strata's expert cache. A hot subset stays resident; a miss is copied from a pinned host buffer. An optional popularity profile chooses which experts start hot.
This is a vLLM path, not a Strata port.
Taken from Strata: the residency idea (hot experts in VRAM, miss filled from host RAM) and an optional hottest-first popularity ranking.
Left behind: Strata's runtime, GGUF packs, CPU expert kernels, the
STRPprofile container, and any tok/s numbers. The profile here is JSON{"ranked": [[layer, expert], ...]}or text lineslayer expert, hottest first.VLLM_RDNA_MOE_RESIDENT/VLLM_RDNA_MOE_RESIDENT_SKINNYwere investigated and not reused. Those flags keep the full W4A16 set in the native device layout and dispatch the resident kernel. They are not a hot-expert DRAM cache. If either flag is on, this cache stays off so the two policies do not overlap.Integration point:
RoutedExperts.create_weightsplaces new routed-expert parameters on CPU so the full set is not committed to VRAM first. Meta init, an already-CPU default device, monolithic kernels, and EPLB are not redirected.finalize_routed_expert_residencyruns at the end ofprocess_weights_after_loading, after the existing quant packing (fdot2 / sdot4).RoutedExperts.forward_modularcallscache.prepare, which fetches misses and remaps local ids onto slot indices. The existingquant_method.applypath is unchanged. After that GEMM is launched,after_resident_gemmprefetches the next MoE layer.Prefetch overlap
The old copier called
current.wait_stream(copy_stream)before returning, so every fetch stalled the compute stream before the GEMM.Now:
next_moe_index, so dense, linear, GDN, KDA, and QSA-only blocks are skipped. It is notlayer_index + 1.mova/v_expert/shared_expert) is what keeps them out.copy_(non_blocking=True)there, the torch equivalent of hipMemcpyAsync). An event is recorded after the copy. The copier does notwait_streamin either direction.expert_map/ local range). Another rank's experts are not pulled.No speedup is claimed. CPU tests check the wait and destination rules, not overlap timing.
Board constraints verified against the tree
RoutedExpertsparameters whose leading dim is the local expert count. Families without a shared expert (MiMo, Naive) are the same bind minus that tensor.prepareand prefetch refuse while a HIP/CUDA graph is capturing. Serve this offload eagerly.hc_combine(only"weights"and"kv_cache"). Those four stay separate because this path never allocates into those modules.VLLM_RDNA_MOE_EXPERT_OFFLOADdefaults to0. OptionalVLLM_RDNA_MOE_EXPERT_PROFILE. Clients, gateways, and thetools/rdna2/serve_*.shscripts do not export it. It engages only when routed-expert bytes exceed the physical VRAM budget. If they fit, no host pages or cache are kept.-cb 3inst/ fdot2), W4A8 sdot4 knobs, fatbins.rdna_extrasis not pushed. Draft only. Do not merge.Duplicate check
No other open PR on
opengfx1030/vllm-rdnacovers expert DRAM offload or this residency cache. This follow-up stays on draft #37.AI assistance was used (Cursor cloud agent). A human submitter must review every changed line before this leaves draft.
Test Plan
CPU policy and cache tests (no gfx1030 in this environment):
--noconftestavoids the repo roottests/conftest.pyimport (tblib), which this unit file does not need.Covered: default off; resident flags block a second path; engage only when enabled and over budget; slot assignment; profile parse; routed-parameter filter (shared / n-gram / MoVA / router skipped); per-rank local ids; alias rebind; disabled install and fitting budget stay dead; profile seed, hit, and host miss; colder eviction; capture refuses the fetch; next MoE index skips dense / GDN / KDA / QSA / MoVA; a hot hit records no compute wait and the prefetch H2D targets the next MoE layer's staging bank; the consumer waits before bind; a live GEMM slot is not the copy destination; prefetch ids stay inside this rank's local range; meta init is not redirected to CPU.
Test Result
Warnings: missing
vllm._versioncommit hash, and arequires_gradscalar conversion on the excluded n-gram tensor. Neither is a failure.No model evaluation was run. This VM has no gfx1030. Produce quant, dest tip, and the on-device fdot2 / sdot4 kernels are unchanged. No tok/s number is claimed.