Skip to content

helios,heliopause,ignition: support single-plane BF16 and identity-indexed offloaded embedding tables - #664

Open
kbenkhaled wants to merge 3 commits into
NVIDIA:mainfrom
kbenkhaled:engram-bf16-identity-pr
Open

kbenkhaled wants to merge 3 commits into
NVIDIA:mainfrom
kbenkhaled:engram-bf16-identity-pr

Conversation

@kbenkhaled

@kbenkhaled kbenkhaled commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

While adding Gemma 4 E2B and E4B support, we hit a memory bottleneck from their
per-layer embedding (PLE) tables: they are raw BF16 tables indexed directly by
token ID and take 4.38 GiB (E2B, 35 layers) to 5.25 GiB (E4B, 42 layers).
Keeping them resident leaves little KV-cache headroom on memory-constrained
unified-memory GPUs.

Helios already has a shared offloaded-embedding path (direct-I/O staging, host
row cache, advisory lookahead prefetch, and shared-RAM handoff), but the schema,
validators, reader, and Heliopause exporter all assumed two-plane quantized
n-gram tables (FP8_E4M3_E8M0 + XOR_MODULO or NVFP4_E4M3_GLOBAL +
EOS_XOR_MODULO).

Solution

Extend the existing offloaded-embedding contract with two orthogonal primitives
— no model allowlists, capability flags, or new captured-graph operation
families:

  1. Single-plane BF16 storage (EngramTable.Encoding.BF16 = 3)

    • Stores raw embedding_width * 2-byte rows with no scale plane
      (scales absent, scale_buffer empty, scale_block == 0,
      global_scale == 0).
    • Replaces fixed [Plane; 2] storage in Helios with
      Planes { weights: Plane, scales: Option<Plane> } across disk, row-cache,
      advisory warm, RAM, and PreparedTables paths (pairing scale plane and
      buffer name as Option<(PlaneSource, String)> on TableSource).
    • Centralizes scale-plane validation in strict schema::engram_scales
      (rejecting Unspecified, with legacy encoding == 0 fallback kept local
      to runtime_core/engram.rs::spans) across Helios and Heliopause export,
      tolerates JSON null planes in export/binding.rs (matching
      weight_reuse.rs), and handles mixed-plane counts in peer descriptor
      handoff.
    • Automatically skips resident scale loading for single-plane tables and
      rejects explicit --embedding-table-resident-scales when no table in the
      catalog has a scale plane.
  2. Direct token indexing (EngramHash.Method.IDENTITY = 3)

    • Uses 1 lookup head (heads == 1), empty token_map and hash arrays,
      compressed_vocabulary == rows, and GPU request delivery (request_buffer).
    • Captured graphs publish one int64 row ID per token in [0, stored_rows)
      (partition-local when sharded) or -1 for inactive slots; out-of-range IDs
      fail gathering.
  3. Two shared correctness fixes found while generalizing

    • Pre-publication shard contiguity: signed-core validation now enforces
      contiguous, rank-ordered full-table shard coverage matching native loading,
      so export cannot sign a gapped partitioned table that Helios would refuse
      to load.
    • Distinct partitioned delivery groups: decoded Table entries carry
      partition: Option<usize> and model.rs groups ranks via explicit
      Index::shares_delivery_with, so two TP ranks with identical shard bytes
      never collapse into one shared gather group.
  4. Backward compatibility & docs

    • Both enum values are appended (= 3) without changing existing tags or
      defaults; runtime_core_pb2.py is regenerated with protoc 36.2.
    • Two-plane FP8/NVFP4 tables keep their exact wire layout and validation
      rules.
    • Updated manifest.md, core-format-design.md, cli-design.md,
      model-preparation.md, and .proto comments to document single-plane
      tables, IDENTITY mailbox semantics, and --embedding-table-resident-scales.

Result

Heliopause exports, reuses, and signs shared and partitioned single-plane
BF16 / IDENTITY tables, and Helios verifies, decodes, and serves them
across disk, row cache, advisory warm, and RAM paths while keeping existing
FP8/NVFP4 unit and wire-format tests passing unchanged.

Validation

  • End-to-end GPU export & serving (Jetson AGX Thor, SM110):
    • Exported google/gemma-4-E2B-it-qat-w4a16-ct (4.38 GiB SSD single-plane
      BF16 PLE table, 43 graphs, 3,405 kernels) with the PR's flare_heliopause
      and served it with the PR's flare binary (2.5 GiB resident GPU weights,
      1024 MiB host row cache, 2.3 GiB / 131,072-token KV cache; 1.6s
      startup).
    • AIPerf ISL=2048 / OSL=2048 (c=1, 5 req + 1 warmup, MTP0):
      TTFT 111.2 ms avg (136.4 ms p50), ITL 10.09 ms (99.1 tok/s);
      12,292 gathers, 12,248 cache hits, 4,009 direct-I/O reads (87.3 MB),
      0 prefetch errors, and flare_engram_resident_scale_bytes = 0.
  • CPU release-mode Rust tests (non-root runner, ext4 TMPDIR):
    • helios (--features runtime-core,server): engram (52 passed),
      core::schema (15 passed), runtime_core::selection (43 passed),
      execution::threaded (27 passed), integration --test '*' (62 passed);
      full --lib run had 1,778 passed and 6 failures in
      tests/support/templates.rs:19 (gated HF template returned 401).
    • heliopause: export::core (34 passed — shared & partitioned BF16/IDENTITY
      export, parallel assembly, FD accounting, weight reuse, Helios verification
      round-trips, gapped-shard rejection), export::binding (14 passed),
      export::weight_reuse (7 passed); full run had 226 passed and 2 unrelated
      export::blob ext4 ctime failures.
    • flare-cli: 239 passed, 0 failed.
    • flare: 237 passed, 1 unrelated hub::tests loopback failure.
  • Python tests: test_embedding_table_handoff.py (mixed 2-plane + 1-plane
    peer handoff), test_core_boundary.py, and test_design_review_hook.py
    all passed.
  • Limitations: Windows I/O ring builds, mutation testing, and serving replay
    of a previously exported binary FP8/NVFP4 core were not run locally.

Discord: no username provided

@flare-autobot

Copy link
Copy Markdown
Collaborator

A case file has been opened for 664.
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 flare-autobot added area:engram Engram row gathering, disk I/O, and embedding-row caching. enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:review Proposed change needs code review; this does not imply merge readiness. labels Dec 1, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

The Planes { weights, scales: Option<Plane> } / Encoding.BF16 = 3 / Method.IDENTITY = 3 generalization and the two shared correctness fixes are technically clean, model-agnostic, and well tested on CPU, and every audited downstream consumer handles single-plane tables correctly. It is blocked on repository contract and verification gates: new signed core-format / captured-graph enums are added without recorded owner approval or a linked producer recipe, and the validation section is unfinished (Thor E2B TODO placeholder, zero CI, no live GPU export-and-serve, no FP8/NVFP4 replay).

  • Blockers: 2 · Should fix: 2 · Subtract/Simplify: 2 · Nits: 2
Walkthrough
  • Core schema & wire contract (helios/proto/{core,runtime_core}.proto, helios/src/core/{schema,reader}.rs, ignition/preparation/runtime_core_pb2.py (not opened)): Appends EngramTable.Encoding.BF16 = 3 (single-plane raw BF16 rows of embedding_width * 2 bytes, no scale plane/buffer/block/global scale) and EngramHash.Method.IDENTITY = 3 (1-head direct indexing via existing request_buffer, empty token_map and hash arrays, compressed_vocabulary == rows), skips scale payloads in required_payloads, and aligns signed-core shard validation with runtime_core::engram::validate_shards (contiguous, rank-ordered full-table coverage).
  • Runtime reader, staging, and selection (helios/src/engram.rs, engram/{reader,prepared}.rs, engram/reader/windows.rs, runtime_core/{engram,model,selection}.rs): Replaces [Plane; 2] with Planes { weights: Plane, scales: Option<Plane> } across disk, row-cache, advisory warm, RAM, Transfers, and PreparedTables paths; records Table.partition: Option<usize> so TP ranks with byte-identical shard spans do not collapse into one delivery group; gates --embedding-table-resident-scales on has_scale_planes and rejects explicit use when no table carries scales.
  • Exporter & peer handoff (heliopause/src/export/{core,binding}.rs, heliopause/src/embedding_tables.rs, ignition/preparation/rank_group.py): Makes the scale plane optional in roles(), validate_ranks(), core_engram(), and NativeEmbeddingTables; tolerates JSON null planes in append_planes (matching weight_reuse.rs:406); updates peer descriptor counting in _receive_embedding_tables to sum(len(table["planes"]) for table in catalog["tables"]).
  • Docs & tests (helios/manifest.md, docs/{cli-design,core-format-design,model-preparation}.md, tests/preparation/test_embedding_table_handoff.py, Rust unit tests): Documents single-plane BF16 storage, IDENTITY indexing semantics, omitted -scales safetensors files, and --embedding-table-resident-scales behavior; adds CPU unit tests across schema validation, decode, single-plane disk/cache/warm/RAM gathering, single-descriptor PreparedTables sharing, export/reuse/gapped-shard rejection, and mixed-plane Python handoff.
Merge Risk: Medium · up to c769355
Pre-merge checks: ✅ 2 passed · ⚠️ 2 warnings
  • ✅ Security / malicious screen: No suspicious code, credential handling, external calls, or unsafe regressions; validate_buffer (helios/src/runtime_core/engram.rs:315-332) fixes a pre-existing out-of-bounds buffer.shape[0] index before length checking.
  • ⚠️ Charter & value fit: Right model-agnostic layer (no model allowlists, capability flags, or runtime hashing), but adds new signed core-format / captured-graph contract enums (Encoding.BF16, Method.IDENTITY) without recorded owner approval (docs/design-review.md:22-26) and with no in-tree or linked external producer recipe.
  • ✅ Related / duplicate / conflict check: Additive to perf(engram): add graph-driven advisory lookahead prefetch for disk-backed tables #566 and helios,ignition: fix Engram reader bugs and add PLE lookahead publish #590, aligns with Read Engram rows ahead of prefill on every rank #334's runtime-boundary stance, and has no competing implementation; note mechanical merge overlap with open drafts touching Planes (e.g., DRAFT: engram: read row-cache misses from an Engram store host over RDMA READ #554).
  • ⚠️ Tests & verification evidence: CPU unit tests are thorough, isolated (PID-scoped temp paths, clean monkeypatch), and test real production entry points, but head c769355 has zero CI runs, the Validation section still holds an unfinished Thor E2B TODO placeholder, and neither live BF16/IDENTITY export+serving nor existing FP8/NVFP4 core serving replay has been run (docs/design-review.md Principles 12–13).

Blockers

  1. Unapproved core-format / captured-graph contract extension with no linked producer (helios/proto/core.proto:258,294, helios/proto/runtime_core.proto:660,695, helios/manifest.md:457-463, docs/core-format-design.md:94-104): Adding EngramTable.Encoding.BF16 = 3, EngramHash.Method.IDENTITY = 3, and the single-plane artifact layout (omitting -scales safetensors files) extends the signed core format and captured-graph contract. While IDENTITY cleanly reuses the existing request_buffer mailbox protocol, docs/design-review.md:22-26 and the Project Charter require explicit project-owner approval (Luke Alonso) for new contract surface (contrast perf(engram): add graph-driven advisory lookahead prefetch for disk-backed tables #566's explicit approval note / Engram read-ahead: approval for an advisory mailbox on the prefill graph #535). No producer exists in this repository (ignition/components/engram.py and ignition/components/ngram_delivery.py only emit two-plane FP8/NVFP4) and no companion external recipe PR is linked (contrast perf(engram): add graph-driven advisory lookahead prefetch for disk-backed tables #566 -> local-inference-lab/hyperflare-recipes#70, helios,ignition: fix Engram reader bugs and add PLE lookahead publish #590 -> hyperflare-recipes#87), leaving the new contract unexercised end to end. Fix: Obtain and record explicit owner approval for Encoding.BF16 and Method.IDENTITY, and link the companion Gemma 4 E2B/E4B recipe PR (or producer) that exports cores targeting this contract.
  2. Incomplete validation and missing live export/serve & backward-compatibility verification (docs/design-review.md Principles 12 & 13; Project Charter): The Validation section still contains an unfinished placeholder (*(update this line once the Thor E2B export + benchmark completes)*), head c769355 has zero CI checks, and the PR explicitly discloses that live GPU export/serving replay of a BF16/IDENTITY core and serving replay of a previously exported FP8/NVFP4 core were not run. Both the Charter ("New model recipes, aliases, or formats ... prove they export and serve cleanly from the PR branch") and Principle 13 ("Validate previous cores through loading and serving") require these checks before merge. Fix: Complete and report the live Thor/GPU export + flare run serving verification and memory measurement for at least one BF16/IDENTITY checkpoint (removing the placeholder), verify loading and serving replay of a previously exported FP8/NVFP4 core without re-export, and ensure CI passes on the updated head.

Should Fix

  1. Strict Unspecified handling in engram_encoding_has_scales (helios/src/core/schema.rs:319-329, heliopause/src/export/core.rs:98,426,1553): engram_encoding_has_scales maps Encoding::Unspecified (0) to Ok(true) solely to accommodate legacy spans() test fixtures (helios/src/runtime_core/engram.rs:506-529). Because heliopause/src/export/core.rs calls this helper in roles(), validate_ranks(), and core_engram() without first rejecting Unspecified, a table with encoding == 0 is treated as two-plane and fails with misleading plane-absence diagnostics instead of "engram table has no encoding" (relying on validate_deployment later). Fix: Make the shared helper reject Encoding::Unspecified and handle the legacy encoding == 0 two-plane fallback locally in helios/src/runtime_core/engram.rs::spans.
  2. Make Table.partition delivery-group semantics explicit (helios/src/engram.rs:179, helios/src/runtime_core/engram.rs:425, helios/src/runtime_core/model.rs:458): Table.partition: Option<usize> is populated during decode (runtime_core/engram.rs:425) and never read directly in production code; its entire effect relies implicitly on derived #[derive(PartialEq, Eq)] at helios/src/runtime_core/model.rs:458 (engram.iter_mut().find(|(existing, _)| existing == &index)). Without a comment or explicit predicate, a future refactor removing an apparently unread field would silently reintroduce cross-rank mailbox collapse when two TP ranks share identical shard payload bytes. Fix: Add an explicit Index::shares_delivery_with(&self, other: &Self) (or document the PartialEq invariant directly on Table.partition and at model.rs:458).

Subtract / Simplify

  1. Collapse repeated single-plane scale checks into one strict helper (helios/src/core/schema.rs:445-453,489-499, helios/src/runtime_core/engram.rs:39-49,60-72,197-203,269-277, heliopause/src/export/core.rs:108-153,432-462,1565-1637): The identical if has_scales { require scales } else if scales.is_some() { reject } logic is hand-written across 10+ sites with six slightly different error strings. Introducing one strict generic helper pub fn engram_scales<'a, T>(encoding: i32, scales: &'a Option<T>) -> Result<Option<&'a T>> in helios/src/core/schema.rs (rejecting Unspecified, with spans() handling legacy 0 locally and validate_shards's rank-selective sibling-absence check at runtime_core/engram.rs:101-106 kept separate) deletes ~45 lines and prevents asset-list drift across exporter and validator stages.
  2. Pair optional scale plane and buffer name into a single Option (helios/src/engram/prepared.rs:39-48,71,163-167,271, helios/src/engram.rs:177-186,1005-1014, heliopause/src/embedding_tables.rs:46-53): TableSource and Table store scales_plane/planes.scales and scales: Option<String> separately, forcing manual parity checks at prepared.rs:71 and a redundant mismatch arm at prepared.rs:166. Pairing them as Option<(PlaneSource, String)> at the Python boundary in heliopause/src/embedding_tables.rs makes mismatched scale metadata unrepresentable in Rust and eliminates both checks.

Nits

  1. Collapsed partitioned-table diagnostics (helios/src/core/schema.rs:455-461): Merging shared-plane presence, empty request_buffer, and shards.len() != ranks into one "invalid partitioned engram table" error loses specificity compared to main; keeping distinct messages makes malformed cores easier to diagnose.
  2. PR description details: Mention the parts.is_null() tolerance added to heliopause/src/export/binding.rs:655-657 (aligning with weight_reuse.rs:406), and update Discord: None to match docs/design-review.md Principle 17 (Discord: no username provided or a Discord username).
Dropped on verification
  • Correctness Lens §1 ("Major — Memory amplification: 7.5–9.2 GiB of pinned host memory ... cap embedding_width ≤ 8 KiB"): Factually false due to double-counting the layer factor. The 8,960 BF16 row width (17,920 B/row in helios/src/engram/reader.rs:2540) already packs all 35 E2B layers (35 × 256) into one table (262,144 × 8,960 × 2 = 4.375 GiB; E4B is one table of 42 × 256 = 10,752 BF16 elements = 5.25 GiB). At max_tokens = 4,096, heads = 1, total host staging is 2 × 4,096 × 17,920 = 140 MiB plus 70 MiB miss_output drawn from the 1 GiB integrated default row-cache budget (selection.rs:89) — a >4.1 GiB net reduction, already accounted in embedding_host_bytes (model.rs:489-491,762-777). The suggested ≤ 8 KiB row cap would break Gemma 4 E2B (17.5 KiB/row) and E4B (21 KiB/row).
  • Correctness Lens §2's claim that request_buffer is a new mailbox mechanism: EngramTable.request_buffer (field 13) already existed on main for EOS_XOR_MODULO (helios/proto/core.proto:272-277, helios/src/runtime_core/engram.rs:176-180, ignition/components/ngram_delivery.py:18-39). Blocker Congratulations! #1 was scoped accurately to the genuinely new Encoding.BF16 and Method.IDENTITY contracts.
  • Correctness Lens §4's claim that partition: None in helios/src/engram/prepared.rs:131 is an inconsistent bug: PreparedTables::bind() (prepared.rs:320-332) always creates a rank-local Shared with ranks: 1 and never groups ranks by Index equality; cross-process RAM sharing in rank_group.py:56 compares Python catalogs and keeps independent delivery mailboxes per process.
  • Correctness Lens §5a (heliopause/src/export/binding.rs:653-657 accepting "weights": null): False defect. append_planes runs on both top-level tables (binding.rs:507) and shards (binding.rs:510), and partitioned tables legitimately carry "weights": null on the parent table object — matching heliopause/src/export/weight_reuse.rs:405-406, which already filters !parts.is_null() for both "weights" and "scales". Rejecting "weights": null here would break partitioned tables serialized with explicit None fields.
  • Correctness Lens §6 (backward-compatibility concern for gapped partitioned cores in helios/src/core/schema.rs:462-503): False compatibility regression. helios/src/runtime_core/engram.rs:80-117 (validate_shards) already rejected gapped, misordered, and incomplete shards on main, so no previously exported gapped core could load or serve. Tightening validate_engram prevents heliopause from signing unloadable cores, and is already tested in schema.rs:1874-1891 and heliopause/src/export/core.rs:5348-5381.
  • Subtraction Lens §4 ("staging_payload_bytes is unchecked" and replacing if scales > 0 with planes.iter() in reader.rs): Contradicted by the code — helios/src/engram.rs:196 uses .try_fold(0usize, |total, plane| total.checked_add(plane.row_bytes)). Replacing if scales > 0 inside the hot per-row raw-pointer copy loops (reader.rs:970,1102,1156) with an iterator would add unnecessary overhead.
  • Subtraction Lens §6a ("helios/manifest.md:456 'two pinned payload frames' contradicts single-plane tables"): Misread double-buffering as planes. Lines 456 and 469 describe STAGING_FRAMES = 2 (helios/src/engram.rs:339,678), which remains two frames for single-plane tables.
  • Subtraction Lens §6b ("ignition/preparation/rank_group.py:47 duplicates count validation already done in PreparedTables::from_shared"): Factually wrong — _receive_embedding_tables must validate count before reading count FDs via recv_handle(control) (lines 52–53), and for partitioned tables (catalog != model.embedding_catalog, line 56) descriptors is passed as None, so PreparedTables::from_shared never runs on those handles.
  • Subtraction Lens §6c (heliopause/src/export/core.rs:1559-1637 format string closure): Low-signal micro-cleanup; four explicit path literals are readable and greppable.

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.

…dexed offloaded embedding tables

Why:
Models with large token-indexed BF16 per-layer embedding (PLE) tables, such as
Gemma 4 E2B (4.38 GiB across 35 layers) and E4B (5.25 GiB across 42 layers),
cannot hold those tables resident on memory-constrained unified-memory GPUs
without exhausting KV-cache headroom. Helios already provides direct-I/O table
staging, row caching, and advisory lookahead prefetch for offloaded embedding
tables, but its Protobuf contract, validators, reader, and Heliopause exporter
previously assumed two-plane quantized n-gram tables (FP8_E4M3_E8M0 with
XOR_MODULO and NVFP4_E4M3_GLOBAL with EOS_XOR_MODULO).

What:
- Add EngramTable.Encoding.BF16 = 3 and EngramHash.Method.IDENTITY = 3 to the
  core and runtime Protobuf schemas (and regenerate runtime_core_pb2.py with
  protoc 36.2), keeping existing enum values and two-plane wire layouts intact.
- Replace fixed [Plane; 2] storage in Helios with Planes { weights, scales:
  Option } and optional scale buffer bindings across disk, cached-disk, RAM,
  advisory warm, and PreparedTables shared-descriptor paths; keep partitioned
  ranks in distinct delivery groups via Table::partition even when two shards
  share identical bytes; validate RAM scale parity and checked staging length
  before writing output.
- Centralize encoding scale checks in schema::engram_encoding_has_scales;
  validate single-plane BF16 geometry (checked rows * embedding_width * 2
  bytes, zero scale_block and global_scale bits, absent scales/scale_buffer),
  IDENTITY indexing (heads == 1, empty hash arrays,
  compressed_vocabulary == rows, GPU request delivery required), and
  contiguous rank-ordered shard coverage before core publication; suppress
  automatic resident scales and reject explicit
  --embedding-table-resident-scales when no table carries a scale plane.
- Support optional scale planes across Heliopause parallel core_engram
  assembly (shared and partitioned), role/rank validation, null-scale
  append_planes, EmbeddingTables parsing, and peer descriptor handoff.
- Update manifest.md, core-format-design.md, cli-design.md, and
  model-preparation.md for single-plane tables, IDENTITY mailbox semantics,
  and resident-scale flag behavior, and extend existing Helios, Heliopause,
  and Ignition tests for shared and partitioned BF16/IDENTITY paths.

Design-Signed-Off-By: Gemini 4 Neon (Cursor); design-review=2e5b
Signed-off-by: kbenkhaled <kbenkhaled@nvidia.com>
@kbenkhaled
kbenkhaled force-pushed the engram-bf16-identity-pr branch from c769355 to 263dfe9 Compare December 1, 2026 20:21
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

All six code and documentation follow-ups from the previous review were cleanly resolved in 263dfe9 (engram_encoding_has_scales strictness, engram_scales centralization, Index::shares_delivery_with, paired Option<(PlaneSource, String)>, distinct partitioned-table diagnostics, PR description updates), the Thor E2B live export-and-serve run is now completed, and deep inspection of the reader, row cache, staging, export, conversion, and weight-reuse paths found no correctness or concurrency regressions. The PR remains blocked on two repository gates carried over (and narrowed) from the previous round: recorded project-owner approval and a linked producer/recipe PR for the new Encoding.BF16 / Method.IDENTITY wire contract, and passing CI plus a backward-compatibility serving replay of a pre-existing FP8/NVFP4 core without re-export.

  • Blockers: 2 · Should fix: 0 · Subtract/Simplify: 2 · Nits: 0
Blockers
  1. Unapproved core-format / captured-graph contract extension with no linked producer (helios/proto/core.proto:258,294, helios/proto/runtime_core.proto:661,695, helios/manifest.md:457-463, docs/core-format-design.md:92-103): EngramTable.Encoding.BF16 = 3, EngramHash.Method.IDENTITY = 3, single-plane artifact packaging (omitting -scales safetensors) and the IDENTITY mailbox contract (1-head int64 row IDs in [0, stored_rows) or -1, partition-local indices when sharded, out-of-range IDs failing gather) impose new producer obligations on captured graphs. Per docs/design-review.md:22-26, docs/core-design.md:276-280 and the Project Charter this needs explicit prior approval from project owner Luke Alonso even when reusing an existing graph kind or mailbox mechanism; no human review/approval is recorded. No in-repo producer exists (ignition/components/engram.py:117-126 emits only two-plane FP8/NVFP4) and no companion recipe PR (e.g., Gemma 4 E2B/E4B) is linked. Fix: record explicit owner approval for Encoding.BF16 / Method.IDENTITY (and mailbox semantics), and link the companion producer/recipe PR targeting this contract.
  2. Missing CI verification on head 263dfe9 and unverified legacy FP8/NVFP4 core replay (.github/workflows/native-serving.yml:13-78, .github/workflows/python-cpu.yml:13-41, .github/workflows/helios-lifecycle.yml:18-48 (not opened), docs/design-review.md:116-123,247-251): the Round 1 Thor E2B export-and-serve run is complete, but (a) no CI workflows have reported on 263dfe9, leaving the Windows I/O ring build (windows-2022 matrix job), full release crate test suites, python-cpu pytest/heliopause, and helios-lifecycle TLA+ conformance and Kani proofs unverified (docs/design-review.md:247-251 states disclosing runnable CPU/formal checks as limitations does not waive them); and (b) loading and serving replay of a previously exported FP8/NVFP4 core without re-export was not run, required by Principle 13 (docs/design-review.md:123) and the Project Charter. Fix: unblock and pass native-serving, python-cpu, and helios-lifecycle on the PR head, and replay at least one previously exported FP8/NVFP4 core without re-export.
Walkthrough
  • Wire contract & schema (helios/proto/core.proto:258,294, helios/proto/runtime_core.proto:661,695, helios/src/core/schema.rs:318-511, helios/src/core/reader.rs:228-245, ignition/preparation/runtime_core_pb2.py (not opened)): Appends EngramTable.Encoding.BF16 = 3 (raw embedding_width * 2-byte rows, no scale plane/metadata, overflow-checked payload size pinning) and EngramHash.Method.IDENTITY = 3 (1-head direct indexing over request_buffer, empty token_map and hash arrays, compressed_vocabulary == rows), centralizes scale-plane checks in engram_encoding_has_scales / engram_scales, skips absent scale payloads in required_payloads, and aligns signed-core shard contiguity validation with runtime_core::engram::validate_shards.
  • Native reader, staging, and model loading (helios/src/engram.rs:176-219,631-657,911-1029, helios/src/engram/reader.rs:60-102,792-1460, helios/src/engram/prepared.rs:39-224, helios/src/engram/reader/windows.rs, helios/src/runtime_core/{engram,model,selection}.rs): Replaces [Plane; 2] with Planes { weights, scales: Option<Plane> } across disk, row-cache, advisory warm, RAM, Transfers, and PreparedTables paths; records Table.partition: Option<usize> and groups ranks via Index::shares_delivery_with so byte-identical TP shards never collapse into one delivery group; skips resident scale loading for single-plane tables and rejects explicit --embedding-table-resident-scales when no table carries a scale plane; fixes an out-of-bounds shape index in validate_buffer (helios/src/runtime_core/engram.rs:306-309).
  • Exporter & peer handoff (heliopause/src/export/{core,binding}.rs, heliopause/src/embedding_tables.rs:41-62, ignition/preparation/rank_group.py:44-61): Makes scale planes optional in roles(), validate_ranks(), core_engram(), FD preflight accounting, and NativeEmbeddingTables (pairing Option<(PlaneSource, String)> at the Python boundary); tolerates JSON null planes in append_planes (matching weight_reuse.rs:406); counts descriptors dynamically via sum(len(table["planes"]) for table in catalog["tables"]) in _receive_embedding_tables.
  • Docs & tests (helios/manifest.md:455-464, docs/{cli-design,core-format-design,model-preparation}.md, tests/preparation/test_embedding_table_handoff.py, Rust unit tests): Documents BF16 single-plane layout, IDENTITY mailbox semantics, omitted -scales files, and --embedding-table-resident-scales rejection; adds isolated CPU unit tests covering schema validation, decode, single-plane disk/cache/warm/RAM gathering, partitioned delivery-group separation, publish-time gapped-shard rejection, and mixed-plane peer descriptor handoff.
Merge Risk: Medium · up to 263dfe9
  • Modifies signed core schema validation (helios/proto/{core,runtime_core}.proto, helios/src/core/{schema,reader}.rs), the native embedding reader/cache/transfer pipeline (helios/src/engram.rs, engram/{reader,prepared}.rs, runtime_core/{engram,model,selection}.rs), and the heliopause exporter (export/{core,binding}.rs, embedding_tables.rs), all in recently active areas.
  • Backward wire compatibility for two-plane FP8/NVFP4 cores is preserved structurally (new enum values appended at = 3, existing layouts untouched, runtime_core_pb2.py (not opened) regenerated, and DiskReader::gather / RowCache handle wide single-plane rows via 4 KiB fragments and 64 KiB coalesced reads), and every downstream consumer (conversion.rs, weight_reuse.rs, describe.rs, reader.rs) cleanly tolerates scales: None.
  • No CI workflow has run on 263dfe9 (leaving Windows I/O ring builds, TLA+ lifecycle conformance, and Kani sequential proofs unverified), and serving replay of a previously exported FP8/NVFP4 core without re-export has not been performed.
Pre-merge checks: ✅ 3 passed · ⚠️ 2 warnings
Subtract / Simplify
  1. Remove redundant encoding validation in validate_engram (helios/src/core/schema.rs:367-372): engram_encoding_has_scales(table.encoding)? (helios/src/core/schema.rs:318-327) already rejects unknown tags and Encoding::Unspecified with the identical "engram table has no encoding" error. Delete the duplicate try_from / Unspecified check at lines 367–371 (either check table.encoding == wire::engram_table::Encoding::Bf16 as i32 at line 433 or drop lines 369–371 after engram_encoding_has_scales).
  2. Delete unreachable None branch in decode Planes construction (helios/src/runtime_core/engram.rs:259-267): When scale_bytes is None (has_scales == false), shared tables have already rejected table.scales.is_some() at line 191 and partitioned tables have already rejected shard.scales.is_some() for every shard inside validate_shards at lines 97–101 (called at line 158). Replace lines 259–267 with scales: scale_bytes.map(|bytes| plane(scales, bytes)).transpose()?, (deleting 7 unreachable lines).

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.

Resolve merge conflicts against origin/main (9cd0cfa) so PR NVIDIA#664 merges cleanly without rewriting earlier PR history.

Resolved conflicts in ignition/preparation/rank_group.py (preserving both _receive_embedding_tables for variable-plane descriptor handoff and main's extra_roots=() peer parameter from NVIDIA#670) and regenerated ignition/preparation/runtime_core_pb2.py from the cleanly merged helios/proto/runtime_core.proto.

Keeps PR NVIDIA#664 cleanly mergeable with origin/main while preserving all single-plane BF16 and IDENTITY offloaded embedding table behavior.

Validated on Jetson AGX Thor in the follow-up head commit (Rust helios/heliopause engram and schema tests plus Python embedding-table handoff tests).

Design-Signed-Off-By: Gemini 4 Neon; design-review=2e5b
Signed-off-by: kbenkhaled <kbenkhaled@nvidia.com>
Follow up on review feedback for PR NVIDIA#664 by removing two checks already guaranteed by earlier validation in validate_engram and decode.

In helios/src/core/schema.rs, drop the duplicate Encoding::try_from / Unspecified guard in validate_engram (engram_encoding_has_scales already rejects unknown tags and Unspecified with the identical error) and compare table.encoding directly against Encoding::Bf16 for BF16 row-byte sizing. In helios/src/runtime_core/engram.rs, replace the unreachable None branch in Planes::scales construction (already enforced by table.scales.is_some() and validate_shards) with scale_bytes.map(...).transpose()?.

Simplifies schema validation and runtime decoding by 13 net lines with identical validation semantics and error behavior.

Validated on Jetson AGX Thor: cargo test --manifest-path helios/Cargo.toml --features runtime-core --lib engram (52 passed) and schema (20 passed), cargo test --manifest-path heliopause/Cargo.toml --lib engram (7 passed), and pytest tests/preparation/test_embedding_table_handoff.py tests/preparation/test_frontend_spec.py tests/cli/test_config.py (82 passed). Material limitation: no previously exported two-plane FP8/NVFP4 core was cached on Thor for live serving replay without re-export.

Design-Signed-Off-By: Gemini 4 Neon; design-review=2e5b
Signed-off-by: kbenkhaled <kbenkhaled@nvidia.com>
@kbenkhaled
kbenkhaled force-pushed the engram-bf16-identity-pr branch from 3206631 to fd6dad6 Compare December 3, 2026 02:32
@flare-autobot flare-autobot added area:memory Memory budgets, allocation lifetimes, scratch sharing, and capacity. triage:design-review Needs a maintainer scope, architecture, or contract decision before implementation or integration. triage:review Proposed change needs code review; this does not imply merge readiness. and removed triage:review Proposed change needs code review; this does not imply merge readiness. triage:design-review Needs a maintainer scope, architecture, or contract decision before implementation or integration. labels Dec 3, 2026
@flare-autobot

Copy link
Copy Markdown
Collaborator

Autobot Review

Full Review · Value Proposition · Case File

Recommendation: Changes Requested

The implementation at fd6dad6 is clean, model-agnostic, wire-compatible, and resolves every code-level Should Fix and Subtract/Simplify item from Rounds 1–2; no new correctness, concurrency, memory-budget, or hot-path defects were found. Merge remains blocked on two process/verification gates: recorded project-owner approval (plus a companion producer/recipe link) for the new core-format and captured-graph contract enums, and passing CI (native-serving, python-cpu, helios-lifecycle) plus a serving replay of a pre-existing FP8/NVFP4 core without re-export.

  • Blockers: 2 · Should fix: 0 · Subtract/Simplify: 0 · Nits: 0
Walkthrough
  • Wire contract & signed schema (helios/proto/core.proto:258,294, helios/proto/runtime_core.proto:664,698, helios/src/core/schema.rs:318-506, helios/src/core/reader.rs:230-247, ignition/preparation/runtime_core_pb2.py): Appends orthogonal primitives EngramTable.Encoding.BF16 = 3 (raw embedding_width * 2-byte single-plane rows, no scale metadata/plane, overflow-checked payload size pinning) and EngramHash.Method.IDENTITY = 3 (1-head direct indexing over request_buffer, empty token_map and hash arrays, compressed_vocabulary == rows), centralizes strict scale validation in engram_encoding_has_scales / engram_scales, skips absent scale planes in required_payloads, and aligns signed-core shard contiguity checks with native loading.
  • Native reader, delivery grouping, and load options (helios/src/engram.rs:176-219,631-657,911-1029, helios/src/engram/reader.rs:60-102,803-1460, helios/src/engram/prepared.rs:39-280, helios/src/engram/reader/windows.rs, helios/src/runtime_core/{engram,model,selection}.rs): Replaces [Plane; 2] with Planes { weights: Plane, scales: Option<Plane> } across disk, row-cache, advisory warm, RAM, Transfers, and PreparedTables; records Table.partition: Option<usize> and groups ranks via Index::shares_delivery_with so byte-identical TP shards stay in distinct delivery groups; skips resident scale loading for single-plane tables (flare_engram_resident_scale_bytes = 0) and rejects explicit --embedding-table-resident-scales when no table carries a scale plane; hardens validate_buffer shape-arity matching (helios/src/runtime_core/engram.rs:297-314).
  • Exporter & peer handoff (heliopause/src/export/{core,binding}.rs, heliopause/src/embedding_tables.rs:41-72, ignition/preparation/rank_group.py:44-60): Makes scale planes optional across roles(), validate_ranks(), core_engram(), and NativeEmbeddingTables (pairing Option<(PlaneSource, String)> at the Python boundary); tolerates JSON null planes in append_planes (heliopause/src/export/binding.rs:655-657); counts handoff descriptors dynamically as sum(len(table["planes"]) for table in catalog["tables"]).
  • Docs & tests (helios/manifest.md:457-463, docs/{cli-design,core-format-design,model-preparation}.md, helios/src/execution/threaded.rs:1448-1638, helios/src/runtime_core/event_tests.rs, tests/preparation/test_embedding_table_handoff.py): Documents single-plane BF16 storage, IDENTITY mailbox semantics, omitted -scales files, and --embedding-table-resident-scales behavior; adds isolated CPU unit tests covering schema validation, decode, single-plane disk/cache/warm/RAM gathering, single-descriptor PreparedTables sharing, partitioned delivery-group separation, publish-time gapped-shard rejection, and mixed-plane Python handoff.
Merge Risk: Medium · up to fd6dad6
Pre-merge checks: ✅ 2 passed · ⚠️ 2 warnings

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:engram Engram row gathering, disk I/O, and embedding-row caching. area:memory Memory budgets, allocation lifetimes, scratch sharing, and capacity. enhancement New feature or request performance Performance, latency, throughput, or memory-efficiency investigation or improvement. triage:review Proposed change needs code review; this does not imply merge readiness.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants