Repository navigation
helios,heliopause,ignition: support single-plane BF16 and identity-indexed offloaded embedding tables - #664
kbenkhaled wants to merge 3 commits into
Conversation
|
A case file has been opened for 664. Future reviews will auto-run 90 minutes after code updates are pushed.
|
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe
Walkthrough
Merge Risk: Medium · up to
|
…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>
c769355 to
263dfe9
Compare
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedAll six code and documentation follow-ups from the previous review were cleanly resolved in
Blockers
Walkthrough
Merge Risk: Medium · up to
|
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>
3206631 to
fd6dad6
Compare
Autobot ReviewFull Review · Value Proposition · Case File Recommendation: Changes RequestedThe implementation at
Walkthrough
Merge Risk: Medium · up to
|
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_MODULOorNVFP4_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:
Single-plane
BF16storage (EngramTable.Encoding.BF16 = 3)embedding_width * 2-byte rows with no scale plane(
scalesabsent,scale_bufferempty,scale_block == 0,global_scale == 0).[Plane; 2]storage in Helios withPlanes { weights: Plane, scales: Option<Plane> }across disk, row-cache,advisory warm, RAM, and
PreparedTablespaths (pairing scale plane andbuffer name as
Option<(PlaneSource, String)>onTableSource).schema::engram_scales(rejecting
Unspecified, with legacyencoding == 0fallback kept localto
runtime_core/engram.rs::spans) across Helios and Heliopause export,tolerates JSON
nullplanes inexport/binding.rs(matchingweight_reuse.rs), and handles mixed-plane counts in peer descriptorhandoff.
rejects explicit
--embedding-table-resident-scaleswhen no table in thecatalog has a scale plane.
Direct token indexing (
EngramHash.Method.IDENTITY = 3)heads == 1), emptytoken_mapand hash arrays,compressed_vocabulary == rows, and GPU request delivery (request_buffer).int64row ID per token in[0, stored_rows)(partition-local when sharded) or
-1for inactive slots; out-of-range IDsfail gathering.
Two shared correctness fixes found while generalizing
contiguous, rank-ordered full-table shard coverage matching native loading,
so export cannot sign a gapped partitioned table that Helios would refuse
to load.
Tableentries carrypartition: Option<usize>andmodel.rsgroups ranks via explicitIndex::shares_delivery_with, so two TP ranks with identical shard bytesnever collapse into one shared gather group.
Backward compatibility & docs
= 3) without changing existing tags ordefaults;
runtime_core_pb2.pyis regenerated withprotoc 36.2.rules.
manifest.md,core-format-design.md,cli-design.md,model-preparation.md, and.protocomments to document single-planetables,
IDENTITYmailbox semantics, and--embedding-table-resident-scales.Result
Heliopause exports, reuses, and signs shared and partitioned single-plane
BF16/IDENTITYtables, and Helios verifies, decodes, and serves themacross disk, row cache, advisory warm, and RAM paths while keeping existing
FP8/NVFP4 unit and wire-format tests passing unchanged.
Validation
google/gemma-4-E2B-it-qat-w4a16-ct(4.38 GiBSSD single-planeBF16 PLE table, 43 graphs, 3,405 kernels) with the PR's
flare_heliopauseand served it with the PR's
flarebinary (2.5 GiBresident GPU weights,1024 MiBhost row cache,2.3 GiB/131,072-token KV cache;1.6sstartup).
ISL=2048 / OSL=2048(c=1, 5 req + 1 warmup,MTP0):TTFT
111.2 msavg (136.4 msp50), ITL10.09 ms(99.1 tok/s);12,292gathers,12,248cache hits,4,009direct-I/O reads (87.3 MB),0prefetch errors, andflare_engram_resident_scale_bytes = 0.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
--librun had 1,778 passed and 6 failures intests/support/templates.rs:19(gated HF template returned 401).heliopause:export::core(34 passed — shared & partitioned BF16/IDENTITYexport, 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 unrelatedexport::blobext4ctimefailures.flare-cli: 239 passed, 0 failed.flare: 237 passed, 1 unrelatedhub::testsloopback failure.test_embedding_table_handoff.py(mixed 2-plane + 1-planepeer handoff),
test_core_boundary.py, andtest_design_review_hook.pyall passed.
of a previously exported binary FP8/NVFP4 core were not run locally.
Discord: no username provided