Repository navigation
Conversation
|
A case file has been opened for 742. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe pool-only capture-buffer bound is sound — planning, binary-search growth charging,
Walkthrough
Merge Risk: Low · up to
|
02990da to
66d6af3
Compare
|
Updated the branch (
|
66d6af3 to
f26d8a8
Compare
|
Updated the branch (
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedCommit
Walkthrough
Merge Risk: Low · up to
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Ready To MergeCommit
Walkthrough
Merge Risk: Low · up to
|
Why Pool-only prefix-cache offload (`--prefix-cache-pool` with zero `--prefix-cache-memory` and no local disk tier, added in PR NVIDIA#455) registers a CPU-readable capture buffer sized to hold one full checkpoint chain plus one row of slots. Currently `headroom_inner`, `capture_growth`, and `planned_offload_host` pass the entire GPU KV page capacity as that chain length. On large-VRAM GPUs or long-context quantized models where the GPU cache holds several full-context sequences, sizing the capture buffer to total GPU page capacity multiplies host RAM demand by the KV-to-context ratio and either throttles allocated GPU KV pages or triggers the startup error `host budget cannot hold a full pool capture` noted in PR NVIDIA#455's review. Because no single captured sequence chain can exceed `max_sequence_tokens`, bounding the chain to `min(GPU page capacity, ceil(max_sequence_tokens / page_tokens))` suffices while preserving the existing `intake_slots` floor for concurrent transfer bursts. What changed 1. Add `pub max_sequence_pages: Option<NonZeroU64>` to `PrepareInputs` in `selene/src/offload.rs` (keeping `None` uncapped for callers that omit a sequence limit) and clamp `headroom_inner`'s `chain_pages` via `max_sequence_pages.map_or(pages, |limit| pages.min(limit.get()))`. 2. In `helios/src/runtime_core/memory.rs`, enforce both a positive `max_sequence_tokens` ceiling and a positive `contract.cache.page_tokens` size (via `max_sequence_pages(context, page_tokens)`) before dividing under all `--kv-cache-limit` modes (including `memory`, where `page_ceiling` returns early), compute `max_sequence_pages: NonZeroU64`, pass it into `headroom_with_inputs_for_budget`, share `capture_chain_pages(pages, max_sequence_pages)` between `capture_growth` and `planned_offload_host`, and return `max_sequence_pages` through `PlannedHostBudgets`. 3. Accept `max_sequence_pages: NonZeroU64` in private `NativeModel::prepare_offload` (`helios/src/runtime_core/model.rs`) from `PlannedHostBudgets` instead of recomputing from `server_config`, keeping planning and attach paths consistent. 4. Update the pool-only sizing specification in `docs/prefix-cache-offload.md` to document the single-sequence ceiling. 5. Thread `max_sequence_pages: None` through existing `PrepareInputs` test fixtures and `NonZeroU64::MIN` through `prepare_offload` test callers, add capped coverage inside `pool_only_sizes_registered_capture_and_headroom_for_local_ranks` (`selene`), and add `pool_capture_growth_caps_at_max_sequence_pages_without_throttling_gpu_pages` (`helios`) covering zero-input validation, ceiling rounding, capture exhaustion without clamping, shared `capture_chain_pages` clamping, and exact parity with uncapped `capacities`. Claimed benefit In pool-only mode (`--prefix-cache-memory 0`), the capture chain term stays bounded to one `max_sequence_tokens` chain plus one row's slots instead of scaling with total GPU KV page capacity. For a 1,048,576-token context core on a 96 GiB SM120 workstation GPU (`99,008` KV pages, `~748 KiB`/page record, `91` row slots, `64` tokens/page), the capture buffer drops from `99,099` slots (`~70.7 GiB`) to `16,475` slots (`11.8 GiB`, a `6.0x` reduction) while preserving all `99,008` GPU KV pages (`70.9 GiB`). Evidence All six workspace crates pass in release mode under `RUSTFLAGS="-D warnings"` inside `rust:1.94.1-slim-trixie` at this tree (`eos -- --test-threads=1`: 12 passed; `selene --features test-support`: 649 passed; `selene-manager --features test-support`: 448 passed, 1 ignored across 15 binaries including `rank_processes`; `helios --features runtime-core,server`: 2,041 passed, 88 ignored with 7 CI recipe templates prepared; `flare`: 255 passed, 4 ignored; `flare-cli`: 254 passed, 3 ignored). Hardware CUDA tests (`FLARE_RUN_CUDA_TESTS=1`), integrated-memory hosts, multi-host suites, Windows native tests, and Kani/TLA+ runs were not executed against this tree; live Qwen4-35B-A3B `11.8 GiB` startup and container RSS measurements were observed on a `v0.6.0` (`f705086`) build carrying this sizing rule. Signed-off-by: fakoli <fakoli@users.noreply.github.com> Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
f26d8a8 to
5021b7a
Compare
|
Applied the follow-up polish and test-coupling cleanups (
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Ready To MergeCommit
Walkthrough
Merge Risk: Low · up to
|
Why
PR #455 added a CPU-readable capture buffer for single-process pool-only offload (
--prefix-cache-poolwith--prefix-cache-memory 0and no local disk tier) so instances without a local memory or disk tier can still export checkpoints toselene-manager. Review of #455 flagged that sizing the capture slab to full GPU page capacity plus one row reserves nearly the entire GPU KV cache in registered host memory and fails startup withhost budget cannot hold a full pool captureif the host budget cannot accommodate it.When a GPU holds multiple full-context sequences of KV pages (for example, quantized models or large-VRAM workstation cards serving
1M-context cores), sizing the capture chain to total GPU page capacity inflates the host buffer proportionally. Because no single captured sequence chain can exceed the core'smax_sequence_tokens, bounding the capture chain length tomin(GPU page capacity, ceil(max_sequence_tokens / page_tokens))prevents multi-sequence oversizing and avoids throttling GPU KV allocation or exceeding container memory limits. Meanwhileintake_slots(layout, inputs.max_active)remains intentionally uncapped so concurrent active transfers are not starved on wide TP deployments.What changed
selene/src/offload.rs):pub max_sequence_pages: Option<NonZeroU64>toPrepareInputs(encoding non-zero sequence bounds at the type level and keepingNoneuncapped for callers that omit a bound).headroom_inner'schain_pagesviainputs.max_sequence_pages.map_or(pages, |limit| pages.min(limit.get())).prepare_with_inputs_budget_with_progressdestructuring with..for forward compatibility.helios/src/runtime_core/memory.rs,helios/src/runtime_core/model.rs):max_sequence_tokens > 0(NonZeroU64parsed once) andcontract.cache.page_tokens > 0insidemax_sequence_pages(context, page_tokens) -> Result<NonZeroU64>beforediv_ceil(sincepage_ceilingreturns early under the default--kv-cache-limit memorymode).max_sequence_pagesintoheadroom_with_inputs_for_budget(whereheadroom_innerclampsminimum_pages), sharedcapture_chain_pages(pages, max_sequence_pages)acrosscapture_growthandplanned_offload_host, and threadedPlannedHostBudgets::max_sequence_pagesdirectly into privateNativeModel::prepare_offload(NonZeroU64) so planning and attach cannot diverge.docs/prefix-cache-offload.md):min(GPU page capacity, ceil(max_sequence_tokens / page_tokens))chain ceiling alongside the existing GLM-5.3-Flash TP4 (11.0 GiB/7.1 GiBfloor) example and startup failure behavior.selene/src/offload/tests.rs,helios/src/runtime_core/memory.rs, and existing test fixtures):(512, NonZeroU64::new(64))vs uncappedNonechecks intopool_only_sizes_registered_capture_and_headroom_for_local_ranks.pool_capture_growth_caps_at_max_sequence_pages_without_throttling_gpu_pagescoveringmax_sequence_pageszero-input rejection, ceiling division, capture exhaustion (capture_growthreturningNoneabovemax_pages), sharedcapture_chain_pagesclamping, and exact parity (pages == uncapped_pages) whenhost_free == 0pastmax_sequence_pages.max_sequence_pages: Noneto existingPrepareInputsfixtures acrosshelios,selene, andselene-manager, andNonZeroU64::MINto early-returningprepare_offloadunit tests inmodel.rs.Claimed benefit
In pool-only mode (
--prefix-cache-memory 0), host capture chain sizing stays bounded to onemax_sequence_tokenschain (with theintake_slotsfloor preserved for transfer bursts) instead of growing with total GPU KV page capacity. Whencap + rowexceedsintake_slots, shrinking the capture buffer only bounds concurrent multi-sequence capture capacity (parallel captures remain retry-safe and evictable viaRetry(StoreReason::Slabs)):Qwen4-35B-A3B,1,048,576max sequence tokens,64tok/page,96 GiBSM120 GPU,24 GiBcontainer limit)mainmax_sequence_pages = 16,384)99,008pages (70.9 GiB,6,336,512KV tokens =6.04xmax sequence)99,008pages (70.9 GiB, unchanged)chain_pages + 91row slots,~748 KiB/page record)99,008 + 91 = 99,099slots (~70.7 GiB)16,384 + 91 = 16,475slots (11.8 GiB)24 GiBcontainer memory limit24 GiBcontainer memory limit (or fails admission / throttles GPU pages when host budget <~70.7 GiB)pool only: capture buffer 11.8 GiB (16475 slots, populate 1.9s, register 0.4s))Per-process host memory accounting (live two-worker comparison on identical
Qwen4-35B-A3Bhardware,24 GiBcontainer cgroup limit,4,096 MiBembedding row cache,22.0 GiBsharedselenepool mapping):--prefix-cache-memory 0(pool_only(),11.8 GiBcapture slab +4,096 MiBrow cache + runtime/pool/CUDA overhead):18.74–19.06 GiBcontainer RSS (docker stats).--prefix-cache-memory 1G(0.9 GiBmemory slab +4,096 MiBrow cache + runtime/pool/CUDA overhead):7.83–8.04 GiBcontainer RSS (docker stats).10.91–11.02 GiB) matches the configured slab delta (11.8 GiB - 0.9 GiB = 10.9 GiB), confirming the bounded buffer reserves and faults only its single-sequence size.Supersedes the bundled
pool_only()change previously included in closed #718.Evidence
Executed on PR head (
5021b7a, identical tree to2f151f9, baseNVIDIA/hyperflare-inference:mainf46a99220a)All six Rust crates passed in release mode inside
rust:1.94.1-slim-trixie(--shm-size=4g,--ulimit memlock=67108864:67108864, non-root UID,--security-opt seccomp=unconfined, XFSFLARE_OFFLOAD_TEST_DIR,RUSTFLAGS="-D warnings",CARGO_TARGET_DIR):cargo test --locked --release --manifest-path eos/Cargo.toml -- --test-threads=1— 12 passed, 0 failed, 0 ignored (run single-threaded because multi-threaded container load hit theadaptive_mid_mapping_fallback_merges_into_single_vmacompaction-stall timing threshold under concurrent host traffic).cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support— 649 passed (648 unit + 1 doctest), 0 failed, 0 ignored (includespool_only_sizes_registered_capture_and_headroom_for_local_rankswith bounded and unbounded cases).cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support— 448 passed, 0 failed, 1 ignored across 15 binaries (includesrank_processes: 3 passed, 0 failed).cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server(withFLARE_TEST_TEMPLATE_DIRprepared forgemma4,glm53,mimo_v2,minimax_m3,nemotron_h,qwen38, andstep5per CI) — 2,041 passed, 0 failed, 88 ignored across 16 binaries (includespool_capture_growth_caps_at_max_sequence_pages_without_throttling_gpu_pages).cargo test --locked --release --manifest-path flare/Cargo.toml— 255 passed, 0 failed, 4 ignored across 4 binaries.cargo test --locked --release --manifest-path flare-cli/Cargo.toml— 254 passed, 0 failed, 3 ignored across 5 binaries.Live startup and memory telemetry provenance
The
11.8 GiB(16,475slots)Prepare host prefix cache.log line and18.74–19.06 GiBvs7.83–8.04 GiBcontainer RSS measurements were observed on av0.6.0(f705086) build running the samemax_sequence_pagessizing rule rather than re-measured via an A/B restart onf46a99220a.Unrun checks
FLARE_RUN_CUDA_TESTS=1),tests/server/test_prefix_cache_offload.py, andqualify/host_cache.pyon head commit5021b7a.sharded/ RoCE suites, and native Windows builds/tests.scheduler/cache_memory, lifecycle state machines, or Kani-proven validators).Discord: fakoli