Skip to content

Migrate ignition runtime patches and preparation onto public b12x contracts - #648

Merged
lukealonso merged 1 commit into
mainfrom
unify-b12x-public-contracts
Nov 30, 2026
Merged

lukealonso merged 1 commit into
mainfrom
unify-b12x-public-contracts

Conversation

@lukealonso

Copy link
Copy Markdown
Collaborator

Why

Ignition previously imported private b12x.*._* internals across 14 files in ignition/runtime_patches/, ignition/preparation/, and ignition/components/. Before this change:

  • ignition/runtime_patches/workers.py monkey-patched b12x._lib.compile_pool._initialize_worker at runtime to install Triton patches in offline worker processes.
  • ignition/preparation/{collectives,composition_tuning,core_storage,forward_metadata,peer_storage,persistent,remote_weights,tuning,tuning_shards,virtual_storage}.py and ignition/components/engram.py reached into private b12x.preparation.{_cache,_collective,_discovery,_measurement}, b12x._lib.{compile_plan,compile_pool,scratch}, and private PreparationSession attributes (_check_thread, _synchronize, _cancelled, _cache, _scratch_limit_bytes, _reclaim_programs).

Paired with local-inference-lab/flashinfer#194, migrating Ignition onto the public b12x worker-initializer hook and preparation API removes monkey-patching and private coupling while keeping Helios runtime code, Protobuf schemas, and exported model-core compatibility untouched.

What Changed

  • Worker initialization (ignition/runtime_patches/{__init__,triton,workers}.py):
    • Before: workers.py patched compile_pool._initialize_worker directly and triton.py mutated private worker hooks inline.
    • After: workers.py registers and unregisters the Triton patcher through b12x.preparation.register_worker_initializer and unregister_worker_initializer.
  • Preparation and components (ignition/preparation/{collectives,composition_tuning,core_storage,forward_metadata,peer_storage,persistent,remote_weights,tuning,tuning_shards,virtual_storage}.py, ignition/components/engram.py):
    • Before: imported private b12x.*._* modules and accessed private PreparationSession / SelectionCache / Plan attributes directly.
    • After: uses public b12x.preparation APIs (check_thread, synchronize, is_cancelled(), selection_cache, scratch_limit, reclaim_programs, SelectionCache.set_agreed_records, custom_plan, is_composite_plan, plan_variants, plan_memory_requirements, plan_compile_jobs, scratch/compile helpers) plus public b12x.comm.pcie, b12x.loader, and b12x.sequence exports.

Claimed Benefit and Result

  • Measured: 0 private b12x.*._* imports remain anywhere under ignition/, and offline CompilePool workers execute registered Triton patches before their first job without monkey-patching private functions.
  • Expected: insulates Ignition preparation and runtime patches from internal b12x refactors without altering Helios or exported model cores.

Supporting Evidence and Limitations

Tested against local-inference-lab/flashinfer#194 and the paired local-inference-lab/hyperflare-recipes PR:

  • tests/preparation/{test_runtime_patches,test_tuning_shards,test_compile_pool,test_persistent}.py: 88 passed, 0 failed (including test_b12x_offline_worker_installs_triton_fix_before_first_job).
  • tests/preparation/{test_scratch,test_checkpoint_source,test_unavailable_resources}.py (run with test_runtime_patches and test_tuning_shards): 121 passed, 1 skipped, 0 failed.
  • End-to-end RecordedPreparationSession.tune() + CompilePool worker execution verified on Blackwell SM120 GPU 0 via hyperflare-recipes window staging and window attention CUDA tests.
  • Dependencies & material limitations:

Discord: lukealonso

…tracts

Why this change is needed and why this approach:
Ignition previously imported private b12x.*._* internals across 14 files under
ignition/runtime_patches/, ignition/preparation/, and ignition/components/.
Before this change, ignition/runtime_patches/workers.py monkey-patched
b12x._lib.compile_pool._initialize_worker directly to apply Triton patches in
worker processes, while ignition/preparation/{tuning,tuning_shards,collectives,
composition_tuning,forward_metadata,peer_storage,remote_weights,persistent,
virtual_storage,core_storage}.py reached into private session, cache, plan,
scratch, and loader modules. Migrating Ignition onto the public b12x worker
initializer hook and public preparation API removes monkey-patching and private
symbol coupling without changing Helios runtime code, Protobuf schemas, or
exported model core compatibility.

What changed:
- Worker initialization (ignition/runtime_patches/{__init__,triton,workers}.py):
  - Before: workers.py replaced compile_pool._initialize_worker at runtime and
    triton.py mutated private Triton/compile_pool hooks inline.
  - After: workers.py registers and unregisters the Triton patcher through
    b12x.preparation.register_worker_initializer and
    unregister_worker_initializer.
- Preparation and components (ignition/preparation/{collectives,
  composition_tuning,core_storage,forward_metadata,peer_storage,persistent,
  remote_weights,tuning,tuning_shards,virtual_storage}.py and
  ignition/components/engram.py):
  - Before: imported private b12x.preparation.{_cache,_collective,_discovery,
    _measurement}, b12x._lib.{compile_plan,compile_pool,scratch}, and private
    session attributes (_check_thread, _synchronize, _cancelled, _cache,
    _scratch_limit_bytes, _reclaim_programs).
  - After: uses public b12x.preparation methods and functions (check_thread,
    synchronize, is_cancelled(), selection_cache, scratch_limit,
    reclaim_programs, SelectionCache.set_agreed_records, custom_plan,
    is_composite_plan, plan_variants, plan_memory_requirements,
    plan_compile_jobs) plus public b12x.comm.pcie, b12x.loader, and
    b12x.sequence exports.

Claimed benefit and result:
- Measured: zero private b12x.*._* imports remain anywhere under ignition/
  across all 14 modified files, and offline CompilePool worker initialization
  executes registered Triton patches cleanly without monkey-patching private
  functions.
- Expected: insulates Ignition preparation and runtime patches from internal
  b12x module reorganization while keeping Helios and model-core compatibility
  unchanged.

Supporting evidence and limitations:
- Tested against the paired flashinfer and hyperflare-recipes worktrees:
  - tests/preparation/{test_runtime_patches,test_tuning_shards,
    test_compile_pool,test_persistent}.py: 88 passed, 0 failed (including
    test_b12x_offline_worker_installs_triton_fix_before_first_job).
  - tests/preparation/{test_scratch,test_checkpoint_source,
    test_unavailable_resources}.py (with test_runtime_patches and
    test_tuning_shards): 121 passed, 1 skipped, 0 failed.
  - End-to-end RecordedPreparationSession.tune() + CompilePool execution verified
    on Blackwell SM120 GPU 0 via hyperflare-recipes window staging and window
    attention CUDA tests.
- Material limitations: requires the paired local-inference-lab/flashinfer PR
  (public b12x contracts) before merging/updating locked dependencies. Helios
  Rust crates, TLA+ models, Kani proofs, and scheduling simulators were not run
  because no files outside Python ignition/ were modified. Multi-GPU TP export
  was not run on this single-GPU host.

Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b
Signed-off-by: Luke Alonso <lalonso@gmail.com>
@lukealonso
lukealonso merged commit 555db71 into main Nov 30, 2026
1 check failed
Raydius added a commit to Raydius/flare-local-inference that referenced this pull request Nov 30, 2026
Why: the stack now bases on upstream/main `e85019b9b`, whose preparation
imports the public b12x contracts that upstream added with NVIDIA#648 -
`declaration_key`, `custom_plan`, `coalesce_requests`, `CudaRTLibrary` and
`hash_op`. The previous pin, `Raydius/flashinfer@d0301ec6` on upstream
`335459b2`, predates them, so `ignition/preparation` raises ImportError at
collection on the new base and the Python suites cannot run.

What changed: `[tool.uv.sources] flashinfer-python` names
`Raydius/flashinfer@cfc2c0d7254076275f0eb8ba201f250ebc78869e`, which is the
fork's single eviction commit rebased onto upstream `274eb290` ("perf(b12x/comm):
fuse addend in RoCE oneshot/twoshot, lower 4-rank pipe threshold, and guard
gated all-gather (NVIDIA#190)"). The re-cut also brings the fork's carried
`tests/experimental/b12x/preparation/test_first_use_compile.py` up to
upstream's current memo: an activated preparation scope keys tensor and
mapping arguments through the metadata pickle, so the two cache cases now
assert what the mechanism does and the inventory guard records the five
compile factories upstream added without a preparation scope.

Result: the b12x import surface the migrated preparation requires is
present, and the fork's planning-stub rejection still carries weight on the
new base rather than being redundant with upstream's own
`evict_planning_artifacts`, which runs before compilation instead of on the
factory result.

Evidence: on the pinned revision the carried file gives 23 passed; on
unmodified `274eb290` the same file gives 2 failed, 21 passed, failing
exactly `test_run_job_rejects_unresolved_planning_stub` and
`test_compile_compress_memo_is_a_program_cache` - the FORK.md condition that
the cases fail unmodified and pass pinned. Measured in
`local/flare-ignition:08b3134a-e758d766` with GPU 1 (RTX 5060 Ti) visible.
`uv lock --check` in the paired recipes repository resolves 105 packages
against the same revision. Kani has not run: it is not installed on this
host.

Design-Signed-Off-By: omp (qllm/qLLM); design-review=2e5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant