#1 [high] Blocking: PR body of work belongs in hyperflare-recipes, not this repo (≈350 lines)
The repository moved after this PR's base (91cfb369). On main today:
AGENTS.md:385-392(main): "Keepignition/components/in this repository limited to the 13 Helios-ABI runtime interface modules (capacity,collectives,completion,engram,flashinfer_sampling,logprobs,ngram_delivery,readiness,sampling,state,state_transfer,vision_delivery,vision_state), enforced bytests/preparation/test_core_boundary.py. Put reusable b12x/Triton model execution mechanisms inhyperflare_recipes/components/."tests/preparation/test_core_boundary.py:11-26,62-64(main) assertsRETAINED_IGNITION_COMPONENTS == {py.stem for py in ROOT/'ignition/components'.glob('*.py')}— an exact set. Addingbf16_bmm.py(and the existinglinear.py) makes that test fail on main.tests/preparation/test_core_boundary.py:40-48:ignition/recipesmust not exist;ignition/recipes/glm53/mla.py(the only caller ofBatchedUnquantizedProjection, mla.py:16,244,252-257,321-329,340-344) is gone from main too.docs/design-review.md:33-37(main): "Recipes (inlocal-inference-lab/hyperflare-recipes…) own model composition and checkpoint mapping. Reusable projections, experts, collectives, and model execution blocks belong inhyperflare_recipes/components/; Helios-ABI runtime interface components belong inignition/components/."- PR comment by original-el8, 2026-11-24: "Repository-split triage: this PR spans both repositories and remains open for its runtime changes. hyperflare-recipes: the BF16 batched-matmul implementation, projection wiring, and component tests. This runtime repository: the compiler-toolchain initialization change in
ignition/preparation/tuning.py. The recipe portion needs a linked PR against thehyperflare_recipes/package … The runtime portion can remain here after removing recipe-owned files."
So of the 6 files, four are recipe-owned and should leave this repo entirely:
ignition/components/bf16_bmm.py(+184/−0)ignition/components/linear.py(+8/−9) — andlinear.pyitself is no longer a permitted component file on maintests/components/test_bf16_bmm.py(+44/−0)tests/components/test_bf16_bmm_cuda.py(+122/−0)
≈349 added lines leave; the PR in this repo reduces to the ~9-line ignition/preparation/tuning.py change plus its 6-line tests/preparation/test_toolchain.py addition. Also: the description's justification for the tuning.py change is explicitly "The new component's CUDA tests compile per-tactic kernels before their race test in one process and need this ordering" — once those tests move out, the stated reason for the runtime change does not rest on anything in this repository (though docs/TODO.txt:185-187 on main does record the same libdevice/program-key problem generally, so the change is not unmotivated).
#2 [high] Should fix: dead flare::bmm_out custom_op left behind (8 lines)
ignition/components/linear.py:89-96 — the change deletes the only caller of flare::bmm_out:
- removed from the diff:
_bmm_out(source, self.weight, self.output)inBatchedUnquantizedProjection.__call__(replaced bybf16_bmm.execute(...), linear.py:85 now). _bmm_out(custom_op,mutates_args=("out",)) +_fake_bmm_outremain: linear.py:89-96.
Verified no other consumer anywhere: search_code "_bmm_out|bmm_out" returns only linear.py:89-95 and the unrelated sm103_bmm_out (linear.py:452,463-470, still used by BatchedQuantizedProjection). bmm_out in tests/ → no matches; in helios/ → no matches; in docs/ → no matches. Nothing registers or calls flare.bmm_out.
Smaller version: delete lines 89-96 entirely (8 lines), including @_bmm_out.register_fake. Nothing is lost: BatchedUnquantizedProjection no longer calls it, and torch.bmm is still reachable inside bf16_bmm.State.run (bf16_bmm.py:125) for the cuBLAS tactic.
Note this deletion belongs in this change either way: if the component moves to hyperflare-recipes, linear.py moves whole; if the component stays here, the op is dead code left behind by the diff.
#6 [high] Research summary
Reviewed PR #231 with a subtraction lens: read the diff, all six changed files in context, the only caller (ignition/recipes/glm53/mla.py), the helpers it could reuse, and the repository rules (AGENTS.md, docs/design-review.md, docs/core-design.md, docs/TODO.txt, tests/preparation/test_core_boundary.py) both at the PR head and on main.
The dominant finding is that most of this PR no longer belongs in this repository at all. main has moved to a split layout: AGENTS.md:385-392 limits ignition/components/ to an explicit set of 13 Helios-ABI modules, tests/preparation/test_core_boundary.py:62-64 enforces that set exactly, and ignition/recipes no longer exists. Four of the six changed files (bf16_bmm.py, linear.py, and both new test files, ≈349 added lines) are recipe-owned model execution, and the maintainer's own 2026-11-24 triage on the PR says the same thing and asks for only the ignition/preparation/tuning.py change to remain here.
Below that, I recorded four code-level subtractions worth ≈20 lines: the diff leaves flare::bmm_out (linear.py:89-96) with no remaining caller anywhere in the repo; State.run re-validates shapes and strides that query_from_call already fixed when the plan was declared; declare_bmm re-implements fixtures/bf16_gemv.benchmark_call; and two of the new assertions prove nothing (a tautological tile-width test and a redundant ULP-fraction threshold). Details, line counts, smaller versions and citations are in the scratchpad.
Not counted as savings: the CUDA kernel itself, the _TILES table and the _NATIVE_JITS registration are GPU kernel code, where the charter permits only concrete defects — I found none to report and proposed no redesign.
#7 [high] Totals, ranking, and what I examined and did NOT cut
Diff arithmetic (from pr_files / pr_diff)
6 files, +373 / −16.
ignition/components/bf16_bmm.py+184 −0 (new)ignition/components/linear.py+8 −9ignition/preparation/tuning.py+9 −5tests/components/test_bf16_bmm.py+44 −0 (new)tests/components/test_bf16_bmm_cuda.py+122 −0 (new)tests/preparation/test_toolchain.py+6 −2
Additions total 373; removed 16. New test lines total 166; new component lines 184.
Ranking by lines saved
- Blocking — ≈349 added lines. Scope-to-other-repo (scratchpad entry 1):
bf16_bmm.py(184) +linear.pychanges (17) + both test files (166) = 367 gross; counted as ≈349 net additions after the 17-linelinear.pychurn (8 added are reworked, 9 genuinely removed). In this repo the PR shrinks to +9 −5 (tuning.py) and +6 −2 (test_toolchain.py). - Should fix — 8 lines. Dead
flare::bmm_out(entry 2). - Should fix — 5 lines.
State.runrevalidation (entry 3). - Nit — 5 lines.
declare_bmmduplicatesfixtures/bf16_gemv.benchmark_call(entry 4). - Nit — 4 lines. Tautological test + redundant assertion (entry 5).
Sum of the code-level savings inside the component: ≈22 lines (8+5+5+4). Against 373 added lines that is ~6% — the component is compact for what it does; the size problem is location, not padding.
Examined and NOT cut (so the report can say what is already minimal)
_bmm_kernel(bf16_bmm.py:63-84): GPU kernel code. Charter (charter line 44/docs/design-review.mdGPU-kernel rule) permits only concrete defects; I found none to report. No redesign proposed._TILES(bf16_bmm.py:42-43): 7 entries, each reachable at a distinct row/column regime;_tactics(52-57) filters them bycolumns % tile[1]and depth, andtests/components/test_bf16_bmm.py:21-27covers the row scaling. Not narrowing it without measurement evidence, which I do not have.compile_plan._NATIVE_JITS.add(_bmm_kernel)(bf16_bmm.py:108): mirrors the existing pattern atignition/components/sm103_projection.py:258andmoe_sm103.py:357,387. Duplication of a needed hook, not removable._launch(bf16_bmm.py:87-96): genuinely shared bycompile_bmmandState.run; a single tuple-returning helper, not a pass-through wrapper.prepared_state(156-162) /declare_bmm(165-184): each does real work (load_programs + attach_programs; plan + declare). Same shape asgated_norm_preparation.py:72-103.execute+register_fake(131-139): standard custom-op pair required for capture/tracing; same pattern as every other component.docs/docstring(bf16_bmm.py:5-19, 15 lines): largely measurement narrative; a case could be made for trimming the 4-line cuBLAS paragraph (lines 13-18) since the PR description carries the numbers, but the project's prose rule asks for reasons in code, so I did not count it as a subtraction.ignition/preparation/tuning.py+9 −5: the import-time_prepare_compiler_toolchain()call (line 66) replaces two call sites (removed at the old__init__anddeclare). The change is shorter than the two-call-site form and matches the general problem already recorded atdocs/TODO.txt:185-187onmain. Not a subtraction.tests/preparation/test_toolchain.py"import"parameter (lines 16, 46-49): one extra parametrization of an existing test, 4 lines, tests the new ordering the tuning.py change introduces. Keep.
Dropped candidates (could not show from the code)
- Reducing the 7
_TILESto fewer: no evidence which are ever selected; the PR reports the 64x128x64 tile winning on both GB10 and SM120. - Folding
_tactics' row-capacity filter intonative_contract: would move, not remove, lines. - Removing
scratch_bytes=lambda t: 0orcompile_jobsfromnative_plancall: both are existing required parameters of the shared helper (native_operator.py:87-97).
#3 [medium] Should fix: State.run revalidates strides query_from_call already enforced (5 lines)
ignition/components/bf16_bmm.py:119-123 — State.run re-validates shapes and strides on every call:
def run(self, source, weight, output):
tensors = (source, weight, output)
if any((tuple(t.shape), tuple(t.stride())) != declared
for t, declared in zip(tensors, self.query.operands, strict=True)):
raise ValueError("batched projection operands differ from the declared stacks")
Every caller already guarantees this by construction:
- the
State'squeryis derived from those same three tensors:declare_bmm(bf16_bmm.py:167) callsquery_from_call(source, weight, output), which raises on the same mismatches (bf16_bmm.py:142-153), and stores exactlytuple((tuple(t.shape), tuple(t.stride())) for t in tensors). prepare_callre-passes the samesource, weight, outputcaptured indeclare_bmm(bf16_bmm.py:182).executeonly reaches the state via the plan handle built from that query (bf16_bmm.py:131-134).- the single in-repo caller,
ignition/recipes/glm53/mla.py:252-257/321-329/340-344, passes fixed scratch views (scratch.query.transpose(0,1)etc.) created once — GLM'sMLAScratch.rows()slices the same buffers, so strides are unchanged.
Smaller version: drop the check, leaving
def run(self, source, weight, output):
if self.program is None:
torch.bmm(source, weight, out=output)
return
args, options, _, grid = _launch((source, weight, output), self.tactic)
self.program[grid](*args, *options.values())
Saves 5 lines and one tuple-of-tuples comparison per launch, which sits in the captured hot path (the graph replays this per layer). Nothing lost: a mismatched call already cannot be declared, and the compiled program is specialized to the declared strides anyway.
#4 [medium] Nit: declare_bmm duplicates fixtures/bf16_gemv.benchmark_call (5 lines)
ignition/components/bf16_bmm.py:176-179 repeats an existing helper almost line for line.
The repo already has ignition/preparation/fixtures/bf16_gemv.py:10-16:
def benchmark_call(state, *, inputs, weight, bias):
operands = inputs()
return PreparedCall(
run=lambda: state.run(operands.source, weight, out=operands.output, bias=bias),
produce=operands.produce, output=operands.output,
owners=(operands, weight, bias),
)
and ignition/components/linear.py:139-145 already consumes it that way (partial(bf16_fixtures.benchmark_call, inputs=input_factory(...), weight=weight, bias=bias)).
This PR instead writes a private closure in declare_bmm with the same body:
def benchmark(state):
operands = inputs()
return PreparedCall(run=lambda: state.run(operands.source, weight, operands.output),
produce=operands.produce, output=operands.output, owners=(operands, weight))
Smaller version: give State.run the shared keyword signature (def run(self, source, weight, *, out, bias=None)), then
declare(session, (plan.request(name=name,
prepare_call=lambda state: PreparedCall(run=lambda: state.run(source, weight, out=output)),
benchmark_call=partial(bf16_gemv.benchmark_call, inputs=inputs, weight=weight, bias=None)),))
Saves the 4-line closure plus one local lambda per call site (~5 lines) and uses the helper the rest of linear.py uses. Behaviour identical — bf16_bmm takes no bias, so bias=None matches today's 2-tuple owners (the extra None owner is what UnquantizedProjection already passes).
#5 [low] Nit: one tautological test and one redundant assertion (4 lines)
Two small dead/duplicate test assertions in the new files:
-
tests/components/test_bf16_bmm.py:31-33,test_expansion_stacks_exclude_column_tiles_wider_than_the_output, is tautological: the only filter_tacticsapplies to columns iscolumns % tile[1] == 0(bf16_bmm.py:55), and for the "k" stacks the output width is 256, so tiles of 512 columns are excluded by arithmetic. The assertion can never fail while_tacticsiscolumns % tile[1] == 0. The name also says "expansion" but nothing distinguishes major="k" there except the caller's fixture widths. Deleting the test saves 3 lines (32-33 plus its blank line); thecolumns % tile[1] == 0rule is already covered by the parametrized test at line 27. -
tests/components/test_bf16_bmm_cuda.py:63,assert (distance > 0).float().mean() <= 1e-3, is a third numerical check on the same comparison. Line 62 already boundsdistance.max() <= 1and line 64 bounds the error against the FP64 reference by cuBLAS's own error; a fraction threshold adds a statistic, not a behaviour, and the PR description states the tiles are bitwise equal at the probed shapes (i.e. the fraction is 0). The sentinel/isfinitechecks (lines 59-60) are the distinct row-tail behaviour and stay. Deleting line 63 saves 1 line.
Keep: lines 59-60 (row-tail masking via NaN sentinels), 62 and 64 (contract: one BF16 ulp, and no worse than cuBLAS against FP64).