Skip to content

Fix CUDA 12 batched copies, Linux ARM64 release portability, and Selene unified-memory budgeting - #589

Merged
lukealonso merged 1 commit into
mainfrom
v042-jetson-tarball-vlm-cuda12
Nov 28, 2026
Merged

lukealonso merged 1 commit into
mainfrom
v042-jetson-tarball-vlm-cuda12

Conversation

@lukealonso

Copy link
Copy Markdown
Collaborator

Why

Three defects affect CUDA 12.x GPUs, stock JetPack 6 / Ubuntu 22.04 Linux hosts, and unified-memory prefix-cache offloading on main:

  1. Discrete CUDA 12.x batched copies fail on pinned-host pointers. When cuMemcpyBatchAsync_v2 is absent on CUDA < 13.0 drivers, Stream::copy_batch in helios/src/cuda.rs fell back to cuMemcpyDtoDAsync_v2. Callers in helios/src/execution/transport.rs (frame.input.address() allocated with cuMemHostAlloc(..., flags = 0)) and helios/src/offload/transfer.rs pass pinned/registered host addresses alongside device addresses. On discrete CUDA 12.x GPUs, cuMemcpyDtoDAsync_v2 rejects raw host pointers, whereas cuMemcpyAsync infers transfer direction under unified virtual addressing (UVA).
  2. flare-linux-arm64.tgz cannot start on stock JetPack 6 / Ubuntu 22.04. .github/workflows/release.yml built both Linux release archives directly on Ubuntu 24.04 runners (GLIBC_2.39), and helios/build.rs hard-linked -libverbs when the roce feature is enabled (default on aarch64 Linux). Stock JetPack 6 ships Ubuntu 22.04 (glibc 2.35) without libibverbs1, so the dynamic loader rejects the binary before main. Release CI missed both incompatibilities because it checked the archive only inside ubuntu:24.04 with libibverbs1 installed.
  3. Selene host budgeting, HOST_NUMA-only memory offload, and Eos THP ordering. selene/src/offload.rs::host_pool_budget always subtracted an unscaled 2 GiB + total / 20 reserve, and prepare_with_inputs re-evaluated it after GPU KV-cache allocation. On unified-memory SoCs (8–32 GiB Jetson Orin or any integrated GPU with --memory-limit), KV allocation already consumes MemAvailable and leaves only the reserved offload budget plus the scaled/explicit reserve, so re-subtracting 2 GiB + total / 20 post-KV-alloc shrinks intake to minimum or fails pool-only capture startup. Independently, memory-only --prefix-cache-memory unconditionally called SlabPool::sized_by_rank (CU_MEM_LOCATION_TYPE_HOST_NUMA VMM), which fails on GA10B and Windows WDDM where HOST_NUMA VMM is unsupported. Finally, eos/src/unix.rs::map_host passed MAP_POPULATE to mmap before calling madvise(MADV_HUGEPAGE), faulting 4 KiB base pages before transparent huge page advice could apply.

What changed

  • CUDA 12 cuMemcpyAsync fallback (helios/src/cuda.rs, docs/prefix-cache-offload.md):
    • Before: Stream::copy_batch called cuMemcpyDtoDAsync_v2 per entry when cuMemcpyBatchAsync_v2 was absent.
    • After: Driver loads cuMemcpyAsync, and Stream::copy_batch's fallback calls cuMemcpyAsync per entry (copy_dtod_async retains cuMemcpyDtoDAsync_v2).
  • Lazy libibverbs.so.1 loading and Ubuntu 22.04 release builds (helios/native/roce_proxy_dlopen.c, helios/build.rs, helios/src/execution/roce.rs, .github/workflows/release.yml, flare-cli/Cargo.toml, flare/Cargo.toml, helios/Cargo.toml, docs/release.md, docs/runtime-core-design.md, docs/multi-host.md):
    • Before: helios/build.rs compiled native/roce_proxy.c directly and emitted cargo:rustc-link-lib=ibverbs; .github/workflows/release.yml built on Ubuntu 24.04 runners and smoke-tested only in ubuntu:24.04 with libibverbs1 installed.
    • After: helios/build.rs compiles native/roce_proxy_dlopen.c and links dl and pthread without ibverbs. roce_proxy_dlopen.c lazily opens libibverbs.so.1 via dlopen / dlvsym (IBVERBS_1.1, optional IBVERBS_1.8) under pthread_once, redirects all 17 ibv_* calls to static trampolines without exporting ibv_* symbols, and #includes the unmodified vendored helios/native/roce_proxy.c. RoceTransport::open calls roce_ensure_libibverbs after preflight checks so missing RDMA packages report an install hint only when opening multi-host RoCE transport. .github/workflows/release.yml builds and packages both Linux targets inside ubuntu:22.04, verifies zero libibverbs.so DT_NEEDED entries and no GLIBC_ symbol versions above 2.35, and runs clean-container smoke checks in both ubuntu:22.04 and ubuntu:24.04 without libibverbs1.
  • Selene host budgeting, HOST_NUMA fallback, and Eos THP ordering (selene/src/offload.rs, selene/src/offload/tests.rs, selene/src/registrar.rs, selene/src/slab.rs, helios/src/cuda.rs, helios/src/offload/mod.rs, helios/src/offload/registrar.rs, helios/src/runtime_core/memory.rs, helios/src/runtime_core/model.rs, eos/src/unix.rs, docs/prefix-cache-offload.md):
    • Before: selene/src/offload.rs::host_pool_budget always subtracted 2 GiB + total / 20, prepare_offload re-queried host_pool_budget post-KV-alloc, memory-only --prefix-cache-memory failed whenever HOST_NUMA VMM was unsupported, and eos::map_host passed MAP_POPULATE before MADV_HUGEPAGE.
    • After: selene/src/offload.rs provides host_service_headroom_bytes (64 MiB at <= 16 GiB, min(2 GiB, total / 32) above 16 GiB) and host_reserve_bytes, shared with helios/src/runtime_core/memory.rs. integrated_offload_host_budget honors explicit --memory-limit on integrated GPUs without implicit reserves, and NativeModel::allocate_caches returns the pre-planned offload host budget into NativeModel::prepare_offload -> prepare_with_inputs_budget so post-KV-alloc setup matches the budget reserved before KV allocation. try_map_device_host_parts / HostRegistrar::try_map_split / SlabPool::try_sized_by_rank fall back to SlabPool::sized + cuMemHostRegister_v2 only when HOST_NUMA VMM returns CUDA_ERROR_INVALID_VALUE (1) or CUDA_ERROR_NOT_SUPPORTED (801), while real errors such as OOM propagate unchanged. eos/src/unix.rs::map_host omits MAP_POPULATE, calls madvise(MADV_HUGEPAGE) first, and then prefaults via madvise(MADV_POPULATE_WRITE) on Linux with a page-stride write_volatile fallback.

Claimed results

  • Observed on x86_64 Linux: Building flare-cli --features roce inside ubuntu:22.04 with libibverbs-dev produces an executable with Max GLIBC: GLIBC_2.34, no libibverbs.so DT_NEEDED entry, and no ibv_* dynamic symbols, passing flare --version and flare {run,agent,orbit} --help in clean ubuntu:22.04 and ubuntu:24.04 containers without libibverbs1. eos::map_host applies MADV_HUGEPAGE (VmFlags: hg) before prefaulting zeroed pages.
  • Expected on hardware not tested here: Stock JetPack 6 ARM64 hosts can execute flare-linux-arm64.tgz without libibverbs1, discrete CUDA 12.x GPUs execute Stream::copy_batch without cuMemcpyDtoDAsync_v2 failures on pinned-host pointers, and GA10B / Windows WDDM hosts support --prefix-cache-memory without HOST_NUMA VMM errors or post-KV-alloc host-budget double-subtraction.

Evidence and limitations

  • cargo test --locked --release --manifest-path eos/Cargo.toml: 2 passed (including map_host_advises_hugepages_and_prefaults_zeroed_pages).
  • cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support: 506 passed (including small-SoC/explicit-limit budget tests, prepare_with_inputs_budget tests, and HOST_NUMA fallback vs OOM propagation tests).
  • cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server,roce --lib -- cuda::tests runtime_core::memory::tests runtime_core::model::tests offload:: execution::roce::tests: 40 passed, 16 ignored (GPU-only), including lazy_libibverbs_loader_resolves_symbols_or_reports_install_hint and integrated_offload_host_budget_matches_small_soc_scaling_and_explicit_limits.
  • cargo test --locked --release --manifest-path flare/Cargo.toml: 228 passed across full run (226 passed + 2 hub tests passed on individual rerun), 4 ignored.
  • cargo test --locked --release --manifest-path flare-cli/Cargo.toml: 24/24 integration tests passed (cache_commands, cli, inspect, unverified_payload); 196 unit tests passed (195 + 1 serial rerun), 3 ignored, with 1 unrelated timeout/BrokenPipe in untouched distribution::tests::source_waits_for_receiver_file_verification.
  • cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support: 84/85 passed in tests/client.rs; 1 unrelated failure in untouched a_record_put_into_a_manager_on_another_host_is_restored_over_tcp (stream: 2 windows vs >= 3 on moved() metrics snapshot).
  • Local x86_64 Docker verification of the release.yml flow in ubuntu:22.04 (cargo build --locked --release --manifest-path flare-cli/Cargo.toml --features roce --bin flare + packaging/archive.py) passed ELF checks (Max GLIBC: GLIBC_2.34, no libibverbs.so DT_NEEDED) and clean ubuntu:22.04 and ubuntu:24.04 smoke checks without libibverbs1.
  • Unrun checks: Native aarch64 build and ubuntu-24.04-arm CI run, live GPU tests on discrete CUDA 12.x / Jetson Orin GA10B / Windows WDDM hardware, and full helios chat-template tests requiring FLARE_TEST_TEMPLATE_DIR.

Discord: no username provided

…ne unified-memory budgeting

Three concrete defects affect CUDA 12.x GPUs, stock JetPack 6 / Ubuntu 22.04
Linux hosts, and unified-memory prefix-cache offloading:
1. On CUDA < 13.0 drivers where `cuMemcpyBatchAsync_v2` is absent,
   `Stream::copy_batch` in `helios/src/cuda.rs` fell back to
   `cuMemcpyDtoDAsync_v2`. Callers in `helios/src/execution/transport.rs` and
   `helios/src/offload/transfer.rs` pass raw pinned-host pointers from
   `cuMemHostAlloc(..., 0)` alongside device pointers, which breaks discrete
   CUDA 12.x GPUs because `cuMemcpyDtoDAsync_v2` requires device-to-device
   semantics whereas `cuMemcpyAsync` infers transfer direction under UVA.
2. `.github/workflows/release.yml` built Linux release tarballs on Ubuntu 24.04
   runners (`GLIBC_2.39`), and `helios/build.rs` hard-linked `libibverbs` when
   the `roce` feature is enabled (default on Linux aarch64). Stock JetPack 6
   (Ubuntu 22.04, `glibc 2.35`, without `libibverbs1`) therefore could not
   execute `flare-linux-arm64.tgz`, which CI missed because smoke checks ran
   only in `ubuntu:24.04` with `libibverbs1` installed.
3. In `selene/src/offload.rs`, `host_pool_budget` always subtracted an unscaled
   `2 GiB + total / 20` reserve and `prepare_with_inputs` re-evaluated it after
   GPU KV allocation—ignoring small-SoC headroom scaling (`<= 16 GiB` and
   `<= 64 GiB`) and explicit `--memory-limit` settings on integrated GPUs, which
   shrunk intake or failed pool-only capture startup. Separately, memory-only
   `--prefix-cache-memory` unconditionally required `HOST_NUMA` VMM split
   allocation (`SlabPool::sized_by_rank`), failing on GA10B and Windows WDDM.
   Finally, `eos/src/unix.rs` passed `MAP_POPULATE` to `mmap` before calling
   `madvise(MADV_HUGEPAGE)`, faulting 4 KiB base pages before transparent huge
   page advice took effect.

Changes:
- CUDA 12 batched-copy fallback (`helios/src/cuda.rs`,
  `docs/prefix-cache-offload.md`): Added `cuMemcpyAsync` to `Driver` and
  replaced `cuMemcpyDtoDAsync_v2` in `Stream::copy_batch`'s fallback loop with
  `cuMemcpyAsync` while retaining `cuMemcpyDtoDAsync_v2` for `copy_dtod_async`.
- Lazy `libibverbs.so.1` loading and Ubuntu 22.04 release builds
  (`helios/native/roce_proxy_dlopen.c`, `helios/build.rs`,
  `helios/src/execution/roce.rs`, `.github/workflows/release.yml`,
  `flare-cli/Cargo.toml`, `flare/Cargo.toml`, `helios/Cargo.toml`,
  `docs/release.md`, `docs/runtime-core-design.md`, `docs/multi-host.md`):
  Replaced direct `-libverbs` linking in `helios/build.rs` with `-ldl` and
  compiled `helios/native/roce_proxy_dlopen.c`, which lazily loads
  `libibverbs.so.1` via `dlopen` / `dlvsym` (`IBVERBS_1.1`, optional
  `IBVERBS_1.8`) under `pthread_once` and wraps the vendored
  `helios/native/roce_proxy.c` without modifying it. `RoceTransport::open`
  calls `roce_ensure_libibverbs` after preflight checks so missing RDMA
  libraries fail with an install hint only during multi-host RoCE setup.
  Updated `.github/workflows/release.yml` to build and package both Linux
  targets inside `ubuntu:22.04`, assert no `libibverbs.so` `DT_NEEDED` entry
  and no `GLIBC_` symbol version above `2.35`, and smoke-test the extracted
  archive in clean `ubuntu:22.04` and `ubuntu:24.04` containers without
  `libibverbs1`.
- Selene host budgeting, `HOST_NUMA` fallback, and Eos THP ordering
  (`selene/src/offload.rs`, `selene/src/offload/tests.rs`,
  `selene/src/registrar.rs`, `selene/src/slab.rs`, `helios/src/cuda.rs`,
  `helios/src/offload/mod.rs`, `helios/src/offload/registrar.rs`,
  `helios/src/runtime_core/memory.rs`, `helios/src/runtime_core/model.rs`,
  `eos/src/unix.rs`, `docs/prefix-cache-offload.md`):
  Replaced the fixed `2 GiB` host headroom in `selene/src/offload.rs` with
  `host_service_headroom_bytes` (`64 MiB` at `<= 16 GiB`, `min(2 GiB, total / 32)`
  above `16 GiB`) shared by `helios/src/runtime_core/memory.rs`. Added
  `integrated_offload_host_budget` to honor explicit `--memory-limit` on
  integrated GPUs without implicit reserves, and threaded the pre-planned
  offload host budget from `NativeModel::allocate_caches` into
  `NativeModel::prepare_offload` -> `prepare_with_inputs_budget` so
  post-KV-allocation setup matches the budget already reserved. Added
  `try_map_device_host_parts` / `HostRegistrar::try_map_split` /
  `SlabPool::try_sized_by_rank` so `CUDA_ERROR_INVALID_VALUE` (1) or
  `CUDA_ERROR_NOT_SUPPORTED` (801) on `HOST_NUMA` VMM falls back to a
  registered anonymous mapping while real errors such as OOM still propagate.
  Updated `eos/src/unix.rs::map_host` to omit `MAP_POPULATE`, call
  `madvise(MADV_HUGEPAGE)` first, and then prefault via
  `madvise(MADV_POPULATE_WRITE)` on Linux with a page-stride `write_volatile`
  fallback.

Claimed results:
- Observed on x86_64 Linux: building `flare-cli --features roce` inside
  `ubuntu:22.04` with `libibverbs-dev` produces an executable with `Max GLIBC:
  GLIBC_2.34`, no `libibverbs.so` `DT_NEEDED` entry, and no `ibv_*` dynamic
  symbols, passing `flare --version` and `flare {run,agent,orbit} --help` in
  clean `ubuntu:22.04` and `ubuntu:24.04` containers without `libibverbs1`.
  `eos::map_host` sets `MADV_HUGEPAGE` (`VmFlags: hg`) before prefaulting.
- Expected on hardware not tested here: stock JetPack 6 ARM64 hosts can run
  `flare-linux-arm64.tgz` without `libibverbs1`, discrete CUDA 12.x GPUs execute
  `Stream::copy_batch` without `cuMemcpyDtoDAsync_v2` host-pointer failures, and
  GA10B / Windows WDDM hosts support `--prefix-cache-memory` without `HOST_NUMA`
  VMM failure or post-KV-allocation host-budget double-subtraction.

Supporting evidence and limitations:
- `cargo test --locked --release --manifest-path eos/Cargo.toml`: 2 passed
  (including `map_host_advises_hugepages_and_prefaults_zeroed_pages`).
- `cargo test --locked --release --manifest-path selene/Cargo.toml --features test-support`:
  506 passed (including small-SoC/explicit-limit budget tests,
  `prepare_with_inputs_budget` tests, and `HOST_NUMA` fallback vs OOM tests).
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server,roce --lib -- cuda::tests runtime_core::memory::tests runtime_core::model::tests offload:: execution::roce::tests`:
  40 passed, 16 ignored (GPU-only), including
  `lazy_libibverbs_loader_resolves_symbols_or_reports_install_hint` and
  `integrated_offload_host_budget_matches_small_soc_scaling_and_explicit_limits`.
- `cargo test --locked --release --manifest-path flare/Cargo.toml`: 228 passed
  across full run (226 passed + 2 hub tests passed on individual rerun), 4
  ignored.
- `cargo test --locked --release --manifest-path flare-cli/Cargo.toml`: 24/24
  integration tests passed (`cache_commands`, `cli`, `inspect`,
  `unverified_payload`); 196 unit tests passed (195 + 1 serial rerun), 3
  ignored, with 1 unrelated timeout/BrokenPipe in untouched
  `distribution::tests::source_waits_for_receiver_file_verification`.
- `cargo test --locked --release --manifest-path selene-manager/Cargo.toml --features test-support`:
  84/85 passed in `tests/client.rs`; 1 unrelated failure in untouched
  `a_record_put_into_a_manager_on_another_host_is_restored_over_tcp`
  (`stream: 2 windows` vs `>= 3` on `moved()` metrics snapshot).
- End-to-end x86_64 Docker build in `ubuntu:22.04` (`--features roce`,
  `libibverbs-dev`, `packaging/archive.py`) + ELF `DT_NEEDED`/`--version-info`
  checks + clean `ubuntu:22.04` and `ubuntu:24.04` smoke checks passed.
- Unrun checks: native `aarch64` build and `ubuntu-24.04-arm` CI run, live
  hardware GPU tests on discrete CUDA 12.x / Jetson Orin GA10B / Windows WDDM,
  and full `helios` chat-template tests requiring `FLARE_TEST_TEMPLATE_DIR`.

Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=c3a9
@lukealonso
lukealonso merged commit ba3afb1 into main Nov 28, 2026
2 checks passed
@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 589.
Case File Intake Report

Future reviews will auto-run 90 minutes after code updates are pushed.

  • Re-review sooner: Call @flare-autobot after push.
  • Opt-out: Include #autobot:ignore in the PR or any comment.

@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

The core fixes (CUDA 12 cuMemcpyAsync fallback, lazy libibverbs.so.1 loading, scaled unified-memory host reserves, HOST_NUMA fallback, Eos MADV_HUGEPAGE ordering) are sound and address real defects with no proven correctness or memory-safety blockers. Four verified issues remain: a clamping/error-masking inconsistency in the duplicated host-budget helper, a contradictory Stream::copy_batch docstring, three stale docs/comments, and the unrun ubuntu-24.04-arm release check.

  • Blockers: 0
  • Should fix: 4
  • Subtractive suggestions: 3
  • Nits: 4

Have your agent review the Full Review for complete verified findings, file:line citations, and suggested changes.

To opt out, include #autobot:ignore in your post or comment.

FujitsuPolycom added a commit to FujitsuPolycom/flare-local-inference that referenced this pull request Nov 29, 2026
…head

Why

Disk-only prefix-cache offload (`--prefix-cache-memory 0` with
`--prefix-cache-disk`, default `--lossless-kv-compression off`) incurred five
host and coordination costs: (1) opening a raw v1-v3 record file
(`selene/src/disk.rs`) issued two sequential `O_DIRECT` reads (4 KiB header,
then page checksums); (2) `xxh3` page hashing ran serially on the single disk
thread across up to 64 pages (`268 MB` at `4.19 MB`/page); (3) `Staged::pump_all`
(`selene/src/disk_store.rs`) submitted unlinks/truncates and outbound writes
ahead of interactive restores; (4) while waiting on an inbound restore with an
idle GPU, Helios's worker (`helios/src/server/runtime.rs`) slept up to `2 ms`
and multi-host disk peers (`selene/src/shard.rs`) slept `1 ms` instead of waking
on socket readability; and (5) on integrated-memory GPUs
(`CU_DEVICE_ATTRIBUTE_INTEGRATED`), disk-only offload scaled registered host
intake with concurrency (`2 * max_active * row_slots + 128`, up to `8.2 GiB`
needed on `Qwen3.8-27B-NVFP4` at `--max-concurrency 16`), carving GPU KV cache
out of shared RAM even though paged disk streaming stages at most two windows
(`2 * (64 + row_slots)` slots).

What

- Single-read raw open (`selene/src/disk.rs`): preserve `NVIDIA#504`'s v4 packed
  `Header::read_metadata` open branch, and on raw v1-v3 `O_DIRECT` opens read
  the 4 KiB header and expected checksum segment in one transfer when
  `expected.tail_pages <= MAX_TAIL_PAGES` (`CHECKSUM_SCRATCH_BYTES = 1 MiB`),
  falling back to a 4 KiB header-only read on failure while preserving retry
  I/O errors, truncated-file checks, and shared scratch span helpers.
- Scoped parallel page hashing (`selene/src/disk.rs`): cache `parallel_cpus`
  once at `Worker::new` and hash raw batches of >= `HASH_PARALLEL_MIN_PAGES`
  (`4`) pages across `parallel_cpus.min(MAX_HASH_THREADS).min(buffers.len())`
  `std::thread::scope` threads (`MAX_HASH_THREADS = 4`) when `parallel_cpus >=
  HASH_PARALLEL_MIN_CPUS` (`4`), with `0` idle helper threads, Linux
  `SCHED_BATCH` inheritance via `clone`, inline recomputation on helper spawn
  or unwind failure, and fault hooks folded into `Faults` under
  `cfg(any(test, feature = "test-support"))` (zero test-only parameters on
  shipped signatures).
- Bounded restore-first submission and wakeup (`disk_store.rs`,
  `helios/src/server/runtime.rs`, `shard.rs`): order `Staged::pump_all` as
  inbound restores, then outbound writes, then maintenance while submitting one
  reserved maintenance job ahead of inbound and outbound after
  `MAINTENANCE_DEFER_LIMIT` (`8`) consecutive passes where queued maintenance
  lost free disk-queue space; poll `Worker::idle_wait` at `50 us` during
  active/waiting inbound restores; and wake Unix disk peers via `libc::poll`
  (`POLLIN`).
- Bounded integrated disk-only intake & `NVIDIA#589` unified-memory budget integration
  (`selene/src/offload.rs`, `helios/src/offload/mod.rs`,
  `helios/src/runtime_core/{memory,model}.rs`, `docs/prefix-cache-offload.md`):
  pass explicit `PrepareInputs` (`max_active`, `input_staging`, `shard`,
  `integrated`) into `headroom_with_inputs`, `headroom_with_inputs_for_budget`,
  `prepare_with_inputs`, and `prepare_with_inputs_budget` (deleting unused
  `prepare` and dead `core: &Path`), unify `disk_enabled()`, `headroom_inner`,
  private `target_intake_slots`, and parameterless `Prepared::intake_warning()`
  (`required_intake` + `sized_concurrency`), preserve `options.pool_only()` so a
  degraded disk directory under `--prefix-cache-pool --prefix-cache-memory 0`
  remains restore-only against `NVIDIA#589`'s `planned_offload_host`, and target
  `intake_slots(layout, 1)` (`2 * (64 + row_slots)`) on integrated disk-only
  hosts without shrink warnings across `NVIDIA#589`'s small-SoC headroom scaling,
  explicit `--memory-limit` budgets, pre-planned post-KV `planned_offload_host`,
  and `HOST_NUMA` split-mapping fallback while preserving `NVIDIA#504` lossless KV
  compression. No core re-export or record-format change is required.

Result

Live `flare run` A/B on NVIDIA GB10 (SM121) measured `NVIDIA#497` standalone
(`cd5a366b`) against pre-`NVIDIA#504` `main` (`c0c4f798`) with `--prefix-cache-memory
0 --prefix-cache-disk /tmp/selene-disk` and default `--lossless-kv-compression
off` (the raw v3 `.ckpt` path, whose default GB10 disk-only execution is
unchanged by rebasing onto `ba3afb13` / `NVIDIA#589` because GB10 128 GiB exceeds the
16 GiB small-SoC threshold and disk-only intake targets the same two-window
floor; ingress-to-first-token TTFT; bandwidth is rank-0
`flare_host_cache_inbound_bytes_per_second`):
- `Qwen3.8-27B-NVFP4` (TP1, `--max-concurrency 16 --prefix-cache-disk-limit
  40G`, 3 interleaved repeats): intake drops `7.3 GiB` (`1,877` slots, shrink
  warning) -> `1.0 GiB` (`252` slots, `0` warnings), raising GPU KV cache `64.4
  -> 71.6 GiB` (`+7.2 GiB` / `+235.5K` tokens); median single-restore bandwidth
  and TTFT improve `7.05 -> 8.02 GB/s` (`348.0 -> 301.7 ms`, `-13.3%`; wall
  `353.5 -> 306.5 ms`) at `30.0K` and `6.28 -> 8.68 GB/s` (`+38.2%`, `551.8 ->
  447.6 ms`, `-18.9%`; wall `561.7 -> 455.4 ms`) at `61.1K`; `NVIDIA#497` standalone
  8-way `61.1K` cold-restart burst mean median TTFT drops `8,156.1 -> 6,963.4
  ms` (`-14.6%`, 2 interleaved repeats; combining this change with concurrent
  ancestor-restore read coalescing in companion PR `NVIDIA#496` is unmeasured).
- Isolated `std::thread::scope` `xxh3` (`cd5a366b` with `MAX_HASH_THREADS = 1`
  at `selene/src/disk.rs:157` and no other change vs unmodified `cd5a366b` with
  `MAX_HASH_THREADS = 4`, 3 interleaved repeats on `Qwen3.8-27B-NVFP4`):
  parallel hashing alone improves median TTFT `486.8 -> 447.6 ms` (`-8.1%`,
  `7.73 -> 8.68 GB/s`, `+12.3%`, faster on all 3 repeats: `[447.6, 432.7,
  451.2]` vs `[479.9, 557.5, 486.8] ms`) at `61.1K` and `322.4 -> 301.7 ms`
  (`7.55 -> 8.02 GB/s`) at `30.0K`. `HASH_PARALLEL_MIN_PAGES = 4` and
  `HASH_PARALLEL_MIN_CPUS = 4` assign at least one page per thread at the
  4-thread cap and leave cores for serving threads on narrow hosts (not swept
  separately).
- `Qwen3.8-Flash-Next` (TP1, `--max-concurrency 8 --prefix-cache-disk-limit
  24G`, `cd5a366b` vs `c0c4f798`): intake drops `1.9 -> 0.3 GiB` (`2,288 -> 398`
  slots), raising GPU KV cache `23.28 -> 24.98 GiB` (`+1.70 GiB` / `+127.0K`
  tokens); bandwidth improves `5.67 -> 7.05 GB/s` (`372.1 -> 355.6 ms`) at
  `30.0K` and `6.65 -> 8.35 GB/s` (`+25.6%`, `458.0 -> 413.8 ms`, `-9.7%`) at
  `61.0K`; `NVIDIA#497` standalone 8-way burst median TTFT drops `3,327.5 -> 3,078.5
  ms` (`-7.5%`).
- Expected interaction with `NVIDIA#589` (`ba3afb13`): on unified-memory GPUs with an
  explicit `--memory-limit`, disk-only intake remains bounded at
  `intake_slots(layout, 1)` so unlocked unified RAM expands GPU KV cache rather
  than concurrency-scaled staging, while warm+disk (`--prefix-cache-memory > 0`)
  and pool-only capture retain `NVIDIA#589`'s pre-planned host budget and small-SoC
  scaling.

What it costs: up to three short-lived scoped `xxh3` helpers during >=4-page
raw batches (`0` idle helpers), `50 us` `Worker::idle_wait` polling during
active/waiting inbound restores (`969.9 -> 1,069.2 ms/s` `/proc/<pid>/stat`
server CPU across 8-way `Qwen3.8-27B-NVFP4` bursts: `+99.3 ms/s` / ~`0.10` of
20 Grace cores combined; the `50 us` poll's CPU share and latency contribution
are unisolated from scoped `xxh3` helpers), two-window serialization for
concurrent unique-prefix restores and outbound stores on integrated disk-only
hosts, and up to `8` passes of maintenance deferral.

Companion PR (NVIDIA#496, concurrent ancestor-restore open and window coalescing):
merge `NVIDIA#497` first, then rebase `NVIDIA#496` onto `main` so `Staged::pump_all` retains
`MAINTENANCE_DEFER_LIMIT = 8` (submitting one reserved maintenance job first
after `8` deferred passes) and runs `NVIDIA#496`'s private `host_inbound` and shared
`pump_device_inbound` queues ahead of `outbound` and `maintenance`.

Evidence

- Rebased crate and Python checks over `origin/main` (`ba3afb13`, `NVIDIA#589`) on
  x86_64 Linux (`O_DIRECT` + `io_uring`): `selene --features test-support`
  (`514` lib + `1` `mixed_codec_root` integration passed, `0` warnings; also
  `cargo check --release` without `test-support`, `0` warnings), `selene-manager
  --features test-support --test client --test offload` (`85 + 2` passed, `0`
  warnings), `helios --features runtime-core,server --lib -- offload::
  runtime_core::memory::tests runtime_core::model::tests
  server::runtime::phase_tests` (`144` passed, `14` GPU-only ignored, `0`
  warnings in touched files, covering `NVIDIA#497` + `NVIDIA#589` small-SoC,
  `--memory-limit`, and degraded-disk restore-only pool coexistence), and
  `pytest tests/preparation/test_core_boundary.py
  tests/test_design_review_hook.py` (`22` passed).
- Prior SM121 GPU unit and live checks (at `cd5a366b`, `--lossless-kv-compression
  off`): `helios` `offload::` (`FLARE_RUN_CUDA_TESTS=1 --include-ignored`, `21`
  single-GPU SM121 tests passed; `split_pools` requires 2 local GPUs);
  corrupting a multi-page `.ckpt` payload on `Qwen3.8-27B-NVFP4` incremented
  `fetch_failed_total` (`1`), launched `0` `restore` graphs, and recomputed
  identical `top-5 logprobs` and tokens; under `--prefix-cache-disk-limit 6G`
  (`4` concurrent restores + `3` fresh `30K` stores), disk bytes peaked at
  `6.38 GB` (`<= 6 GiB`) and settled at `6.37 GB` with `0` `retry_abandoned`
  and `0` `io_error` drops (`2` normal `end_of_chain` evictions); four
  concurrent decode streams spilling checkpoints over 30 s on
  `Qwen3.8-Flash-Next` had `0` errors (`100.0 -> 95.9 tok/s`).
- Not covered: live `--lossless-kv-compression` (`cpu`/`gpu`) serving,
  post-rebase SM121 `flare run` re-measurement, live Jetson Orin GA10B /
  `--memory-limit` GPU serving, isolated `50 us` `Worker::idle_wait` A/B,
  `NVIDIA#496 + NVIDIA#497` combined serving, multi-host RoCE serving, 2-GPU `split_pools`,
  discrete PCIe GPUs, Windows serving, and live warm-plus-disk
  (`--prefix-cache-memory > 0`) or `PooledStore` HTTP serving (`CompositeStore`
  + `DiskStore` CUDA transfers were covered at `cd5a366b` in `helios`
  `offload::`).

Discord: Dooner

Design-Signed-Off-By: Antigravity (Gemini 4); design-review=c3a9
Signed-off-by: FujitsuPolycom <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants