Case file — PR #659 perf(helios): alias null continuation row zero onto a single zeroed VMM granule
Repo: NVIDIA/hyperflare-inference · head 16e2247 (single commit) · base main (branched at a747a5a) · 3 files, +196 / −33 · opened and last updated 2026-12-01 · open, "ready for review" · CI passed on head · no reviews, no labels, no comments.
Key findings
- The change is real and consistent with its description, and its arithmetic checks out by hand. Row zero of a continuation-state model's state pool is now backed by one shared
2 MiBphysical granule mapped at every full leading granule offset, with a separately backed partial tail:sentinel_saved_bytesathelios/src/runtime_core/cache_memory.rs:68-71,Layout::sentinel_granulesatcache_memory.rs:259-267, the multi-addressmap_cache_chunkcall atcache_memory.rs:1416-1437, and the reduced zeroing atcache_memory.rs:1467-1488. Virtual spans are deliberately untouched. - The description omits the price of the saving: mapping handles.
handle_chargenow charges1 + sentinel_granules * row_readersplus a handle for the tail (cache_memory.rs:81-102). For the DCP16 fixture (16 granules, 1 row reader per rank) that is2 → 19per rank,+17 × 16 = +272, which is exactly the518,232 → 518,504in the updated assertion (cache_memory.rs:818-834) and indocs/runtime-core-design.md:829-833. The cost scales with readers — a 16-reader row plane costs up to39 × 16 = 624extra mappings per rank — so this PR spends the headroom that #391 created and documented (headroom drops from6,056 / 1.2%to5,784 / 1.1%), and handle margin was a blocking review topic in #391. - A GPU test's coverage is reduced, and it was not run.
cuda_aliases_preserve_rows_while_unowned_pages_are_rewrittenpreviously verified row zero had distinct backing; row 0 is now excluded from the distinct-pattern upload (.skip(1),cache_memory.rs:1226) and only asserted to stay zero (cache_memory.rs:1210-1211). It is one of the CUDA-device VMM tests the author explicitly did not run ("all local GPUs were occupied"). - The premise — "nothing writes row zero" — is enforced outside Helios. It is enforced in Ignition (
ignition/components/state.py:76-80, 190-197, 229;ignition/components/state_transfer.py:78-80), documented (docs/core-design.md:1497-1500,docs/design-review.md:80), and reflected in allocation 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-163only bounds-checks againstrow_capacity. The author states this as a limitation. - Evidence is CPU-unit-test only; the memory-reclaim claim has no live measurement. Two new CPU tests pin the formula (
cache_memory.rs:1366-1385) and the capacity gain (memory.rs:2030-2049); the author reports191 passed, 0 failed, 11 ignoredfor--lib runtime_core::ona747a5a5. No VRAM reading from a real model load is given. - Good project fit on charter grounds, with precedent for the disclosure position. It is a memory issue fixed in shared planning code with no per-model branch (charter "Keep the runtime small and model-agnostic"), and it is runtime-only: no core/Protobuf/CLI/metric change, so exported cores still load — but planned cache capacities shift upward on the same hardware.
The change
Plain terms. For models whose continuation state lives in a state pool (sizing.capacity == 0), the pool's row zero is a permanent null row that is never handed to a request or a snapshot. Previously its whole padded span was backed by its own physical device memory (fixed_bytes = ceil(execution * row_bytes / alignment) * alignment, cache_memory.rs:157). On a 35 MiB or 82 MiB row that is tens of MiB of VRAM per rank holding zeros.
Now allocate_shared_cache creates one alignment-sized physical handle and cuMemMaps it at each of row zero's floor(row_bytes / alignment) leading granule offsets (cache_memory.rs:1417-1427); the remainder fixed_bytes - sentinel_bytes gets its own handle (cache_memory.rs:1428-1437), and only one granule plus that tail are zeroed (cache_memory.rs:1468-1482) instead of the full span. The fall-through paths for sentinel_granules <= 1 are the old single-handle behaviour (cache_memory.rs:1438-1447, 1483-1488). map_cache_chunk already supported mapping one handle at several addresses for snapshot↔KV aliasing, so this reuses an existing mechanism rather than adding one.
Planner side. row_backing_bytes(core, units) (memory.rs:383-414) computes the padded span minus sentinel_saved_bytes(s.unit_bytes, align) when units > 0, and replaces bytes(core, 0, execution) in the fixed-footprint check (memory.rs:486), the fits/minimum-footprint search (memory.rs:510, :523), the minimum cache footprint (memory.rs:1003) and gpu_bytes reporting (memory.rs:1249). Virtual-span arithmetic is deliberately left on full bytes(core, 0, ...) — mapped = bytes(core, 0, execution) + borrowed (per research notes, memory.rs:576-579).
Anything the description does not say. Only the handle cost (Key finding 2). Nothing in the description overclaims: the described tail handling, virtual-span preservation, zeroing change, handle arithmetic and the two test updates are all present in the diff. No format.rs, Protobuf, CLI or metric schema file is touched (file list: docs/runtime-core-design.md, helios/src/runtime_core/cache_memory.rs, helios/src/runtime_core/memory.rs), matching the compatibility claim.
The why
- The problem is a VRAM waste specific to continuation-state models (GDN, Mamba, hybrid recipes): rows are large enough to cross many
2 MiBVMM granules (35,122,432 B→ 16 granules;82,143,488 B→ 39 granules,cache_memory.rs:1369, 1375), and all of that was allocated to hold zeros. - No issue asks for this. Searches for "row zero", "null row", "state_pool" / row-zero VRAM return only this PR; there is no linked issue, bug report or roadmap item. It reads as an opportunistic optimisation by the author who owns this code, not a response to a filed complaint.
- Age/wideness: brand new (opened 2026-12-01), so there is no long-running demand behind it.
- Charter hook: "What gets merged: … a measured performance/memory issue" — the class of change fits, but see evidence quality below.
Related work
- #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 (cache_memory.rs:818-834; docs exampledocs/runtime-core-design.md:782-833). This PR lives inside that budget and consumes part of its margin; yatesdr's review in #391 made handle margin a blocking item ("no margin for the other driver objects … state the margin the estimate needs"). - #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-range normalization (cache_memory.rs:252-258) that this aliasing runs alongside; it is also the source of the GPU test this PR weakens, and it too merged without running that GPU test. - #286 (voipmonitor, merged) "Fix native peer-access OOM without reducing cache capacity" — introduced the multi-address
cuMemMapsnapshot aliasing,peer_readersandgrant_storage_accessmodel reused here (map_cache_chunkatcache_memory.rs:1500). - #504 (yatesdr, merged 2026-11-25) KV-compression pipeline, plus #492/#486/#477/#436 — most recent prior changes to the same files; no overlap with the null-row path. File history:
16e22476(this PR),6d74db3a,716df00f(#504),7b04dd1e(#473),110e1409(#391),b003ebf5,d7a20816(#286) — three different authors in ten days, and this PR re-baselines assertions those authors wrote. - #517 (jcartu, closed 2026-11-28) Xid 31 in
_checkpoint_pageslooks like motivation for touching continuation-row backing but is not: the root cause was signed-int32page * 16,384overflow in a recipe kernel (local-inference-lab/hyperflare-recipes#45), fixed with atl.int64correction and re-export; row allocation was never wrong. Relevant only as evidence that continuation-row address arithmetic has produced expensive production faults. Related closed PR #520 (assert snapshot slots stay in the planned range) is in the same family. - No open PR competes with, stacks on, or is superseded by #659. Nothing in the tree is undone by it.
Recent activity
- On main, the areas just moved fast and by several hands: #391 (handle budget, 2026-11-21), #473 (granule padding/sentinel ranges, 2026-11-25), #504 (KV compression, 2026-11-25),
6d74db3acompiler-warning cleanup (2026-11-26) — then this PR, which builds on all three rather than conflicting with them. - Only one default-branch commit since the branch point touches a changed file:
1da22724(#652, Luke Alonso) ondocs/runtime-core-design.md, and it is docs-only, so the two doc hunks (:770-780,:829-833) are not in a live conflict. - Broader helios/src churn in the last 60 days is dominated by the same author (#656, #645, #646, #647, #628, #644), i.e. this PR is a continuation of the author's own memory/scheduling series rather than a reversal of anyone else's work.
People
- Author: lukealonso, COLLABORATOR. The project charter's "Respect contributors" rule names him among priority contributors (
@voipmonitor,@original-el8,@lukealonso; issue #229) and says their PRs are never closed out of hand as low value. 35 merged PRs in 180 days, 2 open on the same day (#657, #658). Areas:helios/src(25),docs(21),ignition/preparation(10). Recent adjacent work: #656, #645, #646, #647, #652. - Ownership of the files: in
helios/srcover 180 days the commit split is Luke Alonso 234, Martin Vit 52, yatesdr 48; indocs, Luke Alonso 389, Martin Vit 55, yatesdr 48. The author is the dominant committer of the code under review. - Who else works here: voipmonitor (#391, #286 — the handle budget and peer-access aliasing), original-el8 (#473 — granule padding/sentinel ranges), yatesdr (#504/#492/#486 plus the #391 reviewer who requested changes twice). yatesdr is the most likely scrutineer of handle margin and of the qualification scope.
- Engagement so far: none. No comments, reviews, reactions, or flare-autobot intake on this PR.
Community
Nothing found: pr_comments returned no comments; the orientation packet records no reviews and no labels. The only signal is CI passing on the head commit. Zero community interest recorded as of 2026-12-01 — expected for a same-day PR by the code's main author.
Project fit
- Charter, where it lines up: "Keep the runtime small and model-agnostic" (Helios handles caches; no per-model branches) — satisfied: the change keys off
sizing.capacity == 0and alignment in sharedLayout/planning code, with no recipe, alias, format, or flag. "What gets merged: … a measured performance/memory issue" — the class matches, but the measurement is arithmetic plus unit tests, not a served workload. Review standards also ask for checking interactions across models, cache schemes, parallel layouts and hardware, and that existing cores still load — the runtime-only nature keeps loading intact, while the planned capacity changes (see Reach). - Charter, where it may not: "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over main on a served workload" — this is a memory reduction, not a speedup, and no baseline/after VRAM or
flare inspect --memory-mapdelta from a real model is provided.docs/design-review.md:106-115(principle 12) requires that performance claims come with equivalent baselines and actual Helios service measurements, and that unrun checks be disclosed. - Design-review rules the PR touches:
docs/design-review.md:180-190(layer 1 crate CPU tests) — satisfied and reported.docs/design-review.md:247-251— "Disclosure does not excuse skipping runnable CPU checks … noting it as a limitation does not make the omission acceptable"; the skipped checks here are CUDA-device VMM tests and live serving, i.e. the GPU layer governed by principle 12 and the verification table, and the author's stated reason is hardware contention. Precedent exists: #391 and #473 both merged with the same VMM GPU tests unrun.docs/design-review.md:151-169(four-part description with why/what/result/evidence, plus a Discord line "Discord: lukealonso") — satisfied. - Commit trailer:
.githooks/commit-msg:15-63requires oneDesign-Signed-Off-By: <name>; design-review=<sha256[:4]>trailer; it could not be verified on16e22476with the available tools. #391 had a blocking review item for a missing trailer, so a maintainer check is worth flagging.
Claims and evidence
| Claim in the description | What backs it | Assessment |
|---|---|---|
Reclaims (floor(row_bytes/alignment) − 1) * alignment bytes per rank |
sentinel_saved_bytes (cache_memory.rs:68-71), used in planning (memory.rs:405-409) and in allocation (cache_memory.rs:1416-1437); test asserts 38 granules saved for an 82,143,488 B row and 0 for one granule or a sub-granule row (cache_memory.rs:1366-1372) |
Verified in code and by CPU test |
32 MiB/rank on a 35 MiB row, 76 MiB/rank on an 82 MiB row |
arithmetic from the formula (16 granules → 15 saved = 30 MiB nominal; 39 → 38 saved = 76 MiB); no runtime measurement | Arithmetic plausible; the 32 MiB figure rests on the actual padded span, not shown in a test |
158 MiB → 82 MiB for 2 rows and a KV-page gain under a 900 MiB budget |
memory.rs:2030-2049: bytes(core,0,2) = 158 MiB vs row_backing_bytes(core,2) = 82 MiB, page capacity within one page |
Verified as a CPU unit test |
| Handle accounting updated | handle_charge (cache_memory.rs:81-102); assertion 494,576→494,848, 647,544→647,816, target 518,232→518,504 (cache_memory.rs:818-834); docs example docs/runtime-core-design.md:829-833 |
Verified; hand arithmetic reproduces +272 handles (2 → 19 per rank × 16) |
191 passed, 0 failed, 11 ignored on a747a5a5 |
author's command line in the description | Not independently reproducible here; no CI artifact cited |
| Existing cores load and serve without re-export | no format/Protobuf/CLI/metric file in the diff | Verified by file list |
| "Row zero stays zero / rows 1..7 distinct backing" | GPU test cuda_aliases_preserve_rows_while_unowned_pages_are_rewritten (cache_memory.rs:1210-1280) |
Weakened: row 0 excluded from the distinct-pattern upload (.skip(1), :1226) and only asserted zero; not run in this PR |
"Pure KV models and row_bytes < 2*alignment unaffected" |
both new branches fall through to the old single-handle path (cache_memory.rs:1438-1447, 1483-1488); row_backing_bytes subtracts 0 |
Verified |
Not provided: any live VRAM reading, any served-workload or startup-time measurement, and any run of the CUDA VMM tests.
Reach
- Who is affected: only models with continuation-state storage (
sizing.capacity == 0, e.g. GDN/Mamba/hybrid recipes) whose continuation row spans at least two VMM granules (row_bytes >= 2 * alignment, stated indocs/runtime-core-design.md:772-778) — roughly ≥ 4 MiB at 2 MiB granularity. Pure KV models and models withrow_bytes < 2 * alignmentare unaffected. - What changes for operators: because
row_backing_bytesfeedscapacities(memory.rs:486-531,:1003) and the KV-page search, identical hardware and flags now plan more KV pages and snapshot rows than before. Plannedrows/pages(uploaded asmemory_capacity,memory.rs:1318-1330per research notes) differ between engine versions on the same model; a memory limit that previously errored can now succeed. This is intended and documented (docs/runtime-core-design.md:772-780) but is a behavioural change that the description does not spell out for operators. - Configuration/defaults/dependencies: no new flag, knob, config default, or dependency. No Protobuf/CLI/Prometheus schema change; already-prepared cores load as before.
- Deployment: the same row/page shape is preserved so multi-host agreement is unaffected, and
local_handle_limitstill gates prefix-compacted placement to single-host Linux (cache_memory.rs:499-501). The mapping-handle budget (RM_HANDLE_RANGE = 524,288) is per-device, so wide-DP/16-reader layouts are the exposed case. - Documentation: spec updated in the same PR; the doc itself qualifies its placement claims narrowly (RTX PRO 6000 Blackwell, driver 615.71.10, Kimi K3.1 Pro TP16 DCP8/DCP16; per research notes
docs/runtime-core-design.md:840-845), and the re-baselined DCP16 handle numbers inherit that narrow qualification, including "wide-group compaction is CPU-unit-tested only".
Process
- Open and marked ready for review, one commit
16e22476, CI green on head, no labels, no reviews, no mergeable-state problems reported; age under a day at review time. - Description follows the charter's four-part scheme (why / what changed / claimed benefit / evidence) with explicit before/after and a limitations section, plus the required Discord line —
docs/design-review.md:151-169. - The declared gap is the GPU layer: CUDA VMM tests (including the modified one) and live serving were not run, "because all local GPUs were occupied".
docs/design-review.md:247-251says disclosure does not excuse skipped runnable CPU checks, and the verification table (docs/verification.md:14 (not opened)}per research notes) puts CUDA ordering / mapped-state / resource-lifetime assurance on real assigned GPUs — which is precisely what is missing. Prior merged precedent (#391, #473) accepted the same position. - Unverified process item: the
Design-Signed-Off-Bytrailer on16e22476could not be checked with the available tools.
Open questions and what could not be found
- Handle margin: with
+272handles for the DCP16 fixture and up to39 × row_readersextra mappings per rank for peer-read rows, does any supported wide-DP layout move too close toRM_HANDLE_RANGE = 524,288? #391's reviewer treated margin as blocking; the description does not address it. - Trait at the model boundary: the aliasing assumes a model never writes row zero. Ignition enforces it (
ignition/components/state.py,state_transfer.py), but Helios has no runtime guard, and new recipes are written elsewhere (local-inference-lab/hyperflare-recipes). Is a runtime-side check or a documented contract change needed? - No measured evidence: there is no live VRAM or capacity delta from serving a real GDN/Mamba core, so the headline
32 MiB/rank/76 MiB/rankfigures remain arithmetic. - GPU test coverage:
cuda_aliases_preserve_rows_while_unowned_pages_are_rewrittenno longer proves row zero has distinct backing and was not run; is a follow-up run (or a replacement assertion that an aliased row-zero write is visible at all offsets and stays within its own granule) required before merge? - Operator-visible capacity shift: should the description or release notes state that planned KV page counts rise on the same hardware?
- Not found: any linked issue, forum/Discord report, or roadmap item asking for this saving; any competing or stacked PR; any review, comment or reaction on this PR; and the commit's design-review sign-off trailer.