Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/cli-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ Help exits with status 0; usage errors go to stderr with status 2. Its options a
| `--kv-cache-limit concurrency\|context\|memory` | Bound shared KV history by prepared context times selected concurrency, one prepared context, or available memory | `memory` |
| `--memory-limit LIMIT` | Per-GPU occupied size (`30G`), free-memory reserve (`-30G`, including `-0G`), or fraction of total memory (`0.8`) | `[memory] reserve`, otherwise core serving reserve |
| `--pool-vram-memory LIMIT` | Per-GPU ceiling for runtime-sized `Capacity::DEVICE_POOL` allocations on cores declaring async transfer pools: nonnegative size (`0`, `12G`), free-memory reserve (`-8G`), or fraction of total GPU memory (`0.25`); ignored on cores without `DEVICE_POOL` allocations | `[memory] pool_vram`, otherwise available VRAM above minimum KV reserve |
| `--pool-ram-memory LIMIT` | Per-rank ceiling for runtime-sized pinned `AsyncTransfer` host pools on cores declaring `Execution.async_transfers`: nonnegative size (`0`, `32G`), free-memory reserve (`-16G`), or fraction of total host RAM (`0.5`); ignored on cores without async transfer channels | `[memory] pool_ram`, otherwise available host RAM |
| `--pool-ram-memory LIMIT` | Per-host ceiling for runtime-sized pinned `AsyncTransfer` host pools on cores declaring `Execution.async_transfers` (divided evenly across local discrete ranks): nonnegative size (`0`, `32G`), free-memory reserve (`-16G`), or fraction of total host RAM (`0.5`); ignored on cores without async transfer channels | `[memory] pool_ram`, otherwise available host RAM |
| `--mtp-draft-tokens N` | Reduce the maximum draft count; zero selects ordinary execution without draft generation, absorption, or draft-state maintenance | Core default |
| `--mtp-adaptive-verification` / `--no-mtp-adaptive-verification` | Adaptive or fixed selection among captured widths | Core default |
| `--mtp-adaptive-verification-alpha ALPHA` | Positive finite exponent on completed prefix-survival scheduling scores; below 1 favors longer verification prefixes | `1.0` |
Expand Down Expand Up @@ -1415,7 +1415,7 @@ max_concurrency = 4
[memory]
reserve = "0" # GPU memory left for processes started later.
# pool_vram = "" # Per-GPU ceiling for Capacity::DEVICE_POOL allocations (0, 12G, -8G, 0.25).
# pool_ram = "" # Per-rank ceiling for pinned AsyncTransfer host pools (0, 32G, -16G, 0.5).
# pool_ram = "" # Per-host ceiling for pinned AsyncTransfer host pools, divided across local discrete ranks (0, 32G, -16G, 0.5).

[prefix_cache]
memory = "" # Warm checkpoints and CPU inputs; empty or 0: no warm tier. Intake is additional.
Expand Down
45 changes: 29 additions & 16 deletions docs/runtime-core-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,13 +729,17 @@ When a core declares `Capacity::DEVICE_POOL` allocations and
`Execution.async_transfers` channels, `NativeModel` rejects cores whose graphs
also contain Copy Engine `Memory::Peer` copy nodes at load time, preventing
unbounded Copy Engine deadlocks when in-graph demand transfers cannot yield to
`CopyEngineGate`. During `allocate_caches`, discrete-GPU ranks reserve host RAM
`CopyEngineGate`. During `allocate_caches`, discrete-GPU ranks read host RAM
after subtracting planned prefix-cache offload and vision input windows
(`host_future`), reserve `pinned_bytes.div_ceil(512) + 256 MiB` of VRAM per
rank for `cuMemHostRegister_v2` GPU MMU page tables and worker streams
(covering each channel's planned pinned `HOST_POOL` and bounded internal bounce
pool, which is disabled when channel alignment exceeds 32 MiB), and deduct the
pinned host reservation from prefix-cache capture growth. On integrated
(`host_future`, omitting Selene's implicit host reserve when `--pool-ram-memory`
is explicitly configured), apply `--pool-ram-memory` host-wide before dividing
across local discrete ranks, reserve
`pinned_bytes.saturating_mul(discrete_ranks).div_ceil(512) + 256 MiB` of VRAM
per rank for aggregate multi-rank UVA `cuMemHostRegister_v2` GPU MMU page tables
and worker streams (covering each channel's planned pinned `HOST_POOL` and
bounded internal bounce pool, which is disabled when channel alignment exceeds
32 MiB), and deduct the pinned host reservation from prefix-cache capture
growth. On integrated
unified-DRAM GPUs (such as GB10 and Jetson), `HOST_POOL`, `bounce_pool`,
`DEVICE_POOL`, and KV caches draw from the same physical DRAM: `HOST_POOL`
defaults to zero unless `--pool-ram-memory` is explicitly configured, explicit
Expand All @@ -753,16 +757,25 @@ and opens the 4 KiB-aligned `RankBody.external_extents` payload segments
directly (`O_DIRECT` on Linux), allocates each channel's runtime-sized pinned
`HOST_POOL` (clamped to the planned per-rank host ceiling from
`allocate_caches`, with an internal pinned bounce pool when enabled), writes
immutable startup geometry into the mapped-host `ControlHeader`, and blocks in
`start()` until each channel worker binds its CUDA context, allocates its event
pool, and publishes `ControlHeader.worker_state = Running` before executing
`Execution.tuning_graphs`. All device completion writes serialize on the
channel's single Copy Engine stream, host completion mirrors advance
monotonically via `fetch_max`, and storage or CUDA transfer failures publish
the bit-63 fault sentinel (`COMPLETION_ERROR_BIT | error_code`) rather than the
caller's requested success cookie. Partial DMA submission failures after
`cuMemcpyHtoDAsync_v2` retain their in-flight and bounce-slot ownership until
hardware stream drain is confirmed. Shutdown stops and drains all async
immutable startup geometry into the mapped-host `ControlHeader`, and starts all
rank workers concurrently, blocking in `start()` until each channel worker binds
its CUDA context, initializes its worker-owned `io_uring` ring (`SINGLE_ISSUER`
and `DEFER_TASKRUN` with fixed-buffer `ReadFixed` registration on Linux when
supported), creates its high-priority demand H2D, normal-priority background
H2D, and normal-priority D2H Copy Engine streams plus event pool, and publishes
`ControlHeader.worker_state = Running` before executing
`Execution.tuning_graphs`. Demand H2D, background H2D, and D2H transfers
execute on separate non-blocking Copy Engine streams (with `cuStreamWaitEvent`
serializing cross-stream reuse of the same completion slot). Both
`device_completions` and host completion mirrors enforce per-slot lifetime
monotonic non-regression (host mirrors via atomic `fetch_max`;
`device_completions` by skipping writes smaller than the highest value already
queued for that slot), so priority-preempted transfers cannot regress a slot
and bit-63 fault sentinels (`COMPLETION_ERROR_BIT | error_code`, published on
storage or CUDA transfer failures instead of the caller's requested success
cookie) remain sticky on both host and device completion slots. Partial DMA submission
failures after `cuMemcpyHtoDAsync_v2` or `cuMemcpyDtoHAsync_v2` retain their
in-flight and bounce-slot ownership until hardware stream drain is confirmed. Shutdown stops and drains all async
transfer channels after compute streams drain (bounding Linux `io_uring` waits
with a kernel timespec), invalidates mapped-host control telemetry before
unmapping device or mapped-host storage, and on unconfirmed drain transitions
Expand Down
30 changes: 20 additions & 10 deletions helios/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ runtime-sized `Capacity::DEVICE_POOL` allocations and authenticated
graphs to a stateless, domain-agnostic host transfer worker that copies
4 KiB-aligned read-only extents from core storage (`O_DIRECT` + `io_uring` on
Linux, `pread` elsewhere) through an optional runtime-sized pinned host byte
pool (`HOST_POOL`) and a dedicated non-blocking CUDA Copy Engine stream into a
`Capacity::DEVICE_POOL` device byte pool (`DEVICE_POOL`).
pool (`HOST_POOL`) and dedicated non-blocking CUDA Copy Engine streams into and
out of a `Capacity::DEVICE_POOL` device byte pool (`DEVICE_POOL`).

Each `AsyncTransfer` entry declares:

Expand All @@ -187,27 +187,37 @@ Each `AsyncTransfer` entry declares:
completion words.
- `device_completions` (optional): 8-byte-aligned `Reference` inside a fixed
`Memory::Device` allocation holding `completion_slots` 64-bit completion
words written in stream order on the channel's single Copy Engine stream by
words written in stream order on the transfer's CUDA Copy Engine stream by
`cuStreamWriteValue64_v2` (when device attribute
`CU_DEVICE_ATTRIBUTE_CAN_USE_64_BIT_STREAM_MEM_OPS = 122` is supported) after
Copy Engine DMA completes, with monotonic `fetch_max` host completion mirrors
so deferred DMA mirrors cannot regress reused completion slots.
Copy Engine DMA completes (using `cuStreamWaitEvent` whenever different Copy
Engine streams reuse the same completion slot). Both `device_completions` and
host completion mirrors enforce per-slot lifetime monotonic non-regression
(host mirrors via atomic `fetch_max`; `device_completions` by skipping any
write smaller than the highest value already queued for that slot), so
priority-preempted transfers and deferred DMA mirrors cannot regress reused
completion slots and bit-63 fault sentinels are sticky once published.
- `max_host_pool_bytes`: optional ceiling on the channel's pinned host pool
(`0` disables the host pool).
- `alignment`: power-of-two direct-I/O and offset alignment (`>= 4096`).

Supported command opcodes are `DISK_TO_HOST` (`1`), `HOST_TO_DEV` (`2`),
`DISK_TO_DEV` (`3`, supporting either a caller host offset or sentinel
`u64::MAX` for internal pinned bounce staging when `host_pool_bytes == 0`), and
`CANCEL_EPOCH` (`4`). Priorities `DEMAND` (`0`), `PREFETCH` (`1`), and `WARM`
(`2`) feed a preemptible host queue with bounded background I/O and DMA depth;
`u64::MAX` for internal pinned bounce staging when `host_pool_bytes == 0`),
`CANCEL_EPOCH` (`4`), and `DEV_TO_HOST` (`5`, copying a byte range from
`DEVICE_POOL` back to `HOST_POOL` on a dedicated device-to-host Copy Engine
stream). Priorities `DEMAND` (`0`), `PREFETCH` (`1`), and `WARM`
(`2`) feed a preemptible host queue with bounded background I/O and DMA depth
(with demand H2D copies dispatched on a high-priority Copy Engine stream and
background H2D copies dispatched on a normal-priority Copy Engine stream);
`CANCEL_EPOCH` and `ControlHeader.active_epoch` drop queued non-demand commands
from older epochs while preserving `DEMAND`. Caller-supplied `signal_value`
cookies occupy the lower 63 bits (`(signal_value & (1 << 63)) == 0`); bit 63
(`COMPLETION_ERROR_BIT`) is reserved for fault sentinels
(`COMPLETION_ERROR_BIT | error_code`) emitted on `IoFailure` or `CudaFailure`
instead of the requested success value. Helios waits for each channel worker to
bind its CUDA context, create its event pool, and publish
bind its CUDA context, initialize its worker-owned I/O backend, create its Copy
Engine streams and event pool, and publish
`ControlHeader.worker_state = Running` before launching
`Execution.tuning_graphs` so startup tuning kernels read populated
`device_pool_bytes` and `host_pool_bytes` from `ControlHeader` and observe a
Expand All @@ -216,7 +226,7 @@ containing Copy Engine `Memory::Peer` copy nodes are rejected at load time,
because in-graph demand waits cannot serialize behind `CopyEngineGate` without
deadlocking the Copy Engine. Teardown drains serving streams, cancels queued
background transfers, drains in-flight storage I/O (bounded by a kernel timespec
on `io_uring`) and the Copy Engine stream within a bounded timeout, invalidates
on `io_uring`) and all Copy Engine streams within a bounded timeout, invalidates
mapped-host control telemetry before unmapping allocations, and retains pinned
host memory, storage handles, and CUDA handles until process exit if drain is
not confirmed.
Expand Down
Loading
Loading