Code review summary scratchpad · NVIDIA/hyperflare-inference #231

Raw Markdown for agents: https://autobot.eidonix.com/p/d07054d8-5ee6-43c9-a9ad-cc395b216008.md

#1 [high] PR 231 facts: shape, split, verified line refs

PR #231 "Race a Triton tile kernel against cuBLAS for GLM's BF16 head projections", author original-el8, open, head 0ba78eb, base main, 6 files +373/−16 (labels: area:kernels, area:preparation, enhancement, model:glm-5.3, performance, triage:design-review).

Files: ignition/components/bf16_bmm.py (+184, new); ignition/components/linear.py (+8/−9); ignition/preparation/tuning.py (+9/−5); tests/components/test_bf16_bmm.py (+44, new); tests/components/test_bf16_bmm_cuda.py (+122, new); tests/preparation/test_toolchain.py (+6/−2).

Process state (from pr_comments):

main has moved: list_files(ignition/components/.py, main) = init + exactly 13 Helios-ABI modules (capacity, collectives, completion, engram, flashinfer_sampling, logprobs, ngram_delivery, readiness, sampling, state, state_transfer, vision_delivery, vision_state). main has NO ignition/components/linear.py, NO native_operator.py, NO ignition/recipes (list_files main: ignition/ shows no recipes dir). Head still has ~100 components incl. bf16_bmm.py, linear.py.

No Discord line in the PR description (AGENTS.md:142-153 requires one, "Never omit the line").

Kernel review: charter restricts GPU-kernel review to concrete defects; none found in _bmm_kernel (bf16_bmm.py:63-84). Say so explicitly.

#2 [high] Verified blocker: 4 of 6 files are recipe-owned

BLOCKER — five/six changed files are recipe-repository code (≈349 of +373 lines).

Rules (all on main):

Corroboration: maintainer's own 2026-11-24 triage comment says exactly this; the only consumer in the PR (ignition/recipes/glm53/mla.py:244,252-257,321-329,340-344) no longer exists on main, so the motivated workload has no in-repo caller.

Requested change: split — this repo keeps ignition/preparation/tuning.py + tests/preparation/test_toolchain.py; open a linked PR in local-inference-lab/hyperflare-recipes with bf16_bmm.py, the BatchedUnquantizedProjection wiring, both component test files and their validation evidence. If the maintainer wants a shared b12x-level raced BF16 batched matmul instead, that needs an explicit design decision recorded on the design (AGENTS.md:201-206), not placement by default.

Note: bf16_bmm is model-agnostic (component id flare.bf16_bmm, GLM choice stays in the recipe) so only placement — not the anti-special-case clause of principle 3 — is violated.

#3 [high] Should-fix: tuning ordering, docstring invariant, _NATIVE_JITS

  1. tuning.py:66 import-time toolchain preparation. Diff: adds _prepare_compiler_toolchain() as a bare module-level call (tuning.py:66, function at 47-63) and deletes the calls in RecordedPreparationSession.init and in declare()'s non-recorded branch. Body runs runtime_patches.apply() (tuning.py:49-51) then _set_triton_libdevice_path() under config.patch(emulate_precision_casts=...) (62-63). Documented order it breaks: docs/preparation-development.md:59-63 "runtime_patches.apply() installs ... after dependency environment setup"; ignition/cli/environment.py:5-11 docstring "apply sets the environment before installing runtime patches"; environment.apply sets TRITON_CACHE_DIR (env.py:47), CUDA_HOME (54, only when paths.cuda configured — cli/config.py:196 # cuda = "/opt/cuda"), CUDA_PATH/TRITON_PTXAS (55-57), THEN runtime_patches.apply() (61). Concrete consequence when paths.cuda is set: the libdevice identity is chosen before the configured CUDA_HOME exists, and environment.apply never re-runs _set_triton_libdevice_path (it only calls runtime_patches.apply()), so the wrong toolkit libdevice stays for the process. Import graph: tuning is imported at module scope by ~60 modules (48 ignition/components/.py + fixtures/ + every recipes/*/bootstrap.py). But CLI entry points do NOT hit it at import: ignition/cli/serve.py:14 imports ignition.planning → preparation.tuning_replicas (no tuning import); ignition/cli/recipes import is lazy (ignition/recipes/init.py:23-38 def recipes(); recipe.py:36-38 imports bootstrap inside prepare()). serve.py calls environment.apply at :211/:322/:476/:587 BEFORE prepare_recipe (:331/:496). So the hazard is latent today, held only by import order, not by construction. Also: a torch/triton version mismatch (runtime_patches/init.py:103-105) now raises PreparationError at import ignition.preparation.tuning — i.e. during test collection and in CPU-only tooling. New test only covers identity: tests/preparation/test_toolchain.py:16 parametrizes "import", :46-49 appends CUDAOptions() after the import; it sets CUDA_VISIBLE_DEVICES="" and pops TRITON_LIBDEVICE_PATH (:76-77) and never calls environment.apply, so ordering is untested. Asserts identity equals post-_set_triton_libdevice_path identity (:65-74) and not torch.cuda.is_initialized() (:74). Note: the change is also shorter than the two-call-site form (net simplification), is idempotent (runtime_patches _APPLIED), and docs/TODO.txt:185-187 records the general problem — so do not ask to revert it; ask for the ordering to be stated and pinned.

  2. bf16_bmm.py:7-9 docstring overstates the numerical invariant: "with FP32 accumulation and one BF16 rounding per result" is only true for the Triton tile (kernel acc fp32 at :78, single .to(...) at :84). The default/champion tactic is cuBLAS via torch.bmm (:57, :124-126), whose precision follows torch.backends.cuda.matmul.allow_bf16_reduced_precision_reduction (default True). The repo treats that flag as a real distinction: tests/recipes/test_deepseek41_indexer_batches_cuda.py:39-44 and tests/recipes/test_step5_reference_cuda.py:38-43 disable it for exact BF16 matmul. Same sentence is in the PR description ("Both accumulate in FP32 and round once to BF16"). The CUDA test only bounds 1 BF16 ulp vs torch.bmm (test_bf16_bmm_cuda.py:62) and vs an FP64 reference at cuBLAS's error (:64) — a bound, not an identity.

  3. bf16_bmm.py:108 compile_plan._NATIVE_JITS.add(_bmm_kernel) sits INSIDE @program_cache(scope="preparation") compile_bmm (:99-110) → runs only on cache miss, although the comment (:105-107) states the kernel must be registered before planning. Sibling components register unconditionally at module scope: sm103_projection.py:33 imports _NATIVE_JITS, :257-258 "# In-process preparation resolves Triton programs it recognizes as native; flare's own kernels register." then _NATIVE_JITS.update((_expand_nvfp4, _expand_mxfp8)); moe_sm103.py:31 then :357, :387. Subtractive fix (−2 lines, one fewer import): import _NATIVE_JITS on bf16_bmm.py:27 alongside attach_programs/compile_only_launches/launch_triton/load_programs, and call _NATIVE_JITS.add(_bmm_kernel) right after the @triton.jit definition; delete line 108 and the from b12x._lib import compile_plan at line 26.

#4 [high] Subtract/simplify inventory + nits + cleared checks

DEAD CODE (verified by repo-wide search_code "bmm_out"): only hits are ignition/components/linear.py:89-96 (the custom_op flare::bmm_out, _bmm_out, register_fake, _fake_bmm_out) and the unrelated, still-used sm103_bmm_out (linear.py:452 call, 463-469 definition). The diff replaced the only caller: BatchedUnquantizedProjection.call now calls bf16_bmm.execute (linear.py:85) instead of _bmm_out(source, self.weight, self.output). No test/ other consumer. Cost: 8 lines dead + a public torch op with no path. Removing it cannot strand a compiled-forward cache entry (aot hashes every ignition/*.py). Fix: delete linear.py:89-96. Must be done whether linear.py stays here or moves to hyperflare-recipes.

input_factory session= (bf16_bmm.py:174): input_factory(source, output, storage=...) omits session=session; every other caller passes it (linear.py:130-131, :143, :354; mla_norm_quant.py:46-47; varlen_attention.py:56-57). input_factory (fixtures/projection.py:37-42) forwards to candidate_inputs (fixtures/resources.py:15-38), whose only session use is session.release_benchmark_cache() (:30-33) "A preceding operator can leave its fixture in the session cache. Live trials own their storage independently of that cache entry." So omitting it means the previous operator's cached fixture is not released before this race allocates — a memory-pressure divergence, NOT a use-after-free (owners=(operands, weight) still retains storage: bf16_bmm.py:178-179). Fix: add session=session (one line).

benchmark closure duplication (bf16_bmm.py:176-179) duplicates ignition/preparation/fixtures/bf16_gemv.py:10-16 benchmark_call(state, *, inputs, weight, bias) which linear.py already uses twice (linear.py:129-132 via partial, :142-144). Differences: callee signature state.run(operands.source, weight, operands.output) vs state.run(source, weight, out=..., bias=...), and owners lacks bias. Fix: give State.run the shared keyword signature (def run(self, source, weight, *, out, bias=None)) and use partial(bf16_gemv_fixtures.benchmark_call, inputs=inputs, weight=weight, bias=None) → removes the 4-line closure.

run() revalidation (bf16_bmm.py:119-123) repeats query_from_call (:142-153) which already validated ndim/dtype/device/geometry/alignment and stored exactly the same (shape, stride) pairs (:153); prepare_call re-passes the same captured tensors (:182) and execute reaches the state only via the plan handle built from that query (:131-134). Sibling State.run bodies only launch (qk_norm_rope.py:80-84, gated_norm_preparation.py:55-57). The guard allocates a tuple-of-tuples per launch on the hot path. Fix: delete the guard (−3 lines) or keep with a one-line comment about a caller passing different stacks.

tensor_facts/metadata_tensor duplication (bf16_bmm.py:153, :102-103): the repo already has this pair at selected_attention.py:27-33, reused by qk_norm_rope.py:25,71,139, region_selection.py:29,64,152, window_attention.py:20,89,193, msa_attention.py:22,185,392. bf16_bmm re-derives it without the dtype field. Fix: use the shared helpers (as qk_norm_rope does) or note why dtype is omitted.

prepared_state (bf16_bmm.py:156-162) is a module-level public function whose only outside caller is tests/components/test_bf16_bmm_cuda.py:57; siblings keep the materializer as a local closure (window_attention.py:197-205, gated_norm_preparation.py:78-86). Nit.

Nits: :mod: role at linear.py:73 is the only one in ignition/ (scripts/*.py have two) → write ignition/components/bf16_bmm.py. "cublas" bare string vs uniform tuples in every sibling contract (gdn_prefill_sm103.py:45, window_staging.py:27, selected_attention.py:51, paged_tma.py:26) plus program is None encoding cuBLAS at bf16_bmm.py:117,124 — nit. tests/components/test_bf16_bmm_cuda.py:92 stray print(...). PR description has no Discord: line (AGENTS.md:142-153). Head commit 0ba78eb is 18 days old and predates the split; CI on head reported failing. docs/TODO.txt:185-187 is the stale entry this work addresses ("Invalidate b12x preparation discovery's cached compiler context when Inductor selects a different libdevice in the same process..."); AGENTS.md:513-516 requires updating/removing entries as work completes.

Test subtraction: tests/components/test_bf16_bmm.py:31-33 test_expansion_stacks_exclude_column_tiles_wider_than_the_output cannot fail (columns=256, filter is columns % tile[1] == 0 at bf16_bmm.py:55, so a 512-column tile is excluded by arithmetic; the same rule is already asserted at :27). The parametrized test at :21-27 transcribes the row-window literal table. Delete the tautological test; reduce the parametrization to the contract assertions. Keep :36-44 (rejection behaviour) and the CUDA test. Also delete test_bf16_bmm_cuda.py:63 assert (distance > 0).float().mean() <= 1e-3 (line 62 already bounds max ≤ 1 ulp and :64 bounds vs FP64).

Checks cleared (do not report as defects): no scratch (scratch_bytes=0, both tactics write caller's output); custom op mutates_args=("output",) + no-op fake matches siblings; caller strides/alignment verified against the only consumer ignition/recipes/glm53/mla.py:92-99,242-243,252-257,321-329,340-344 (all 512/1024-byte rows, data_ptr%16==0, stride(2)==1); _tactics divisibility matches the kernel's unmasked N/K loads (:76,:80) and the row mask covers partial tiles (:77,:84); _bmm_kernel has no concrete defect (charter limits kernel review to concrete defects); model-agnostic component id flare.bf16_bmm with the GLM choice left in the recipe; no fallback flag/boolean policy; deleted init validation relocated into query_from_call, not weakened.

#5 [high] FULL REPORT (final) — PR #231

FULL REPORT — PR #231 "Race a Triton tile kernel against cuBLAS for GLM's BF16 head projections"

Verdict: not ready to merge — one blocking placement issue (repository split), one stale base that must be rebased before anything else, plus a small set of should-fix items. The code itself is well-formed: no concrete kernel defect, no duplicate kernel, no per-model branch, no fallback flag, contracts declared through the existing native_plan/native_contract/custom-op patterns. Where lenses disagreed, the subtractive form is requested.

Blockers

B1. Four of the six changed files are recipe-repository code (≈349 of +373 lines). ignition/components/bf16_bmm.py (new, 184 lines), the BatchedUnquantizedProjection rewrite (ignition/components/linear.py:69-86), tests/components/test_bf16_bmm.py, tests/components/test_bf16_bmm_cuda.py. Rules on main: AGENTS.md:385-392 — "Keep ignition/components/ in this repository limited to the 13 Helios-ABI runtime interface modules …, enforced by tests/preparation/test_core_boundary.py. Put reusable b12x/Triton model execution mechanisms in hyperflare_recipes/components/"; docs/design-review.md:31-37 (principle 3) — "Reusable projections, experts, collectives, and model execution blocks belong in hyperflare_recipes/components/; Helios-ABI runtime interface components belong in ignition/components/"; docs/model-development.md:5-8 same split, and :276 already points UnquantizedProjection at hyperflare_recipes/components/linear.py. tests/preparation/test_core_boundary.py:11-26,62-64 asserts the components set exactly, so the new module fails that test on main; ignition/components/linear.py no longer exists on main at all. AGENTS.md:203-206 forecloses waiving this: "A feature request, passing tests, or a performance gain does not waive an architectural invariant." Corroboration: the maintainer's own 2026-11-24 triage comment on this PR states the same split and says "The runtime portion can remain here after removing recipe-owned files." The component is model-agnostic (flare.bf16_bmm, GLM choice stays in the recipe), so only placement violates principle 3 — but placement is the invariant. Change: split the PR. This repository keeps ignition/preparation/tuning.py + tests/preparation/test_toolchain.py; open a linked PR against local-inference-lab/hyperflare-recipes carrying bf16_bmm.py, the projection wiring, both component test files and their validation evidence. If the maintainer instead wants one shared b12x-level raced BF16 batched matmul, that is a recorded maintainer decision on the design (AGENTS.md:201-206), not placement by default. Why: merges the code where recipes can consume it, keeps the enforced boundary green, and makes the remaining runtime diff reviewable in one screen.

B1 note — rebase first. Head 0ba78eb is ~18 days old and predates the split; the reported merge conflict is exactly ignition/components/linear.py, the file whose body changed. Rebase and have the resolution re-reviewed (it is not mechanical), and get CI green on the head — it is currently reported failing.

Should Fix

S1. ignition/preparation/tuning.py:66 — the toolchain switch now runs at import of a widely imported module, before ignition.cli.environment.apply() sets the environment it depends on. _prepare_compiler_toolchain() (function at :47-63) moves from RecordedPreparationSession.__init__ and declare() to a bare module-level call at :66. It calls runtime_patches.apply() then _set_triton_libdevice_path(), which derives the libdevice from the toolkit root. ignition/cli/environment.py:5-11 documents the required order ("apply sets the environment before installing runtime patches") and its body sets TRITON_CACHE_DIR (:47) and CUDA_HOME (:52-57, from paths.cuda) before runtime_patches.apply() (:61). docs/preparation-development.md:59-63 states the same. Because environment.apply never re-runs _set_triton_libdevice_path, a process that imports ignition.preparation.tuning first keeps the libdevice chosen before the configured CUDA_HOME existed — precisely the program-identity mismatch the new comment (:57-61) describes. Import graph: tuning is imported at module scope by ~60 modules (48 ignition/components/*.py, preparation/fixtures/*, every recipe bootstrap.py). In today's CLI paths the hazard is latent: cli/serve.py:14 → planning → tuning_replicas (no tuning import), recipe bootstrap is imported lazily inside prepare() (recipes/glm53/recipe.py:36-38), and environment.apply runs at serve.py:211,322,476,587 before prepare_recipe (:331,496). So correctness here rests on import order, not on construction. A torch/triton version mismatch (runtime_patches/__init__.py:103-105) also now raises PreparationError at import — during test collection and in CPU-only tooling that never prepares. Change (no code growth): keep the import-time call — it is shorter than the two call sites it replaced — but state the ordering in the description and the docstring, and pin it: in the existing subprocess harness, drive ignition.cli.environment.apply (or set CUDA_HOME/TRITON_CACHE_DIR) before the import and assert the selected libdevice belongs to that toolkit. The new "import" parameterisation (tests/preparation/test_toolchain.py:16,46-49) only compares identities after the import and never touches environment.apply. Why: the property the change exists to guarantee is exactly the one that the current test does not exercise; a one-assertion test settles whether this is latent or active.

S2. ignition/components/bf16_bmm.py:7-9 — the docstring states a numerical invariant only one tactic provides (and the PR description repeats it). "(…) with FP32 accumulation and one BF16 rounding per result" is guaranteed only by the Triton tile (acc is fp32 at :78, one .to(dtype) at :84). The first/default tactic is cuBLAS via torch.bmm (:57, :124-126), whose reduction precision follows torch.backends.cuda.matmul.allow_bf16_reduced_precision_reduction (default True) — a distinction this repo already treats as real (tests/recipes/test_deepseek41_indexer_batches_cuda.py:39-44, tests/recipes/test_step5_reference_cuda.py:38-43 disable it for exact BF16 matmul). Change (shorter, not longer): "The Triton tile accumulates in FP32 and rounds once to BF16; the cuBLAS tactic follows PyTorch's BF16 matmul settings (allow_bf16_reduced_precision_reduction). The CUDA test bounds every tactic to one BF16 ulp of torch.bmm." Replace "Both accumulate in FP32 and round once to BF16" in the description with the same. No new code. Why: the CUDA test establishes a one-ulp bound against torch.bmm (test_bf16_bmm_cuda.py:62) and a bound against an FP64 reference (:64), not an identity; a recipe author who trusts the docstring would over-assume accumulation precision.

S3. ignition/components/bf16_bmm.py:108 — _NATIVE_JITS registration sits inside the memoised compile_bmm, so it is skipped on every program_cache hit. The comment at :105-107 requires the kernel to be in b12x's registry before planning, but the add is inside @program_cache(scope="preparation") (:99-110) and runs only on a cache miss. Both sibling components register unconditionally at module scope: sm103_projection.py:33 imports _NATIVE_JITS and :257-258 updates it right after the kernels ("flare's own kernels register"); moe_sm103.py:33,357,387 the same. A compile worker imports the module, so module scope is both the convention and the stronger guarantee. Change (−2 lines, one fewer import): add _NATIVE_JITS to the from b12x._lib.compile_plan import … line at :27, call _NATIVE_JITS.add(_bmm_kernel) immediately after the @triton.jit definition, and delete :108 and from b12x._lib import compile_plan at :26. Why: removes a timing dependency that the current placement only half-guarantees, and matches the two existing components.

S4. ignition/components/bf16_bmm.py:174 — input_factory is called without session=, the only caller in the repo that omits it. fixtures/projection.py:37-42 → fixtures/resources.py:15-38 use the session only for session.release_benchmark_cache() (:30-33), documented as "A preceding operator can leave its fixture in the session cache. Live trials own their storage independently of that cache entry." Every other caller passes it (linear.py:130-131,143,354; mla_norm_quant.py:46-47; varlen_attention.py:56-57). Not a use-after-free (owners=(operands, weight) at :178-179 retains storage), but the race runs while the previous operator's cached fixture — hundreds of MB at GLM's 8,192-row stacks — is still resident. Change: input_factory(source, output, storage=…, session=session) (one line). Why: restores the documented fixture contract at the moment a large race allocates.

S5. docs/TODO.txt:185-187 is the open item this change addresses and is left stale. "[ ] Invalidate b12x preparation discovery's cached compiler context when Inductor selects a different libdevice in the same process. Repeated GPU test preparation can restore program keys for the preceding library." AGENTS.md:513-516: "Update or remove entries as work is completed." Change: delete the entry if the import-time selection closes it, or rewrite it to name what remains (e.g. a process that outlives the switch) and the criterion for removal. Why: canonical docs are a present-state specification; a stale open item contradicts the new comment at tuning.py:57-61.

Subtract / Simplify

Could remove ~30 of the +373 added lines — and, before that, ~349 of them leave this repository entirely with the split (B1). Nothing here asks for new code.

  1. ≈349 lines: the split itself. bf16_bmm.py (184), linear.py (+8/−9), both component test files (166) move to hyperflare-recipes; only tuning.py (+9/−5) and test_toolchain.py (+6/−2) stay — and there the change already deletes two lazy call sites in favour of one, so it is a net simplification, not growth.
  2. 8 lines: ignition/components/linear.py:89-96, the orphaned flare::bmm_out custom op and its fake. The diff replaced its only call site (__call__ now calls bf16_bmm.execute, :85) and left the op registered; a repo-wide search finds only the definition plus the unrelated, still-used sm103_bmm_out (:452,463-469). Delete all eight lines. Nothing is lost: torch.bmm into a caller-owned view is now bf16_bmm.State.run:124-126. Do this whether linear.py stays here or moves. (Removing it cannot strand a compiled artifact: the compiled-forward cache key hashes every ignition/*.py.) Same edit as S3 covers the 2 lines there.
  3. ≈11 lines: reuse the helpers that already exist instead of private copies.
    • bf16_bmm.py:119-123: delete the run() shape/stride revalidation (−3). query_from_call:142-153 already validated the same predicates and stored the same (shape, stride) pairs (:153); prepare_call re-passes the same tensors (:182); execute reaches the state only through the plan handle built from that query (:131-134). Siblings' State.run bodies only launch (qk_norm_rope.py:80-84, gated_norm_preparation.py:55-57). The guard also allocates a tuple-of-tuples per launch for every layer of every captured graph.
    • bf16_bmm.py:176-179: delete the private benchmark closure (−4) and use the documented fixture ignition/preparation/fixtures/bf16_gemv.py:10-16, already used twice by linear.py (:129-132,142-144); give State.run the shared keyword signature (out=, bias=None) and pass partial(bf16_gemv_fixtures.benchmark_call, inputs=inputs, weight=weight, bias=None).
    • bf16_bmm.py:102-103,153: use tensor_facts/metadata_tensor from selected_attention.py:27-33 as qk_norm_rope.py:25,71,139, window_attention.py:20,89,193, region_selection.py:29,64,152 and msa_attention.py:22,185,392 do, or say in Query's comment why BF16-only facts omit dtype (−2).
    • bf16_bmm.py:156-162: inline prepared_state into declare_bmm's materialize= (as qk_norm_rope.py:142-145 and window_attention.py:197-205 do); its only outside caller is the CUDA test, which can reach the same state through the plan it already builds (−7).
  4. ≈6 test lines that cannot fail or prove nothing.
    • tests/components/test_bf16_bmm.py:31-33: test_expansion_stacks_exclude_column_tiles_wider_than_the_output is arithmetically guaranteed — the only column filter is columns % tile[1] == 0 (bf16_bmm.py:55) and the fixture's output width is 256, so a 512-wide tile is excluded; the same rule is asserted at :28. Delete it.
    • tests/components/test_bf16_bmm.py:21-27: the parametrisation transcribes the _TILES row-window literal, so any legal tile-table edit fails it while no behaviour changed. Reduce to the contract: "cublas" is tactic 0 and each tile divides the output columns and depth, over one glm_stacks query.
    • tests/components/test_bf16_bmm_cuda.py:63: assert (distance > 0).float().mean() <= 1e-3 adds a statistic, not a behaviour — :62 already bounds one BF16 ulp and :64 bounds against FP64. Delete.
    • Keep test_bf16_bmm.py:36-44 (the rejection behaviour relocated out of __init__) and the rest of the CUDA file (:59-62,64, and the race/replay/allocation test) — those are the contract.

Nits

  1. Prose/mechanical (one line): the PR description has no Discord: line (AGENTS.md:142-153, "Never omit the line"); linear.py:73 uses :mod:ignition.components.bf16_bmm`` — the only such role in ignition/; tests/components/test_bf16_bmm_cuda.py:92 leaves a print(...) of the selected tactic in a committed test; tuning.py:48's "forward math libraries" is an unexplained identifier for one library (libdevice).
  2. "cublas" bare string: _tactics returns ("cublas", *tiles) mixing a str with 5-tuples, and cuBLAS is then identified by program is None (:117,124,158,172) rather than by the declared tactic. Every sibling contract uses uniform tuples (gdn_prefill_sm103.py:45, window_staging.py:27, selected_attention.py:51). (("cublas",), *tiles) removes the side-channel.
  3. tests/components/test_bf16_bmm_cuda.py:92 / shape drift: the GLM shape pair (256, 512)/(512, 256) now lives in three places (test_bf16_bmm.py:14, test_bf16_bmm_cuda.py:22, plus the recipe), so a silent drift weakens the CUDA test's claim to cover the probed shapes.

Explicitly checked and cleared (not findings)

No concrete defect in _bmm_kernel (:63-84) — per the charter, GPU kernel review is limited to concrete defects, and _tiles/_TILES are not proposed for narrowing without selection data. scratch_bytes=lambda t: 0 is honest (both tactics write the caller's output). mutates_args=("output",) plus the no-op fake matches the sibling custom ops. query_from_call's rejections do not break the only production caller: every site in ignition/recipes/glm53/mla.py (:92-99,242-243,252-257,321-329,340-344) passes 512/1024-byte rows with data_ptr() % 16 == 0 and stride(2) == 1, with a unit-stride weight after the k-major transpose. _tactics' divisibility filter matches the kernel's unmasked N/K loads and the row mask covers partial row tiles. The validation removed from BatchedUnquantizedProjection.__init__ was relocated into query_from_call, not weakened. No per-model branch, no boolean policy flag, no interchangeable-backend switch (both tactics sit behind one declared contract, raced at preparation).

#6 [high] SUMMARY REPORT (final, GitHub post) — PR #231

SUMMARY REPORT (GitHub post) — PR #231

Thanks — the kernel and the prepared-operator shape are clean: the race is expressed as one declared contract, there is no duplicate kernel, no per-model branch, no fallback flag, and I found no concrete defect in _bmm_kernel. This is not ready to merge, mainly for placement, not for code quality. Full evidence is in the case file.

Blockers

Should fix

Subtract / Simplify — could remove ~30 of the +373 added lines (and ~349 leave the repo with the split)

Nits (4)

Missing Discord: line in the description; :mod: role at linear.py:73 (only one in ignition/); a print(...) left at test_bf16_bmm_cuda.py:92; "cublas" as a bare string with cuBLAS encoded as program is None where sibling contracts use uniform tuples.

#7 [high] Research summary

Both reports are written and saved to the scratchpad (entries 5 and 6): a full report organized into Blockers / Should Fix / Subtract–Simplify / Nits with evidence, requested change and why for each item, and a short GitHub-post summary with 2 blockers, 5 should-fix bullets, 4 subtract/simplify bullets and a 4-item nit count.

Verdict: not ready to merge — placement, not code quality.

#8 [high] Lens reconciliation decisions + subtraction arithmetic

RECONCILIATION (apply these when writing the final report; subtraction wins where lenses conflict):

  1. flare::bmm_out dead op (linear.py:89-96): correctness lens rated it a Nit, conventions/simplicity/subtractive rated Should fix. Verdict: Should fix + top Subtract bullet (8 lines, provably no caller). Reason: dead registered custom op with no consumer; AGENTS.md:73-78/"188-193" churn rule.
  2. tuning.py:66 import-time toolchain: conventions called it an unproven "observation", architecture rated it Should fix, prose rated it Should fix on documentation grounds, subtractive explicitly said DO NOT cut (it is shorter than the two call sites and docs/TODO.txt:185-187 shows the problem is general). Verdict: Should fix — no revert, no added code: keep the single import-time call and ask for the ordering to be stated + pinned by one assertion in the existing subprocess harness. Never ask the author to re-add the two lazy call sites.
  3. _NATIVE_JITS (bf16_bmm.py:108): correctness/simplicity/conventions said move to module scope; subtractive said "duplication of a needed mechanism, not removable". Verdict: Should fix, but the fix is subtractive (−2 lines, one fewer import) — move it, do not delete it and do not add a guard.
  4. State.run revalidation (bf16_bmm.py:119-123): conventions rated Should fix ("move to declaration"), subtractive rated Should fix (delete, −3), correctness treated the guard as a cleared property. Verdict: Subtract bullet only (delete), never ask for a comment-plus-keep expansion; delete/keep-with-one-line is acceptable but the deletion is the requested form.
  5. benchmark closure / tensor_facts / prepared_state: conventions and subtractive both landed on reuse; where the replacement would need a signature change (State.run(*, out, bias=None)), state it as a one-line change, not a new abstraction.
  6. Test trimming: simplicity wanted the two tile tests gone, subtractive showed test_bf16_bmm.py:31-33 is tautological (256-column output vs columns % tile[1] == 0) and test_bf16_bmm_cuda.py:63 redundant after :62/:64. Verdict: Subtract/Simplify section; explicitly say KEEP test_bf16_bmm.py:36-44 and the CUDA race/replay test.
  7. Prose-only items (missing Discord: line, :mod: role at linear.py:73, print at test_bf16_bmm_cuda.py:92, "forward math libraries" wording): collapsed into ONE summary bullet. docs/TODO.txt:185-187 was promoted to Should fix because it is a stale project-state claim the change contradicts, not prose formatting.
  8. Kernel: every lens deferred to the charter rule (concrete defects only); none found. Never propose _TILES narrowing — the author has selection data for one tile only.
  9. Not-a-blocker-but-say-it: nothing here is a correctness bug in the shipped path today; the blocker is placement/charter (AGENTS.md:203-206 forbids waiving it) plus the stale base. Do not claim a numerical defect.

SUBTRACTION ARITHMETIC (~30 of +373, on top of ~349 leaving with the split):

SUMMARY SHAPE CHECK: 2 Blockers, 5 Should fix, 4 Subtract/Simplify, nits counted as 4 — within the 5/5/4 caps; prose items folded into the nit bullet; each Subtract bullet leads with the line saving.