Opened by a workflow run, Dec 1, 2026 11:43 PM EST. decide malicious: all_clear (100%): No malicious content found
explore
Author: kbenkhaled (CONTRIBUTOR; no Discord handle — the PR's Discord: line is empty, which AGENTS.md forbids)
Motivation: Preparing a speculative model compiled each of four logprob Triton kernels once per speculative width and sorted every tile candidate at once, which took ~19.5 minutes on an 8 GiB Jetson Orin Nano. The PR makes the kernels width-agnostic and merges candidates in bounded 512-element chunks so preparation is faster without changing output.
Scale: +317 / −22 lines in 2 files
Proposal:
- Replace
WIDTH: tl.constexprwith a runtimewidthplusdo_not_specialize=["width"]in_statistics,_normalization,_candidates,_finish(ignition/components/logprobs.py:59-117), and promote the row offset to int64. - Cap
_finish's sort block at_MERGE_BLOCK = 512and merge remaining candidates 480 at a time, keeping the running top 32 (logprobs.py:21-24,136-150,164). - Drop
_MERGE_WARPS8 → 4 (logprobs.py:26). - Add the first direct test file for these kernels, 278 lines of CPU + CUDA tests (
tests/components/test_logprobs.py). - Claim: no core format or ABI change —
_merge, buffers, shapes and the constructor are untouched. Touches: ignition/components/logprobs.py(core component, four prepared kernels' specialization identity and merge semantics)tests/components/test_logprobs.py(new; asserts on private_preparationinternals that this same PR edits)ignition/components/sampling.py(sole constructor ofPreparedLogprobs; compile order unchanged) Related items:- #652 Fix externalized core signing… (merged): cuts the same export-size/cubin symptom from the export side; complementary, no file overlap
- #231 (open): states the Triton specialization/program-identity rule this PR relies on, and a real "undeclared programs" preparation failure when identities shift
- #671 Scale Ignition preparation memory budgets… (open): same author, same Jetson campaign, no shared files
- #555 intermediate batch capacities (merged): multiplies prepared speculative widths, i.e. the pressure this PR relieves
- #608 restore catalog validation and CPU Python tests (merged): makes the new CPU test an actual CI gate
Link: https://github.com/NVIDIA/hyperflare-inference/pull/673
Autobot comments: What the description omits:
_MERGE_WARPSdrops 8→4 andmerge_blockcollapses to 32 for tiny vocabularies, so launch configuration changes for every vocabulary, not just 262k ones; and the merge-loop bounds aretl.constexpr, so_finishstill recompiles per vocabulary (16 unrolled extra sorts at 256 tiles) — only width stops multiplying cubins. 64-bit indexing is now on all four kernels' address path, unmeasured.docs/logprobs-design.md:90-100still describes the pre-PR single 32-key merge, anddocs/logprobs-design.md:128-130("performance claims require complete replay and service measurements") plus charter line 42 (SM103/120/121 matrix, exported cores still load) set standards the PR leaves unrun. Every performance and bit-exactness number is author-measured on Jetson Thor/Orin Nano; CI on head1337213is empty and the only Python workflow is CPU-only, so the CUDA half of the new tests can never gate the PR. In-repo logits are 2-D (width == 1), so widths 1..6 come from the external hyperflare_recipes package; onlyscripts/benchmark_logprobs.pyreproduces multi-width here. No issue requested this work; no other PR has touchedlogprobs.pyin 180 days; zero comments, reviews, labels or reactions.
Value Proposition
Value Proposition — PR #673 (PreparedLogprobs bounded merge block, width-agnostic kernels)
Charter alignment. The change sits in one shared ignition component with no model branch, no flag, no new dependency, and no ABI/scratch-layout change — consistent with "keep the runtime small and model-agnostic" and "solve the right problem in the right place." It rests on a measured performance problem, which the contribution rules accept as a basis. Two frictions: the multi-width benefit is reachable only through out-of-repo 3-D logits (scripts/benchmark_logprobs.py, the external recipes package — in-repo paths are width == 1), and the roadmap's named targets SM103/SM120/SM121 plus "existing exported cores still load" are explicitly unrun.
Novelty & status. Genuinely additive. items_touching(logprobs.py) over 180 days returns only #673 and nothing on main has changed since 1fbcc3c — not obsolete. #652 (merged) attacks the same export-size/load-time symptom from the export side, has no file overlap, and is complementary rather than superseding; the merged #555 (intermediate batch capacities) actually increases the speculative-shape pressure this relieves.
Value vs maintenance cost. Beneficiaries are operators building cold speculative catalogues, most acutely on 8 GiB devices: 65.40 s → 4.46 s (Thor, SM110) and ~19.5 min → 11.83 s (Orin Nano, SM87), 4 cubins instead of 24. Complexity is small and localized (+39/−22), and the new 278-line test file is the first direct test of _statistics/_normalization/_candidates/_finish — durable value independent of the optimization, on a top-20 logprob equality guarantee the community already uses as its correctness oracle.
The evidence is nonetheless author-measured only: 0 CI checks on 1337213, the sole Python workflow is CPU-only, so the CUDA half can never gate this. The headline numbers are isolated _finish µs and cold prepare() wall-clock, which docs/logprobs-design.md:128-130 explicitly rules insufficient ("complete replay and service measurements"). _finish still unrolls per vocabulary (16 extra sorts at V=262,144), so compile cost is bounded, not removed. Three behaviours are unmeasured: the _MERGE_WARPS 8→4 launch change that now applies to every vocabulary, the new int64 hot-path indexing, and Orin Nano's old BLOCK=8192 latency. do_not_specialize rewrites four kernels' specialization identity, and #231 documents "undeclared programs" failures when that identity shifts. docs/logprobs-design.md:90-100 is stale, and the Discord: line is empty (the same nit raised on #671).
Before merge: served/replay measurement per the documented standard; one target-matrix or exported-core-load check; small-vocabulary regression data for the 4-warp launch and int64 indexing; a docs/logprobs-design.md update; Discord: filled in.
Verdict: Worth it with changes. Right layer, plausible magnitude, one file, first real kernel tests — but the served-workload evidence, hardware matrix and doc update the charter requires must land first.
Full report Decide Value: yes (100%): This change is worth reviewing: it provides value to the project in line with its charter.
Classify intake
Selected: triage:review, performance, area:kernels
Threshold: 65%
Triage
- [✓]
triage:review: 97.0% -
triage:validation: 2.6% -
triage:design-review: 0.3% -
triage:investigate: 0.1% -
none: 0.0% -
triage:integration: 0.0% -
triage:partial: 0.0% -
triage:superseded: 0.0% -
triage:verify-for-closure: 0.0%
Priority
-
none: 100.0% -
priority:P1: 0.0% -
priority:P2: 0.0%
Type
- [✓]
performance: 98.2% -
community: 43.8% -
enhancement: 10.7% -
duplicate: 3.7% -
bug: 2.3% -
documentation: 0.5%
Area
- [✓]
area:kernels: 73.1% -
area:preparation: 53.1% -
area:memory: 6.0% -
area:scheduling: 1.2% -
area:caching: 1.1% -
area:engram: 0.8% -
area:packaging: 0.8% -
area:api: 0.5% -
area:orbit: 0.3% -
area:selene: 0.2% -
area:rocenante: 0.2%
Model
-
model:inkling-small: 1.8% -
model:nemotron-3.5-bolt: 0.9% -
model:deepseek-v4.1: 0.8% -
model:kimi-k3.1: 0.5% -
model:mimo-v2.6: 0.3% -
model:glm-5.3: 0.1% -
model:qwen3.8-27b: 0.1% -
model:deepseek-v4: 0.1% -
model:muse-glimmer: 0.1% -
model:qwen3.8-flash-next: 0.1% -
model:gemma4: 0.0%
Apply Labels (Intake)
Applied: +triage:review, +performance, +area:kernels
Subtraction and simplicity
Subtraction/Simplicity review of PR #673 (ignition/components/logprobs.py +39/−22, new tests/components/test_logprobs.py). The core is genuine subtraction — a constexpr WIDTH becomes a runtime width under do_not_specialize, deleting six specializations per kernel, and the chunked merge reuses the existing tl.sort/_sort_key machinery. No flags, fallbacks, or dead code added. Four trims:
- [high] Stale contract: docs/logprobs-design.md:92-100 still says "Tiles retain their best 32 integer sort keys; a final merge stores K pairs", describing the pre-PR 8192-key sort and omitting width-independence; AGENTS.md:232 routes logprob changes through this doc. Rewrite two sentences.
- [high] tests/components/test_logprobs.py:50-68 hard-codes all eight points of
min(next_power_of_2(cdiv(vocab,1024)*32),512)and asserts viadict(zip(_finish.arg_names, op._preparation[3][1])); AGENTS.md:194-199 rejects such source-restating checks. Replace with two cases (vocab 1 → 32, 262144 → _MERGE_BLOCK, plus<= _MERGE_BLOCK). - [medium] logprobs.py:25-26
_REDUCTION_WARPS = 4/_MERGE_WARPS = 4are now identical (the 8→4 drop is undescribed) — collapse to one_WARPS; and logprobs.py:24's module-levelassertis a tautology over two literals (512 > 32, power of two) that can never fire — delete, keep the comment. - [low, GPU-verify] logprobs.py:141
if total > BLOCK:is redundant since total/step/BLOCK are constexpr; the range() is already empty when total <= BLOCK. Delete the guard and dedent six lines, after confirming no cubin/hash change.
Non-findings: repeated pos = row.to(tl.int64) * width + col (:66,83,101,121) not worth a helper; do_not_specialize matches existing idiom (engram.py:23 (not opened)); no dead code or knobs; constructor/scratch/ABI untouched; the new test file is first-ever coverage of these kernels.
Open: whether the merge-warp 8→4 change was measured; whether vocabulary_logprobs.py (not opened) shares the unbounded final sort (follow-up, worth docs/TODO.txt).
Correctness and contracts
Reviewed PR #673 (ignition/components/logprobs.py +39/−22, new tests/components/test_logprobs.py). No correctness defect found: the chunked top-32 merge is exact (proved by induction over the 480-slot centre), argument positions, scratch layout, ABI/export path, gating and tie ordering are all unchanged, and existing exported cores keep loading.
Findings, highest first:
- Major — evidence covers one vocabulary for a change reaching every V ≥ 16,385 (
logprobs.py:164,mainlogprobs.py:166):mainpassed the unboundednext_power_of_2(tiles*32)(1024…8192 keys); the only measured point is V=262,144 (84.2→38.2 µs). No 32k/128k data, though those are what Flare serves locally. - Major —
_MERGE_WARPS8→4 (logprobs.py:26) changes_finish's warp count for every vocabulary, including the ≤16,384 path whereBLOCKis unchanged, and is framed only as part of the 512 cap with no measurement. - Major — stale contract doc:
docs/logprobs-design.md:90-100still describes a single 32-key merge and says nothing about width-agnostic kernels, thoughAGENTS.md:232names it as the required doc for logprob changes. - Major — no CI-gating test can catch a merge regression: all three behavioural tests are
FLARE_RUN_CUDA_TESTS-gated (test_logprobs.py:71,122,210) and CI runs withCUDA_VISIBLE_DEVICES: ""; the only CI-visible test asserts a privateBLOCKint (test_logprobs.py:60-68). - Minor —
_finishis still vocabulary-specialized (TILES: tl.constexpr,logprobs.py:114,137-143): the merge loop unrolls 17 sorts at V=262,144; the bound is per sort block, not per vocabulary. - Minor — CPU test couples to the private
_preparation[3][1]tuple (test_logprobs.py:67) that this PR itself edits. - Minor — process: empty
Discord:line (AGENTS.md:144-153) and unmeasured items not recorded indocs/TODO.txt(AGENTS.md:57-58).
I verified and retract the misattribution suspicion: the 84.2→38.2 µs row is genuinely attributable to the chunked merge.
Open: no measurement of small/medium vocabularies at 4 warps; SM103/120/121 and an exported-core run remain unmeasured by the author's own admission.
Final review
Recommendation: Changes Requested
The kernel changes in ignition/components/logprobs.py are mathematically sound, bit-exact, and address a real speculative-decoding preparation bottleneck (~15×–100× faster cold prepare() by collapsing per-width cubins and bounding _finish's bitonic sort block), backed by the repository's first direct unit and CUDA tests for these kernels. No correctness, ABI, or CUDA-graph capture defects were found. However, before merge, the runtime launch changes that apply across all vocabularies (_MERGE_WARPS 8→4 for every V, chunked serial sorts for V >= 16,385) need before/after latency coverage beyond the single V = 262,144 / width = 6 point (plus complete-replay/exported-core validation per docs/logprobs-design.md:129-130), the PR description should make the 8 → 4 warp transition explicit, and CPU CI needs to run on head 1337213.
Merge Risk
Level: Medium
- Shared hot-path launch change across all vocabularies:
PreparedLogprobsis the sole generation-logprob reduction component inignition/components/logprobs.py(used byPreparedSamplingand external speculative recipes). CappingBLOCKat512alters_finishfor every vocabulary>= 16,385(up to 9 serial sorts atV = 131,072and 17 atV = 262,144), and reducing_MERGE_WARPSfrom8to4alters_finishfor every vocabulary including<= 16,384. - ABI / compatibility / concurrency safety is preserved: Scratch shapes/dtypes (
stats,lse,keys),CompletionOutputslayouts,_merge, and CUDA-graph capture safety are unchanged; previously exported cores embed their own cubins and continue to load unaffected. - Unverified CI & target hardware matrix: Head
1337213currently has 0 CI checks run, and SM103/SM120/SM121 plus end-to-endignition export/flare runremain unmeasured.
Walkthrough
ignition/components/logprobs.py:59-121: ConvertedWIDTH: tl.constexprto a runtimewidthparameter with@triton.jit(do_not_specialize=["width"])across_statistics,_normalization,_candidates, and_finish, keeping parameter positions aligned withprepare()/functional()/run()and promoting row offsets to 64-bit (pos = row.to(tl.int64) * width + col).ignition/components/logprobs.py:21-26, 136-150, 164, 182-185: Bounded_finish's sort block at_MERGE_BLOCK = 512, reduced_MERGE_WARPSfrom8to4, and added a480-key chunked merge loop (step = BLOCK - CANDIDATES) whentotal = TILES * CANDIDATES > BLOCK, preserving the running top 32 packeduint64keys after each sort.tests/components/test_logprobs.py:1-279: Added a CPUmeta-device test checkingBLOCKbounds across vocabularies1..262,144and threeFLARE_RUN_CUDA_TESTS=1tests verifying single-cubin reuse across widths(1, 2, 6, 16), exact top-20 tie ordering across chunk boundaries (BF16/FP32,+0.0,-inf,< 20padding, inactive slots), requested token IDs, epoch/live-row gating, andfunctional(dynamic_inputs=True)CUDA graph capture/replay.
Pre-merge Checks
- [PASS] Security / malicious screen: Diff is confined to Triton logprob reduction kernels and pytest tests with no network, shell, credential, or untrusted-input surfaces.
- [WARN] Charter & value fit: Cleanly placed in one shared
ignition/components/module with no model branch, flag, or ABI break, addressing a measured compile-time problem; however, the Charter's served-workload benchmark / SM103-SM120-SM121 matrix check anddocs/logprobs-design.md:129-130's complete-replay measurement requirement are not yet met. - [PASS] Related / duplicate / conflict check: No competing or conflicting PRs touch
ignition/components/logprobs.py; complementary to merged #652 (cubin pruning on export). - [WARN] Tests & verification evidence: Strong new CUDA test suite reported passing (
87 passed) on Thor (SM110) and Orin Nano (SM87), but 0 GitHub CI checks have run on1337213and runtime latency is only measured at one point (V = 262,144,width = 6on Thor).
Blockers
None.
Should Fix
- Measure the unmeasured runtime regimes and document the full before/after launch change (
ignition/components/logprobs.py:23-26, 137-147, 164):- Verified behavior & impact: Two independent launch changes apply well beyond the single measured point (
V = 262,144,width = 6):_MERGE_WARPSchanged from8to4(ignition/components/logprobs.py:26vsmain:22), affecting every vocabulary—includingV <= 16,384whereBLOCKis unchanged—while the PR description only mentions4warps inside the512cap bullet without stating the8 → 4transition.merge_block = min(triton.next_power_of_2(tiles * _TILE_CANDIDATES), _MERGE_BLOCK)(ignition/components/logprobs.py:164) replaces a single1024..4096-key sort with2..9serial512-key sorts for everyV >= 16,385(e.g., 9 serial sorts atV = 131,072). None ofV <= 16,384,32k–128k, orwidth = 1are measured before/after, anddocs/logprobs-design.md:129-130specifies: "Performance claims about the reduction require complete replay and service measurements."
- Concrete fix:
- Add before/after CUDA-graph latency measurements (e.g. using the in-repo
scripts/benchmark_logprobs.pyharness atwidth in (1, 6)) covering representative small (<= 16,384), mid (~128k), and262,144vocabularies, plus a complete replay or exported-core check (docs/logprobs-design.md:129-130,docs/performance-work.md:45-51), or explicitly bound the runtime speedup claim to the measuredV = 262,144case while tracking unrun SM103/SM120/SM121 and exported-core checks indocs/TODO.txt(AGENTS.md:57-58). - Update the PR description's "What changed" section (
AGENTS.md:88-94) to explicitly note the_MERGE_WARPS8 → 4change (affecting all vocabularies) and clarify that_finishremains specialized per vocabulary viaTILES: tl.constexpr(collapsing only the width dimension). - Ensure CPU CI (
.github/workflows/python-cpu.yml(not opened)) runs and passes on the PR head before merge.
- Add before/after CUDA-graph latency measurements (e.g. using the in-repo
- Verified behavior & impact: Two independent launch changes apply well beyond the single measured point (
Subtract / Simplify
- Drop tautological module-level
assert(ignition/components/logprobs.py:24):assert _MERGE_BLOCK > _TILE_CANDIDATES and (_MERGE_BLOCK & (_MERGE_BLOCK - 1)) == 0checks two adjacent module literals (512and32), is the only top-levelassertinignition/, cannot fail at runtime, and is stripped underpython -O. Deleting line 24 leaves the concise comment at lines 21–22 intact.
Nits
- Empty
Discord:line in PR description: Populate the line with a Discord username orDiscord: no username providedperAGENTS.md:144-153anddocs/design-review.md:163-169. - Optional doc update (
docs/logprobs-design.md:92-100): The existing sentence ("Tiles retain their best 32 integer sort keys; a final merge stores K pairs and the chosen token") still holds at the contract level, but adding one sentence noting bounded chunked merging and width-agnostic launches would keep the preparation section current. - Avoid hardcoded tuple index in CPU test (
tests/components/test_logprobs.py:67): Selecting_finishfromop._preparationby kernel identity (next(args for kernel, args, *_ in op._preparation if kernel is _finish)) rather thanop._preparation[3][1]avoids brittle failure if the launch tuple order changes.
Dropped on verification
- Dropped
if total > BLOCK:"redundant guard" deletion (ignition/components/logprobs.py:141, Subtraction & Simplicity F4): False — deleting it breaksvocab <= 1024. Whenvocab <= 1024,tiles = 1,merge_block = 32 == _TILE_CANDIDATES, sostep: tl.constexpr = BLOCK - CANDIDATESevaluates to0, andrange(BLOCK, total, 0)raisesValueError: range() arg 3 must not be zero. Additionally, the Charter forbids proposing design changes to low-level GPU kernel code without a concrete defect. - Dropped "no CI-gating test can detect a merge regression" / CPU NumPy transcription suggestion (
tests/components/test_logprobs.py:71, Correctness & Contracts 4.2): Triton GPU kernels cannot run under CPU CI (CUDA_VISIBLE_DEVICES: ""in.github/workflows/python-cpu.yml:32(not opened)), soFLARE_RUN_CUDA_TESTS=1opt-in matches repo convention (tests/components/test_completion_outputs.py:18). A separate Python/NumPy transcription would test a copy rather than_finish, violatingAGENTS.md:194-196. - Dropped High/Major severity on
docs/logprobs-design.md:92-100and contrast withignition/components/vocabulary_logprobs.py(not opened) (Subtraction & Simplicity F1, Correctness & Contracts 3.1):docs/logprobs-design.md:94-95never specifies an 8,192-key single sort and remains factually true at the contract level;ignition/components/vocabulary_logprobs.py(not opened) does not exist in this repository at1337213. Downgraded to a Nit. - Dropped High severity on 8-row parametrization in
tests/components/test_logprobs.py:50-59and formula-only replacement (Subtraction & Simplicity F2, Correctness & Contracts 4.3): The parametrized cases cover real tile/cap boundaries (1024/1025,16384/16385,262144), and asserting on a standalonemin(next_power_of_2(...), _MERGE_BLOCK)expression would stop exercisingPreparedLogprobs.__init__. Kept only the[3]tuple-index cleanup as a Nit. - Dropped merging
_REDUCTION_WARPS/_MERGE_WARPSinto_WARPS(Subtraction & Simplicity F3a) and reverting_MERGE_WARPSto8(Correctness & Contracts 2.2): Distinct semantic constants for reduction vs. merge phases avoid churn (AGENTS.md:190), and proposing a warp-count revert without a concrete defect conflicts with the Charter's GPU-kernel review standard; measurement coverage is captured in Should Fix instead. - Dropped
#231"undeclared programs" / stale on-disk Triton cache concern (Discovery Dossier, Value Prop, Correctness & Contracts): Reading#231directly confirms its failure came from compiling a Triton kernel beforeignition.preparation.tuningconfigured the CUDA toolkitlibdevicepath, not fromdo_not_specializeor stale on-disk caches (Triton hashes kernel source and specialization metadata into its cache key). - Dropped claim that
int64row indexing is purely defensive with no possible overflow (Discovery Dossier): Inint32,(row * WIDTH + col) * Voverflows signed 32-bit atbatch * width >= 8,192forV = 262,144; promotingpostotl.int64matchesignition/components/engram.py:39and cleanly avoids that overflow boundary.
Classify triage
Selected: triage:validation
Threshold: 65%
Triage
- [✓]
triage:validation: 93.2% -
triage:review: 6.7% -
none: 0.0% -
triage:design-review: 0.0% -
triage:partial: 0.0% -
triage:investigate: 0.0% -
triage:integration: 0.0% -
triage:verify-for-closure: 0.0% -
triage:superseded: 0.0% Decision to Test: no (96%): Testing will not add significant value as the code stands today. The code is either not yet ready to merge, or adequate testing has already been done to validate the contents of the code, or the available hardware is not suitable to test with.
Apply labels
Applied: +triage:validation, -triage:review