feat: add tiered CUDA acceleration for routed experts - #16
Merged
Merged
Conversation
ZacharyZcR
marked this pull request as ready for review
July 10, 2026 04:33
This was referenced Jul 10, 2026
Merged
Closed
Contributor
|
I haven't been wowed in a while. |
This was referenced Jul 11, 2026
Closed
ErikTromp
pushed a commit
to SensAI-PT/aviary
that referenced
this pull request
Aug 9, 2026
…uched) + REPLAY fixture harness (JustVugg#16) * feat: add experimental CUDA backend for resident tensors * feat: promote pinned experts to a bounded VRAM tier * feat: preload the GPU expert tier at startup * fix: harden CUDA backend failure handling * feat: add deterministic multi-GPU tensor placement * test: add deterministic CUDA benchmark fixture * perf: make routed experts the default CUDA path
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.
Summary
CUDA_DENSE=1for controlled experimentsCOLI_GPU=0and deterministic multi-device ownership withCOLI_GPUS=0,1,...PINprofile into a bounded VRAM tier withCUDA_EXPERT_GBCUDA_EXPERT_GBas a total multi-device budget and place each whole expert on the least-loaded device that can hold itREPINreuses a pinned slotReproducible fixture benchmark
The PR includes a deterministic 313M-parameter
glm_moe_dsafixture generator and a fixed-tokenREPLAY=1harness. Random weights are used only to preserve the real MLA/MoE/streaming code paths; this is not a language model.Single RTX 5090, 48 CPU threads, int4, fixed replay tokens, 5-run median decode:
The result drives the default: removing expert I/O is the dominant win, and routed-expert CUDA adds about 19% beyond RAM pinning. Dense CUDA adds only about 4% after experts are hot and does nothing meaningful while streaming, so it remains opt-in. The full 744B model has much larger expert matrices and still requires a separate benchmark.
Validation
makeandmake portableCurrent scope
This PR implements a complete three-tier path: selected hot experts stay in VRAM, other pinned experts stay in RAM, and uncached experts retain the original NVMe streaming fallback. Experts are balanced by placed bytes under live per-device capacity limits. Each GPU-resident expert has one explicit owner.
Multi-device execution currently uses synchronous host-staged activation copies. It does not require or assume P2P/NCCL, matching the tested six-card RTX 5090 host where GPU P2P is unavailable. The kernels remain correctness-first custom kernels.
Next steps