Case file: PR #231 — "Race a Triton tile kernel against cuBLAS for GLM's BF16 head projections"
Repository NVIDIA/hyperflare-inference · author original-el8 (Jason Cook) · open, "ready for review" · base main, head 0ba78eb · +373/−16 in 6 files · labels area:kernels, area:preparation, enhancement, model:glm-5.3, performance, triage:design-review · link: https://github.com/NVIDIA/hyperflare-inference/pull/231
Key findings
- Main has already reversed the component half of this PR. Commit
da037284(Luke Alonso, 2026-11-22) "Stage hyperflare_recipes separation, slim core ignition" removedignition/recipes/and all model components. Onmain,ignition/components/holds 14 files (__init__, capacity, collectives, completion, engram, flashinfer_sampling, logprobs, ngram_delivery, readiness, sampling, state, state_transfer, vision_delivery, vision_state) andtests/preparation/test_core_boundary.py:11-26,62-64asserts exactly that set;tests/preparation/test_core_boundary.py:40-48also assertsignition/recipesdoes not exist.git grep BatchedUnquantizedProjectiononmainreturns nothing. PR #231 adds a 15th component file and rewires alinear.pythat no longer exists there. The PR's own latest comment (original-el8, 2026-11-24, "Repository-split triage") concedes that the BF16 batched-matmul "implementation, projection wiring, and component tests" belong inhyperflare-recipesand only "the compiler-toolchain initialization change inignition/preparation/tuning.py" can remain here, "after removing recipe-owned files". - Undeclared behavioral tightening for existing callers. The old class did
torch.bmmon whatever 3-D BF16 stacks it was given (removed validation lines in thelinear.pydiff only checked shapes/dtype/device). The replacementquery_from_call(ignition/components/bf16_bmm.py:142-153) raisesValueErrorunless source and output havestride(2) == 1, the weight is K- or N-contiguous, and every operand'sdata_ptr() % 16 == 0. The description never mentions this precondition. It collides head-on with #471 (see Related work), which adds a staging-copy path because "BatchedUnquantizedProjectioncopies a source whose inner stride is not one, whose rows overlap, or whose batch slices interleave across rows… Kimi K3 and Kimi K3.1 Pro pass transposed views to this class." - The tuning.py change is a process-wide side effect, not just an ordering fix.
_prepare_compiler_toolchain()now runs at import ofignition.preparation.tuning(ignition/preparation/tuning.py:66) and callsignition.runtime_patches.apply(), which hard-fails withPreparationErroron any torch !=2.14.1+cu132or triton !=3.8.0and then patches TorchDynamo/scheduler/functionalization, before_set_triton_libdevice_path()needs the CUDA toolkit (ignition/preparation/tuning.py:47-63;ignition/runtime_patches/__init__.py:21-22,81-105). Roughly sixty component, recipe and test modules import from this module, so any such import now installs runtime patches and version gates at import time. The description frames the move only as "prepares the compiler toolchain … at import instead of at session construction". - Claims outrun the evidence. The four GB10 kernel timings have no attached logs, traces or script. "Every tile is bitwise equal to
torch.bmm" is not what the test enforces:tests/components/test_bf16_bmm_cuda.py:61-64asserts max ULP distance ≤ 1, at most 1e-3 of elements differing at all, and error ≤ 1.05× cuBLAS error. The single served number (2945 vs 2620–2631 tok/s TP2 8,192-token prefill, two DGX Sparks) is a combined package that the description itself says "is not attributed to this PR alone". The headline GB10 validation, the GLM MLA checkpoint test and SM103 were "not run on this branch" — they ran on an integration branch or with different component source. - Process and approval state. No code change since the head commit on 2026-11-07 (base
91cfb369, also 2026-11-07); the only later activity is the author's own conflict notice (2026-11-13) and repo-split triage (2026-11-24). The merge conflict onignition/components/linear.pywas never resolved and has since become an add/delete. The PR adds a new captured-graph operation contract (flare::bf16_bmm), which perdocs/design-review.md:21-26(identical wording onmain) "requires prior explicit approval from project owner Luke Alonso lalonso@gmail.com"; thetriage:design-reviewlabel has drawn no review. Head CI is red, but the only pull_request workflow (.github/workflows/native-serving.yml:1-110(not opened)) runs cargo builds/tests plus a Hugging Face fixture prep, no pytest — so red CI is not evidence about the Python changes.
The change: what it does, how big, and what it does not say
Size and files (from pr_files): ignition/components/bf16_bmm.py (new, +184), ignition/components/linear.py (+8/−9), ignition/preparation/tuning.py (+9/−5), tests/components/test_bf16_bmm.py (new, +44), tests/components/test_bf16_bmm_cuda.py (new, +122), tests/preparation/test_toolchain.py (+6/−2).
In plain terms. bf16_bmm.py declares a native tuning component flare.bf16_bmm:
- A
Querydataclass records the(shape, stride)pair of each of the three operands — the plan key includes exact strides, not just shapes (bf16_bmm.py:142-153). _tactics()returns"cublas"first, then Triton tile tactics from_TILES= ((64,128,64,4,3), (64,256,64,8,3), (128,128,64,8,3), (128,256,64,8,2), (32,128,64,4,3), (16,128,64,4,3), (16,64,64,2,3)), filtered bycolumns % BLOCK_N,depth % BLOCK_K,BLOCK_M <= max(16, 2*rows)and4*BLOCK_M >= min(rows,128).- One
@triton.jit _bmm_kernel: FP32 accumulator viatl.dot, a single.to(bfloat16)on store, masked row tail, grid(row_tiles*col_tiles, G, 1). compile_bmmis@program_cache(scope="preparation"); it builds meta tensors withtorch.empty_strided, adds_bmm_kernelto b12x'scompile_plan._NATIVE_JITS(bf16_bmm.py:108), and compiles undercompile_only_launches().State.runfalls back totorch.bmm(source, weight, out=output)when no program is loaded (bf16_bmm.py:124-126), i.e. cuBLAS is tactic 0 and the permanent fallback.- A new custom op
flare::bf16_bmm(mutates_args=("output",),bf16_bmm.py:131-139) executes a plan by integer handle. declare_bmmbuilds anative_planwithscratch_bytes=lambda t: 0,fixtures.projection.input_factoryandsession.benchmark_storage, i.e. the race is measured during preparation and stored in the session's benchmark storage (bf16_bmm.py:156-185).
linear.py swaps the inline validation plus _bmm_out(...) call for bf16_bmm.declare_bmm(...) in __init__ and bf16_bmm.execute(..., self.plan.handle) in __call__; the del session, name line goes away. tuning.py hoists _prepare_compiler_toolchain() to module import and deletes the two call sites in RecordedPreparationSession.__init__ and declare(). test_toolchain.py adds an "import" parametrization that constructs CUDAOptions() before any session exists.
What the description does not say (beyond points 2 and 3 above):
- The plan is keyed on exact strides of all three operands, so each distinct lay-out and each prefill row-slice offset is a separate plan and tuning entry. GLM prefill declares absorb/expand per row slice (
ignition/recipes/glm53/mla.py:321-329,340-344), so long chunks multiply plan and compile-job counts — a real cost on GB10 hosts that already fail tuning on memory headroom (issue #73: 7.2–8.8 GiB free vs 9,216 MiB needed). - The old custom op
flare::bmm_out(ignition/components/linear.py:89-96) stays defined with no remaining user in the class. - The component mutates a private b12x global (
compile_plan._NATIVE_JITS). The description does mention_NATIVE_JITS, but not that it is private/undocumented; the same trick already exists onmaininignition/components/moe_sm103.py:357 (not opened),387andsm103_projection.py:258(not opened), so it is an established but fragile pattern. - No configuration surface is added: no CLI flag, env var or setting; the choice comes from the existing preparation race and
cublasremains tactic 0.
The why: problem, linked reports, how long wanted
- Stated motivation: GLM-5.3-Flash MLA query absorption and value expansion multiply token-major head stacks by per-head BF16
kv_b_projslices; on GB10 cuBLAS "runs one 32x32 WMMA kernel for every layout of these strided batches" and moves the 8,192-row TP2 absorption (403 MB) at about half the measured copy bandwidth. The author notes cuBLAS already picks wide tensor-op tiles near the byte floor on RTX PRO 6000, so the win is GB10-specific. - Where it lands:
ignition/recipes/glm53/mla.py:241-257buildsabsorb_query/expand_valueasBatchedUnquantizedProjectionwhenkv_b_projis a plain BF16 tensor, andBatchedQuantizedProjectionwhen it is MXFP8-packed. Only the BF16 path changes; prefill declares the projections per row slice atmla.py:316-331,335-355. - No linked issue or user report asks for this. Searching items for "GLM prefill bandwidth bmm slow", "GB10 bandwidth bmm projection" and "kv_b_proj absorption" returns #231 only. GLM performance work in the tracker names other bottlenecks: #73 (GB10 TP2 tuning MemoryError, 8 GiB headroom; prefill 1,683–2,018 tok/s at 8K–128K on 2× GB10), #349 (GLM serving qualification vs vLLM on RTX PRO 6000), #253 (KV cache sizing on GLM TP2 Sparks), #471 (GLM 5.3 TP8), #407 (calibrated NVFP4 checkpoint). None names the BF16 absorption BMM as a cost.
- How long it has been wanted: the SM103 counterpart of the same problem was worked repeatedly in October 2026 by the same author —
982c44ea"Run BF16 projections through tuned FlashInfer GEMMs on SM103",21fdaaec"Write SM103 batched projections straight into their per-head views",69c272b0,61a323ad"Run long BMMs in row slices and keep adopted selections through tuning saves",b97bc6b8,0f4c9711. PR #231 is the SM120/GB10 side of that sequence (Triton tile rather than b12x GEMV/FlashInfer GEMM). The motivation is the author's own bandwidth measurement, not a filed complaint.
Related work: competing, overlapping, superseded, undone
- Undone by the repo split —
da037284(2026-11-22) and, onmaintoday,docs/design-review.md:31-37: "Recipes (inlocal-inference-lab/hyperflare-recipesor external recipe repositories) 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/." README.md:36 (not opened),49,65 and AGENTS.md:224-225,380-392 point component work atlocal-inference-lab/hyperflare-recipes. This is the dominant relationship: it is not a textual conflict but a placement reversal. - #471 (open, joninco, opened 2026-11-23, +8987/−112) "Add GLM 5.3 TP8 recipe and PCIe speculative decode optimizations" edits the same
ignition/components/linear.pyand changes the same class in the opposite direction: it adds a staging-copy path for sources whose inner stride is not one, whose rows overlap, or whose batch slices interleave, citingtests/components/test_batched_projection_cuda.py(not opened), and names Kimi K3 / K3.1 Pro as users of transposed views. #231 would reject exactly those operands. Whichever lands second must be reworked. #471 also reports the GLM 5.3 Flash suite (tests/recipes/test_glm53_mla_cuda.py(not opened), 7 of 19 failing) failing at its own base commit — the same suite #231 says it passed only on an integration branch. - #509 (merged 2026-11-24, from closed #474) "Fix Ignition storage lowering, guard pickling, and compiler worker startup" already handles the worker-side half of the patch-ordering story:
runtime_patches.apply()is now called inCompilePool.submit_payloadbefore workers start (ignition/preparation/compile_pool.py:16,98,147onmain). #231's import-time call addresses only the parent-process libdevice identity, so the two are complementary but partly overlapping, and #509 is three weeks newer than this branch. - #88 (merged 2026-10-26, voipmonitor) "Resolve compiler math libraries before native preparation" is the origin of
_prepare_compiler_toolchain()and oftests/preparation/test_toolchain.py; its stated failure mode (discovery records identities against Triton's bundled libdevice while materialization uses the toolkit's, yielding "uncached Triton program" errors) is precisely the one #231 extends from session construction to import time. - #132 (open, same author) "Declare benchmark calls and operand alignment for raced b12x tactics" also touches
tuning.pyand components and concerns benchmark calls and operand alignment — the same two themes as this PR — and received the same "runtime portion can remain here" triage on 2026-11-24. - Same-author siblings with identical triage language and date: #312 (Inkling 2 Spark TP4 performance), #134 (SM103 prefill GLM copies), #82 (DeepSeek mHC TileLang).
Recent activity in the touched areas
- The repo split dominates:
da037284(Luke Alonso, 2026-11-22) removed recipes and model components from coreignition;docs/design-review.mdandtests/preparation/test_core_boundary.pywere updated to match. PR #231 predates it by ~2.5 weeks and was never rebased. ignition/preparation/tuning.pyhas moved under several other people since:225758fe(yatesdr, 2026-11-25, kv-codec),0a4a6eb1(Luke Alonso, 2026-11-25),b0d35934/ #509 (2026-11-24, compiler worker startup),27716185(2026-11-24, PreparationManifest),84ac035c(2026-11-24, remove--collective-tuning),d0adb958(2026-11-24, row-sharded prefill). The import-time hoist is a small change to a hot, actively restructured file.- Nothing suggests #231 builds on these; it does not reverse them either, it simply predates them. The one place it could conflict is
RecordedPreparationSession.__init__, whose toolchain call PR #231 deletes.
People
- Author: original-el8, GitHub association COLLABORATOR, listed in the charter as a "priority contributor" alongside @voipmonitor and @lukealonso. Branch commits are authored as "Jason Cook" (
0ba78ebeand24ce84be, both 2026-11-07) — thejasoncin the commit log, third most active inignition/components(26 commits/180 days) andtests/components(8). 23 merged, 25 closed, 7 open in 180 days, spanning Helios scheduling and GPU green context (#532), Engram gathers (#470), KV plane padding (#473), compiler worker startup (#474→#509), storage lowering, Windows cache sizing (#175), SM103 mHC determinism (#131), DeepSeek top-p (#208), plus the large GLM TP8 (#471) and Inkling 2 (#312) PRs. - Prior ownership: the BF16 projection BMM line on SM103 (
982c44ea,21fdaaec,69c272b0,b97bc6b8,0f4c9711,61a323ad) and GLM checkpoint projection formats (12c6c0b4, 2026-10-21) are all this author's, so the change sits squarely in their own area. - Who else works here:
ignition/componentslast 180 days — Luke Alonso (104), Martin Vit (54), jasonc (26);ignition/preparation— Luke Alonso (150), Martin Vit (48), Eugene Rakhmatulin (36);tests/preparation— Luke Alonso (200), Martin Vit (31), jasonc (23). The toolchain half is voipmonitor's (#88) and Luke Alonso's territory; the repo split that displaces the component half is Luke Alonso's, and he is also the named approver for new operation contracts indocs/design-review.md:21-25. - Engagement so far: none from anyone but the author (see Community).
Community
Three comments, all by original-el8:
- 2026-11-08 04:27 — self-triage: tags it kernel performance work needing
triage:design-reviewandmodel:glm-5.3; asks reviewers to weigh the operator's placement and existing b12x alternatives, the compile-worker cache eviction, and numerical/stride coverage; notes SM120 verification on this branch, GB10/full-model evidence only from a combined branch, SM103 untested, and that "Those combined results do not isolate this PR's serving gain." - 2026-11-13 18:40 — conflict report: GitHub shows conflicts with
main, confirmed withgit merge-treefor head0ba78ebe9000againstmain97cfeb0001f1, conflicting pathignition/components/linear.py. Unresolved to this day. - 2026-11-24 21:46 — repository-split triage: the PR spans two repositories; implementation, projection wiring and component tests belong in
hyperflare-recipes; only theignition/preparation/tuning.pycompiler-toolchain change can remain here after removing the recipe-owned files. Same wording and same day as triage on #132 and #312, i.e. a sweep across the author's open kernel PRs.
No reviews, no approvals or change requests, no reactions, no linked issues. Interest from others is zero so far.
Project fit (charter, design-review doc, AGENTS.md)
Where it lines up:
- The charter's goal "Prepare supported model recipes with Ignition and serve captured CUDA graphs from Rust on SM103, SM120, and SM121" makes GB10 (SM121), where the reported win is, a first-class target.
- "PR descriptions: Expect four parts: why the change is needed, what changed, the claimed result, and the evidence backing it" — the description has Behavior, Measurements, Validation, Limitations.
- The change preserves prepared-graph semantics (no scratch, no steady-state allocation, no runtime compilation), consistent with design-review principle 2; the CUDA test asserts zero allocation counters on replay (
tests/components/test_bf16_bmm_cuda.py:112-118). - "Priority contributors (@voipmonitor, @original-el8, @lukealonso) carry extra weight—we never close their PRs out of hand."
Where it does not:
- "Solve the right problem in the right place… Look for the smallest footprint in shared code… Good ideas in the wrong place will be declined, and we'll point you to where they belong (#404)" plus the now-explicit
docs/design-review.md:31-37placement rule put the component half inhyperflare_recipes, not coreignition. - "Bring real evidence. Performance PRs need benchmarks showing an actual speedup over
mainon a served workload (#210)" — the only served number is a combined, explicitly non-attributed package comparison; the isolated numbers are per-projection microbenchmarks on a device/branch other than this head. - "Captured-graph op contracts: Adding a new one—even if it reuses an existing graph kind—requires owner approval before you write it" /
docs/design-review.md:21-26— a newflare::bf16_bmmop andflare.bf16_bmmcontract are added with no recorded approval. - "GPU kernel code: For CUDA and other low-level GPU kernel code, report concrete defects only—do not propose designs for it" (charter line 44) — bounds what a review of the Triton kernel should say.
Claims and evidence, one by one
| Claim | Backing |
|---|---|
| TP2 absorption 3.53→2.02 ms, TP2 expansion 2.62→2.02, TP4 absorption 1.77→1.00, TP4 expansion 1.27→1.01 ms on GB10, 8,192 rows; copy floor 1.84 / 0.93 ms | Author's numbers only; no logs, traces or benchmark script in the PR. Consistent with the code shape (one 64x128x64 tile, FP32 accumulate, no scratch) but not reproducible from the diff. |
"Every tile is bitwise equal to torch.bmm at the probed GLM shapes on GB10 and RTX PRO 6000; the test contract allows one BF16 ulp" |
Not enforced. tests/components/test_bf16_bmm_cuda.py:61-64 asserts max ULP ≤ 1, ≤1e-3 of elements differing, and error ≤ 1.05× cuBLAS error. The bitwise claim has no test behind it. |
| Served gain: 2945 tok/s TP2 8,192-token prefill on two DGX Sparks vs 2620–2631 for packages without those changes | The description itself disclaims attribution ("not attributed to this PR alone"). No other served measurement. |
Validation: 23 CPU tests passed (test_bf16_bmm.py, test_linear.py, test_toolchain.py); 5 CUDA tests passed on one RTX PRO 6000 (SM120) with an empty Triton cache |
Test counts match the diff (4 parametrized cases + 1 = 5 CUDA). No CI artifact backs it; head CI is red (see Process). |
"Not run on this branch: GB10 tests, the GLM MLA checkpoint test, and SM103"; the same component source passed GB10 and tests/recipes/test_glm53_mla_cuda.py (not opened) at TP2/TP4 on an integration branch |
Stated limitation; the headline device and the end-to-end model test therefore have no evidence at this head. |
| "Both accumulate in FP32 and round once to BF16, use no scratch, and write the caller's strided output view" | Verified in code: single FP32 tl.dot accumulator and one .to(bfloat16) on store, native_plan(scratch_bytes=lambda t: 0) (bf16_bmm.py:170), launch takes the caller's strides; the CUDA test asserts the plan has no persistent memory and replay allocates nothing (test_bf16_bmm_cuda.py:88,112-118). |
Kernel "registers itself in b12x's _NATIVE_JITS so compile workers evict its deferred planning entries" |
Visible at bf16_bmm.py:105-108 with an explanatory comment; matches the pre-existing pattern in moe_sm103.py (not opened) and sm103_projection.py (not opened). |
| "Packages export the tuned choice; no package metadata or Helios code changes" | Confirmed by the file list: no Helios, protobuf or packaging files touched. Implies existing packages must be re-exported to benefit. |
Reach: who and what it affects
- Users/operators: GLM-5.3-Flash BF16
kv_b_projrecipes only (ignition/recipes/glm53/mla.py), and only after re-export. MXFP8kv_b_proj(BatchedQuantizedProjection) is explicitly unchanged, as are all other model families. - Configuration and defaults: none added; cuBLAS stays tactic 0 and the runtime fallback when no program is loaded (
_tactics()returns("cublas", *tiles),State.runatbf16_bmm.py:119-126). Silence on design-review principle 10 (configuration) is correct here. - Compatibility: a new custom op
flare::bf16_bmmand a new native contract componentflare.bf16_bmm;flare::bmm_outremains defined but unused by the class. The stricter operand contract is the real compatibility risk — callers that pass transposed or non-16-byte-aligned stacks now fail at construction, and #471 documents that Kimi K3/K3.1 do exactly that. - Dependencies: no pin changes (pyproject untouched). It does import b12x internals:
b12x._lib.compile_plan._NATIVE_JITS,compile_only_launches,launch_triton,b12x._lib.program_cache.program_cache,b12x.preparation.PreparedCall,plan_from_handle/require_prepared. FlashInfer is pinned to a moving branch (pyproject.toml:47), so private imports are a live compatibility cost. - Deployment: package re-export required; no Helios/Rust/protobuf/ABI surface.
- Documentation: no
docs/change.docs/model-development.md:276(not opened) citesUnquantizedProjectionliving in the other repo, which is where this component now belongs. - Preparation cost: per-tactic
CompileJobs and per-stride plans added to tuning on the preparing device — relevant on memory-tight GB10 hosts (issue #73).
Process
- Opened 2026-11-08; head
0ba78ebdated 2026-11-07; last updated 2026-11-24. No code change in the 17 days since the head commit. - Two branch commits:
0ba78ebe"Race a Triton tile kernel against cuBLAS for GLM's BF16 head projections" and24ce84be"Select the CUDA toolkit libdevice when the tuning module is imported", both Jason Cook, 2026-11-07, on base91cfb369(Luke Alonso, 2026-11-07). triage:design-reviewlabel, no review begun, no approval recorded for the new operation contract.- Merge conflict on
ignition/components/linear.pyopen since 2026-11-13;mainhas since deleted the file, so resolution means relocating the change. - Head CI: failed. The only
pull_requestworkflow is.github/workflows/native-serving.yml(not opened) (ubuntu-24.04 and windows-2022: cargo build,eos/selene/selene-manager/helios/flaretests, Windows exe smoke, plus a Hugging Face fixture prep step at lines 28-31). There is no pytest job, so red CI neither confirms nor refutes the Python-side claims and may simply reflect a fixture/recipe path that changed under the branch.
Open questions and what could not be found
- Whether the measured GB10 win reproduces at this head: no logs, no script, and the description says GB10 was not run here.
tests/recipes/test_glm53_mla_cuda.py(not opened) at this head is unverified and #471 reports it failing at its own base. - Whether "bitwise equal to
torch.bmm" holds beyond the probed shapes — no test enforces it and no shape list for the probe is given. - Whether the new alignment/contiguity precondition breaks any in-tree caller beyond GLM (Kimi K3/K3.1 come in through #471's branch, not
main), and what the intended disposition of transposed inputs is: reject (#231) or stage-copy (#471). - Whether the import-time
runtime_patches.apply()is acceptable at all under the current codebase: it is a bare module-level call in a module ~60 components and many tests import, and it now hard-fails outside torch 2.14.1+cu132 / triton 3.8.0 with no test covering the import path except the new subprocess case intest_toolchain.py. - Where the change is meant to land given the split: the author's triage says two repositories; no PR in
hyperflare-recipesfor the component half was found from here. - No linked issue, no user report, no reviewer, no reaction — there is no record of external demand for this opt.