Final review report · NVIDIA/hyperflare-inference #728

Raw Markdown for agents: https://autobot.eidonix.com/p/af9a45fd-7bfd-4937-b777-75539f3bf2cc.md

Recommendation: Changes Requested

PR #728 is technically sound across its four subsystems — Heliopause reachability diagnostics (reachability.rs), CoreStorage.warmup_pool() + auxiliary overlap stream seeding (core_storage.py, capture.py), Rust-backed ForwardCache source hashing (source_identity.{rs,py}, aot.py), and bound source_roots propagation plus static-only Triton AOT guard contracts (compile_pool.py, inductor_tuning.py, aot.py) — with zero verified blockers. One real error-handling gap warrants fixing before merge: forward_source_identity (ignition/preparation/source_identity.py:104-125) silently hashes zero FlashInfer native sources instead of raising RuntimeError when data/ is absent and sibling {include,csrc} directories are not both present, diverging from _source_identity in the same file.

Merge Risk

Level: Medium

Walkthrough

Pre-merge Checks

Blockers

None.

Should Fix

  1. Fail loudly in forward_source_identity when FlashInfer native source directories are missing (ignition/preparation/source_identity.py:104-125).
    • Verified behavior: forward_source_identity checks if data.exists(): (raising RuntimeError if data/include or data/csrc is missing) and elif (flashinfer_package.parent / "include").is_dir() and (flashinfer_package.parent / "csrc").is_dir():, with no else branch. If data/ does not exist and either sibling directory (include or csrc) is missing (or both are absent), execution falls through to return digest.hexdigest() at :136 with zero FlashInfer native sources hashed and no error. This silently reopens the stale-ForwardCache hazard on partial or non-standard FlashInfer installs and diverges from sibling _source_identity (source_identity.py:187-192), which unconditionally raises RuntimeError("FlashInfer native source directory is unavailable: ...").
    • Concrete fix: Resolve each native directory up front (data / name, falling back to flashinfer_package.parent / name when not data.exists()) and raise RuntimeError if either include or csrc is not a directory, matching _source_identity:
      for name in ("include", "csrc"):
          native = (data / name if data.exists() else flashinfer_package.parent / name).resolve()
          if not native.is_dir():
              raise RuntimeError(
                  f"FlashInfer native source directory is unavailable: {data / name}; "
                  "install the selected FlashInfer package before preparation"
              )
          mix_hex(f"flashinfer.{name}", flare_heliopause.export_source_identity([native]))
      
      Add a negative unit test in tests/preparation/test_forward_cache_sources.py covering a missing data/ + missing native tree.

Subtract / Simplify

  1. Deduplicate cuBLAS workspace seeding between _seed_warmup_workspaces and _seed_auxiliary_workspaces (ignition/preparation/capture.py:73-79, 99-107). Both construct identical (512, 512) bfloat16 operand/out and (512,) bias tensors and run torch.mm + torch.addmm, differing only in stream, pool context, and the extra torch.bmm. Extract one helper _seed_blas_workspaces(stream, device, pool, *, batched=False) so the seeded op list and shapes stay in one place.
  2. Pass a single excluded_paths list instead of splitting excluded_directories and excluded_files (ignition/preparation/aot.py:905-916, ignition/preparation/source_identity.py:65-66,93-94, heliopause/src/export/binding.rs:1149-1168, heliopause/src/export/source_identity.rs:73-75). binding.rs:1157-1160 immediately concatenates both vectors into one excluded Vec<PathBuf> and collect() checks exact PathBuf equality for both directories (:20) and files (:43). Accepting a single flat exclusion list removes the .endswith('.py') partition in ForwardCache.__init__, drops an unnecessary PyO3 keyword argument, and removes the if excluded.is_empty() wrapper branch in binding.rs.
  3. Collapse the redundant None check in _seed_warmup_workspaces (ignition/preparation/capture.py:69-72) and group the CompiledKernel import (ignition/preparation/aot.py:187,223). Replace the nested if pool is None dict lookup with pool = _warmup_pools.setdefault(index, torch.cuda.MemPool()), and group from triton.compiler import CompiledKernel with from triton.runtime import JITFunction at :187 (or module level).
  4. Simplify unresolved_report example selection (heliopause/src/export/reachability.rs:230-292). unresolved_count() and unresolved_unique_addresses() are single-line helpers used only in unresolved_report (and tests), and tracking insertion order alongside unresolved avoids sorting all entries by order, maintaining a parallel chosen: Vec<bool>, and re-sorting selected.

Nits

Dropped on verification