#1 [high] Change: what the diff actually does (3 files, +196/−33)
PR #659 (head 16e2247, base main, author lukealonso), 3 files +196/-33. No comments/reviews yet, CI passed.
Core mechanism: null continuation row 0 (for models with sizing.capacity == 0 state_pool rows) previously got its own physical VMM allocation for its whole padded span (fixed_bytes = ceil(execution*row_bytes / align)*align, cache_memory.rs:157). Now the full leading granules of row 0 are each cuMemMapped onto ONE shared alignment-sized physical handle:
- cache_memory.rs:68-71
sentinel_saved_bytes(row_bytes, alignment) = (row_bytes/alignment).saturating_sub(1)*alignment - cache_memory.rs:259-267
Layout::sentinel_granules = row_bytes/row_alignmentwhen >1 else 0; carried throughpack_prefixes(cache_memory.rs:487). - cache_memory.rs:1416-1447 in
allocate_shared_cache: if sentinel_granules > 1, onemap_cache_chunk(alignment, mappings = [row.address + i*alignment for i in 0..sentinel_granules])(map_cache_chunk at cache_memory.rs:1500 maps one cuMemCreate handle at multiple addresses, original code already did multi-address for snapshot↔KV aliasing), then a separate handle for the remainingfixed_bytes - sentinel_bytestail (cache_memory.rs:1428-1437). - cache_memory.rs:1468-1488 zeroing: memset one granule + the tail instead of the whole fixed_bytes (row 0's aliased area reads as zeros from every granule).
- handle accounting: cache_memory.rs:81-102
handle_chargenow charges 1 sentinel handle + sentinel_granules*row_readers mappings, plus 1 handle + row_readers for the tail chunk when fixed_bytes > sentinel_bytes.
Planner side (memory.rs): new row_backing_bytes(core, units) (memory.rs:383-414) = padded span minus sentinel_saved_bytes when units>0; replaces bytes(core,0,execution) at memory.rs:486 (fixed footprint check), :510 (:523) fits/minimum-footprint binary search, :1003 (minimum cache footprint), :1249 (gpu_bytes reporting in NativeModel sizing loop). Virtual-span arithmetic deliberately kept on full bytes(core,0,...): memory.rs:576-579 (mapped = bytes(core,0,execution) + borrowed, cached-rows loop).
Docs: docs/runtime-core-design.md:770-779 documents the null-row sentinel aliasing and savings formula; :829-833 updates DCP16 RM-handle example 518,232 → 518,504 handles, headroom 6,056/1.2% → 5,784/1.1%.
#2 [high] Claim support: row zero never mutated is enforced in Ignition, not in Helios
The "row zero is never written" contract the aliasing relies on is enforced outside the runtime, in Ignition and the docs:
ignition/components/state.py:76-80StateStorage::allocaterequires null + live slots (slots >= 2), first row is the null state.ignition/components/state.py:190-197_save_hiddenwrites only whereslot > 0.ignition/components/state.py:229_request_historyrequiresrow > 0.ignition/components/state_transfer.py:78-80copy/restore/reset all requiresource/destination > 0and< SLOTS.docs/core-design.md:1497-1500: "The model state pool uses row zero for the null state", request slot s owns rows 1+sW, snapshot i owns row 1+CW+i.docs/design-review.md:80: "Published checkpoints are immutable; inactive rows perform no state mutation."helios/src/scheduler.rs:946-948snapshot_slot= 1 + max_activeexecution_rows + snapshot;helios/src/scheduler.rs:1753request slots = 1 + slotexecution_rows — allocations start at 1. So the description's premise is verified in tree. Caveat: the aliasing makes row zero writable and observable through other offsets only if something writes it. No runtime-side guard exists in Helios that would reject a write to row 0 (norow == 0check inhelios/src/offload/transfer.rs; it only bounds-checksindex >= geometry.row_capacity, transfer.rs:156-163).
#3 [high] Related work: change spends the mapping-handle headroom #391 established
Verified by hand from the diff: for the DCP16 fixture (row_bytes 35,122,432, alignment 2 MiB → 16 sentinel granules, handle_charge(1, &readers) so row_readers = 1), old per-rank fixed charge = 1+1 = 2; new = (1 + 16*1) + (1 + 1) = 19, i.e. +17 per rank, ×16 ranks = +272 → 518,232 + 272 = 518,504, exactly the value in helios/src/runtime_core/cache_memory.rs:819,833 and docs/runtime-core-design.md:832. The PR body's "272 extra handles" is not stated but the docs update is arithmetically consistent.
Consequence: this change consumes headroom that #391 (merged) created and documented. docs/runtime-core-design.md:829-833 now reads 5,784 handles / 1.1% (was 6,056 / 1.2%). In #391 the reviewer (yatesdr) made handle margin a blocking topic (review 2026-11-19, item 2: "no margin for the other driver objects ... state the margin the estimate needs"), so the margin shrinking is a live reviewer concern.
Cost scales with row readers: handle_charge charges sentinel_granules * row_readers mappings (cache_memory.rs:84-98), so a peer-read row plane costs up to 39 × readers mappings per rank (e.g. 16 readers → 624 extra mappings/rank) — this is the mechanism that makes the memory saving cost handles. Net effect on layouts near the 524,288 RM limit is negative.
#4 [high] Claims and evidence: tests added, updated, and one GPU assertion weakened
Tests changed by the PR:
- NEW CPU
cache_memory::tests::sentinel_row_aliases_full_granules_onto_one_page(cache_memory.rs:1366-1385): asserts saved = 38 granules for 82,143,488 B at 2 MiB, 0 for one granule and for row_bytes < alignment,sentinel_granules == 39,fixed_bytes == 158 MiB, and the exact handle charge(1+39)+2+base_chunks. - NEW CPU
memory::tests::sentinel_row_savings_increase_kv_page_capacity(memory.rs:2030-2049):bytes(core,0,2) = 158 MiBvsrow_backing_bytes(core,2) = 82 MiB, and page capacity ≈(900 MiB - 82 MiB)/page_bytes(within 1 page). - Updated handle counts in
full_size_dcp16_cache_preserves_each_admissible_kv_prefix(cache_memory.rs:818-834): 494,576→494,848 and 647,544→647,816 canonical, target 518,232→518,504. - CHANGED GPU test
cuda_aliases_preserve_rows_while_unowned_pages_are_rewritten(cache_memory.rs:1210-1280): row 0 is now expected to be all zeros and is excluded from the distinct-pattern upload loop (.skip(1)at :1226), so it no longer verifies row 0 has distinct backing. Row 0 is still re-read and asserted equal to zeros in the verification loop at :1263 ((0..3).chain(3+released..7)includes row 0). Net: the GPU test now asserts zero-preservation for row 0, not distinct backing — a genuine reduction in what that test covers, and the test is not run in this PR. - Author states:
cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib runtime_core::→ 191 passed, 0 failed, 11 ignored, on a747a5a5. Not independently runnable here. Not run per the description: all CUDA-device VMM tests (including the modified one) and live GPU serving, because "all local GPUs were occupied".
#5 [high] Related work: #473, #391, #286 are the direct ancestors of the touched code
Predecessor work in the exact same mechanism, all merged on main:
- #473 (original-el8, merged 2026-11-25) "Fix KV plane granule padding conflicts and optimize two-row snapshot selection": added the
plane_bytesclamp inChunk::record_conflicts(cache_memory.rs:47-54) and theu32::MAX..0 -> 0..0sentinel normalization at cache_memory.rs:252-258 that this PR's aliasing depends on; also introduced the term "sentinel entry" for unbacked alias ranges. Author states GPU VMM testcuda_aliases_preserve_rows_while_unowned_pages_are_rewrittenwas not run there either (CPU only). #473 is the source of the code this PR modifies in that test. - #391 (voipmonitor, merged 2026-11-21) "Fit native KV backing to the Linux GPU mapping handle range": created
handle_charge,RM_HANDLE_RANGE = 524,288,plan_mapping_handlesand the DCP16 fixture assertions this PR re-baselines (518,232 → 518,504). - #286 (voipmonitor, merged) "Fix native peer-access OOM without reducing cache capacity": introduced/refined the multi-address
cuMemMapsnapshot aliasing and reader-permission model the PR reuses (map_cache_chunkmulti-mapping,peer_readers,grant_storage_access). - #504 (yatesdr, merged 2026-11-25) KV compression pipeline touches the same three files; #492/#486/#477/#436 (closed/merged, yatesdr) same files. No open PR competes with #659; no issue asks for this specific null-row saving (searches for "row zero", "null row", "state_pool" return only this PR).
#6 [high] Research summary
Case file for PR #659 (perf(helios): alias null continuation row zero onto a single zeroed VMM granule), head 16e2247, base main, 3 files +196/−33, opened and last updated 2026-12-01, no comments or reviews, CI passed on head. Findings are in scratchpad entries 1–5 (change, claims/evidence, related work, row-zero contract, handle arithmetic).
What it does (verified from the diff). Layout gains sentinel_granules = row_bytes/row_alignment when >1 (cache_memory.rs:259-267) and sentinel_saved_bytes (cache_memory.rs:68-71); allocate_shared_cache now maps row 0's leading full granules onto one shared alignment handle via N cuMemMap calls on a single cuMemCreate handle, backs the sub-granule tail separately, and zeroes one granule plus the tail instead of the whole span (cache_memory.rs:1416-1488). Planning switches from bytes(core,0,units) to a new row_backing_bytes (memory.rs:383-414) in four places — fixed/minimum footprint checks and the KV page search (memory.rs:486, 510, 523, 1003) and gpu_bytes reporting (memory.rs:1249) — while virtual-span arithmetic stays on full bytes (memory.rs:576-579). Docs get a new paragraph (runtime-core-design.md:772-780) and a re-baselined RM-handle example (518,232→518,504; 6,056/1.2%→5,784/1.1%, runtime-core-design.md:829-833). I found nothing the description omits materially, and nothing it claims that the code does not do; the one undeclared side effect is the handle cost (below).
The thing a reader cannot get from the description. The saving is paid for in mapping handles: handle_charge now charges sentinel_granules * row_readers mappings plus a handle (cache_memory.rs:82-98). For the DCP16 fixture that is +17 per rank, +272 across 16 ranks — the exact 518,232→518,504 in the updated test and docs. So this PR spends the 1.2% headroom that #391 (voipmonitor, merged 2026-11-21) created and whose margin yatesdr made a blocking review topic in #391 ("no margin for the other driver objects … state the margin the estimate needs"). Cost scales with readers, so a 16-reader row plane costs up to 39×16 = 624 extra mappings per rank; layouts already near the 524,288 RM limit move toward failure while low-reader single-rank cases win VRAM. The description says nothing about this trade-off.
Row-zero contract. The premise is verifiable in tree but enforced outside Helios: ignition/components/state.py:76-80, 190-197, 229, ignition/components/state_transfer.py:78-80, docs/core-design.md:1497-1500, docs/design-review.md:80, and Helios allocations starting at row 1 (helios/src/scheduler.rs:946-948, 1753). Helios itself has no guard rejecting a write to row 0 — helios/src/offload/transfer.rs:156-163 only bounds-checks against row_capacity — so "inactive lanes don't mutate row zero" is a cross-component assumption, not a runtime-checked invariant. The description states this as a limitation.
Evidence. Two new CPU tests (cache_memory.rs:1366-1385; memory.rs:2030-2049) pin the formula, granularity edge cases, and the 158 MiB→82 MiB / KV-page-gain claim; handle-count expectations re-baselined at cache_memory.rs:818-834. Author reports 191 passed / 0 failed / 11 ignored for runtime_core:: on a747a5a5. The GPU test cuda_aliases_preserve_rows_while_unowned_pages_are_rewritten is weakened: row 0 is excluded from the distinct-pattern upload (.skip(1), cache_memory.rs:1226) and now only checked for staying zero — and it was not run (author: all local GPUs occupied), as with #473 and #391 before it.
Related work and recent activity. The touched mechanism is a chain of merged work: #286 (multi-address cuMemMap snapshot aliasing, peer readers), #391 (handle_charge, RM_HANDLE_RANGE, plan_mapping_handles, the DCP16 fixture this PR re-baselines), #473 (original-el8 — the plane_bytes clamp and u32::MAX..0→0..0 sentinel normalization the aliasing depends on, plus the GPU test this PR edits), #504/#492/#486/#477/#436 (yatesdr, same three files). No open PR competes, and no issue asks for this specific saving; searches for row-zero/null-row VRAM returns only this PR. Adjacent but not a fix: #517 (closed, Xid 31 in _checkpoint_pages), whose root cause turned out to be int32 page arithmetic in a recipe, not row allocation.
People, community, process. Author lukealonso is a priority contributor per the charter with 35 merged PRs in 180 days and is one of the two dominant committers in helios/src and docs (234 and 389 commits); reviewers in this area are yatesdr and, historically, voipmonitor/original-el8. No engagement yet on this PR. Charter fit is good on "measured memory issue" and model-agnosticism (the change is in shared planning code, no per-model branch), and the description follows the required four-part scheme with a Discord line. Process gaps worth noting: the description explicitly discloses unrun CUDA/VMM checks, while docs/design-review.md:247-251 says disclosure of skipped runnable CPU checks blocks acceptance and GPU-layer checks are mandatory per the testing hierarchy — the author treats GPU VMM checks as unrunnable due to hardware contention, the same position accepted in #391 and #473. No Design-Signed-Off-By/Signed-off-by verification was possible for the single commit 16e22476.
#7 [high] People: author standing and who works these files
Author: lukealonso, COLLABORATOR, named in docs/design-review.md:42 (charter "Respect contributors") as a priority contributor (@voipmonitor, @original-el8, @lukealonso) whose PRs "we never close out of hand as low value".
- 35 merged PRs in the last 180 days, 2 open (#658, #657 opened 2026-12-01, same day as #659). Areas: helios/src (25), docs (21), ignition/preparation (10).
- Recent merged work by the same author in adjacent code: #656 (conditional speculative acceptance), #645 (prefill scheduling overhaul), #646 (GB10 page-cache KV sizing), #647, #652, #619, #620, #618, #613.
- Commit dominance on the touched areas: helios/src last 180 days — Luke Alonso 234, Martin Vit 52, yatesdr 48; docs — Luke Alonso 389, Martin Vit 55, yatesdr 48. So the author is the main committer of the files under review.
- Reviewers/history in these exact files: voipmonitor (author of #391 and #286, the handle-count and peer-access work this builds on), original-el8 (author of #473, the granule-padding/sentinel normalization this depends on), yatesdr (reviewer of #391 who filed CHANGES_REQUESTED twice; also author of the KV-compression PRs #504/#492/#486 in the same files). yatesdr is the reviewer most likely to scrutinise handle margin and qualification scope.
- No comments, reviews or reactions on #659 as of 2026-12-01 (pr_comments returned "No comments"). The only intake is flare-autobot on other PRs; none here.
#8 [high] Process and project fit: charter, testing hierarchy, PR state
PR state: open, "ready for review", opened 2026-12-01, last updated 2026-12-01, single commit 16e22476, CI passed on head. No reviews, no labels. Files: docs/runtime-core-design.md (+8/−3), helios/src/runtime_core/cache_memory.rs (+122/−23), helios/src/runtime_core/memory.rs (+66/−7).
Charter fit (read_charter):
- Line 12 "Keep the runtime small and model-agnostic" — satisfied: the change lives in shared layout/planning code (
Layout,handle_charge,row_backing_bytes), keys offsizing.capacity == 0and alignment, no per-model branch, nosupports_*flag. No new recipe/alias/format. - Line 35 "What gets merged: … a measured performance/memory issue" — the PR is a memory-reclaim claim with unit-test-backed arithmetic but no live serving measurement (no VRAM reading from a real load). Compare docs/design-review.md:106-115 (principle 12: performance claims need equivalent baselines and actual Helios service measurements) — for a memory-reduction claim rather than a speedup, the equivalent evidence would be a startup/
flare inspect --memory-mapdelta on a real model, which is not provided. - Line 42 "Supported matrix & compatibility: … verify that existing data, artifacts, and exported cores still load" — the change is runtime-only, no core/wire/Protobuf/CLI/metric schema change (description says so; verified: no format.rs/protobuf/describe changes in the diff), so already-exported cores are unaffected in format, but their planned cache capacities will shift upward.
- No roadmap item mentions this (#6, #267, #215).
Design-review rules touched:
- docs/design-review.md:180-190 (layer 1) requires crate CPU tests; author ran
helios --features runtime-core,server --lib runtime_core::— 191 passed, 0 failed, 11 ignored — and reports it. Satisfied. - docs/design-review.md:247-251 "Disclosure does not excuse skipping runnable CPU checks"; GPU-layer checks are governed by principles 12/13 and the verification table (docs/verification.md:14: CUDA ordering / mapped-state / resource lifetimes need real execution tests on assigned GPUs). The PR discloses CUDA VMM tests and live serving unrun "because all local GPUs were occupied". The same disclosure was accepted in #473 and #391, both merged, so precedent exists — but by the letter of the doc the VMM mapping test for aliasing is a GPU-layer check.
- docs/design-review.md:151-160 (principle 16, description scheme) — PR description follows why/what/benefit/evidence order with before/after and a limitations section. Satisfied.
- docs/design-review.md:163-169 (principle 17, Discord line) — present: "Discord: lukealonso". Satisfied.
- .githooks/commit-msg:15-63 requires exactly one
Design-Signed-Off-By: <name>; design-review=<sha256[:4]>trailer matching the staged docs/design-review.md. Could not verify the trailer on 16e22476 through the available tools; worth a maintainer check since #391 had a blocking review item for a missing trailer.
#9 [medium] Reach: who and what the change affects, and the docs' own qualification scope
Affected population (from code + docs, not measured):
- Only models with continuation-state storage (
sizing.capacity == 0, e.g. GDN/Mamba/hybrid recipes) whose continuation row spans ≥2 VMM granules (row_bytes >= 2*alignment, per docs/runtime-core-design.md:773-778). At 2 MiB granularity that is roughly row_bytes ≥ 4 MiB; the PR cites 35 MiB rows (32 MiB saved) and 82 MiB rows (76 MiB saved, test row_bytes 82,143,488 → 39 granules, 38 saved). - Pure KV models are unaffected (
sentinel_granules = 0), and so are models withrow_bytes < 2*alignment. Verified: both branches at cache_memory.rs:1417 and 1468 fall through to the old single-handle path, androw_backing_bytessubtracts 0. - No core re-export, no Protobuf/CLI/Prometheus change, no new flag or config knob; already-prepared cores load and serve.
Capacity shift: because row_backing_bytes feeds capacities (memory.rs:486-531, 1003) and the KV-page search, identical hardware and flags will now plan more KV pages (and more snapshot rows) than before. sentinel_row_savings_increase_kv_page_capacity (memory.rs:2030-2049) shows 82 MiB rather than 158 MiB for 2 rows and a corresponding page gain under a 900 MiB budget. Consequence for operators: planned rows/pages (uploaded as memory_capacity at memory.rs:1318-1330) change between engine versions on the same model — documented as intended in docs/runtime-core-design.md:772-780, but it means a memory-limit that previously errored can now succeed and a previously tight budget now plans more.
Also note the doc's own caveat at docs/runtime-core-design.md:840-845: prefix-compacted placement is qualified only on sixteen RTX PRO 6000 Blackwell GPUs with driver 615.71.10 (Kimi K3.1 Pro TP16 DCP8/DCP16), and wide-group compaction is CPU-unit-tested only — the DCP16 handle numbers this PR re-baselines inherit that same narrow qualification.
Deployment: no effect on multi-host agreement (docs/runtime-core-design.md:835-838 — page/row counts unchanged in shape, canonical layout retained), and local_handle_limit still gates compaction to single-host Linux (cache_memory.rs:499-501).
#10 [medium] Related work: #517 is adjacent (continuation rows) but not the motivation; recent file history
#517 (jcartu, closed 2026-11-28) "Xid 31 in _checkpoint_pages … rank-0 fault addresses map to continuation rows 3,216–3,224" looks like a motivation for touching continuation-row backing, but it is not: the root cause was established as signed-32-bit page * 16,384 overflow in a recipe kernel (local-inference-lab/hyperflare-recipes#45), fixed by a tl.int64 correction plus re-export of affected Qwen3.8 cores. Row allocations were never wrong; the issue itself corrects that reading. It is relevant only as evidence that continuation-row address arithmetic has produced expensive production faults, and as prior art for the "guard the final byte range" discussion. Related closed PR #520 ("Assert snapshot slots reaching device transfer commands stay in the planned range") is in the same family.
#504 (yatesdr, merged 2026-11-25) touches all three files (#659's files) with the KV-compression pipeline; #492/#486/#477/#436 (yatesdr) same files, closed/merged. These are the most recent prior changes to cache_memory.rs/memory.rs other than #473/#391/#286 and do not overlap the null-row path.
Recent commits to helios/src/runtime_core/cache_memory.rs (pr/659 history): 16e22476 (this PR), 6d74db3a "Fix Rust compiler warnings…" (Luke Alonso, 2026-11-26), 716df00f #504, 7b04dd1e #473, 110e1409 #391, b003ebf5 "Remove cache peer-access memory diagnostics" (Luke Alonso, 2026-11-14), d7a20816 #286. So the layout code has changed three times in ten days by three different authors (#473 original-el8 2026-11-25, #391 voipmonitor 2026-11-21, #504 yatesdr 2026-11-25) — a fast-moving area, and this PR re-baselines assertions those authors wrote. Default-branch commit after the PR branched that touches these files: 1da22724 (#652, Luke Alonso, docs/runtime-core-design.md) — docs only, no conflict expected with the two doc hunks at :770 and :829.