Repository navigation
Commit d7a2081
Fix native peer-access OOM without reducing cache capacity (#286)
* Fix native cache peer access and retry allocation OOM
Cache planning can consume nearly all free GPU memory before post-allocation
cuMemSetAccess calls create driver access state. The loader also repeats static
grants and uses every signed reader declaration, including ranks that never
import the allocation. This can turn an otherwise valid automatic KV capacity
into an allocation OOM and force an unnecessary manual reserve. Use validated
imports as the access authority and make single-host cache allocation
transactional so a failed attempt can be reduced safely.
Replace the two all-descriptor grant passes with one owner-plus-actual-importer
grant per physical mapping. Apply the same path to static and runtime-sized
storage, preserve owner-only continuation aliases, and log per-reader free-memory
deltas around cache grants. Keep core sizing declarations until every rank maps
and grants its cache; only then publish execution state and capacity bindings.
For cache cuMemCreate, cuMemMap, or detailed cuMemSetAccess OOM on one host,
synchronize all contexts, unmap every cache mapping and alias, account for
retained free-memory loss, and retry with doubling KV-budget reductions.
Cross-host allocation remains one-shot; other errors and cleanup failures abort
startup. Existing signed cores remain loadable without re-export.
Successful first attempts keep the capacity selected by the original memory plan
and pay no retry allowance. A single-host cache OOM can now release the attempt
and recover at a smaller common KV capacity instead of requiring a guessed
manual reserve. Steady-state allocation, graph contracts, and model computation
are unchanged.
Focused runtime-core tests on current main pass: 133 passed, 7 ignored. Existing
exported TP16 cores with 8-rank and 16-rank import groups completed native
serving with no manual memory reserve, including C1/C4 generation, 32K prefill,
and non-empty response checks. The 8-rank case succeeded on its first attempt
with 3,145,728 KV tokens and 153 snapshot slots; all 384 grants had exactly eight
readers. The 16-rank case hit a final-grant OOM, unmapped the attempt, and
succeeded after a 96 MiB/GPU budget reduction with 4,485,120 KV tokens and 109
slots; successful grants had 16 readers. Separate 8-rank runs also passed with
-1G and -0G reserves. The broader Helios suite had 1,366 passes; four
missing-template failures and one cache-selection failure reproduced on the
parent source. That full run predates the rebase onto current main. Native retry
exhaustion at minimum KV capacity and cross-host retry were not tested;
cross-host retry is intentionally not enabled.
Design-Signed-Off-By: Claude Code (Claude Fable 5); design-review=ed22
Co-Authored-By: Claude Code <noreply@anthropic.com>
* Compact cache backing without reducing KV or snapshot capacity
Native startup with sixteen-rank cache import groups (DCP16) can exhaust
UVM/RM mapping handles while framebuffer memory remains free. Small KV
backing allocations used by snapshot aliases create separate allocation
and per-device mapping objects. CUDA exposes the resulting
NV_ERR_INSUFFICIENT_RESOURCES as an out-of-memory error. The backing can
be merged without changing virtual cache layout, so handle pressure need
not be relieved by shrinking KV.
Replace cache allocation retry and budget backoff with one allocation
attempt. Permute backing-plane assignments only between chunks with
identical bytes per page, byte offset, and mapped length, then reorder
whole chunks within one snapshot row and merge adjacent spans of the
same KV plane. Keep spans crossing row boundaries and partial row spans
in place. Preserve physical byte coverage, recorded addresses,
capacities, and each snapshot's exact set of conflicting KV pages.
Signed core metadata and owner/importer permission sets remain
compatible; no re-export is needed.
For a Kimi K3.1 Pro TP16 layout with 2,234 local KV pages and 112
snapshots, KV backing chunks per rank fall from 1,920 to 1,625. With
default memory sizing or --memory-limit=-0G, DCP16 retains 4,575,232 KV
tokens and 112 snapshot slots. Eight-rank import groups (DCP8) retain
3,145,728 tokens and 153 snapshot slots. Capacity selection is
unchanged; no additional reserve or allocation retry remains.
Native startup and replay are qualified on sixteen RTX PRO 6000
Blackwell GPUs with driver 615.71.10: both import group sizes passed
default, -0G, and -1G, including generation at concurrency one and four,
three cold 32,768-token prefills, reader checks, and clean shutdown. The
runtime-core CPU suite passed 133 tests; the GPU alias test passed with
distinct byte patterns, including merged backing. Bounded TLA+ models
and Rust conformance checks passed without mutation testing, and the
release CLI built successfully. Six other GPU fixture tests were not
run. Qualification does not establish model quality or support on other
hardware/driver versions.
Design-Signed-Off-By: Codex (GPT-6); design-review=ed22
---------
Co-authored-by: Claude Code <noreply@anthropic.com>1 parent b0219ef commit d7a2081
6 files changed
Lines changed: 948 additions & 194 deletions
File tree
- docs
- helios/src/runtime_core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
665 | 699 | | |
666 | 700 | | |
667 | 701 | | |
| |||
787 | 821 | | |
788 | 822 | | |
789 | 823 | | |
790 | | - | |
791 | | - | |
792 | | - | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
793 | 852 | | |
794 | 853 | | |
795 | 854 | | |
| |||
0 commit comments