#1 [high] Merge arithmetic in _finish is correct and bit-exact; ABI/arg indexing sound
VERIFIED SOUND (no defect), ignition/components/logprobs.py:136-150:
k = tl.arange(0, BLOCK)
total: tl.constexpr = TILES * CANDIDATES
base = pos * total
keys = tl.load(Keys + base + k, k < total, other=0)
keys = tl.sort(keys, descending=True)
if total > BLOCK:
step: tl.constexpr = BLOCK - CANDIDATES
for offset in range(BLOCK, total, step):
idx = offset + (k - CANDIDATES)
incoming = tl.load(Keys + base + idx, (k >= CANDIDATES) & (idx < total), other=0)
keys = tl.where(k < CANDIDATES, keys, incoming)
Proof of exactness: induction — after iteration i, buffer = sorted(top32(first BLOCK+i*480) ∪ next 480). Centre has 480 slots, exactly the chunk size; tail k>=512 is padding (BLOCK-CANDIDATES-extra is discarded, and those 32 were already folded into the head). Padding other=0 sorts last (sort key 0 < inf for finite; for -inf logit key = 0x007FFFFF<<32|..., not 0). Termination: offsets 512,992,...; final chunk length min(480, total-offset) so the (total-offset) mask is not redundant. Handles total-BLOCK < CANDIDATES (e.g. 17 tiles -> total 544 > BLOCK 512, one iteration loading k in [32,64)).
Keeping 32 ≥ TOP=20 is sufficient, matches docs/core-design.md:1276-1279 ("threshold ties must never be truncated to a fixed number of candidates") — unchanged from main.
Also verified:
- Arg positions unchanged: _statistics (vocab,width,tiles,SLOTS,FIELDS,BLOCK) at 8..13; _normalization at 8..12; existing prepare()/run() index logic (logprobs.py:194-199, 237-245) and
start = 3 if normalization else 4still line up. Constexpr->runtime arg occupies the same slot. - Scratch layout/shapes/dtypes unchanged (logprobs.py:167-171): stats [b,w,tiles,2] f32, lse [b,w] f32, keys [b,w,tiles,32] u64.
- int64 promotion cannot overflow (max pos ~ 2^20).
- merge_block examples: V=1->tiles1->BLOCK32; V=1025->2->64; V=16385->17->512 (total 544>512); V=262144->256->512 (total 8192). Arithmetically all correct.
#2 [high] Stale design doc: docs/logprobs-design.md still describes the single-sort merge
FINDING (Major). docs/logprobs-design.md:90-100, verbatim:
## Preparation and scratch
Four prepared Triton launches reduce requested positions. Vocabulary tiles first
compute FP32 maxima and exponential sums, then a small reduction writes each
position's normalization. Tiles retain their best 32 integer sort keys; a final
merge stores K pairs and the chosen token. Keys rank the reported FP32 logprobs
and inverse token ID, including ties introduced by subtraction.
After this PR the final launch is not one merge: BLOCK is capped at 512 (logprobs.py:23,164) and the remaining candidates are folded in 480-key chunks with up to 15 additional tl.sort calls at V=262,144 (logprobs.py:141-147). The doc also says nothing about the kernels now being width-agnostic (do_not_specialize at logprobs.py:59,76,93,112). Rules: AGENTS.md:52-60 ("Every repository document ... specifies the architecture") and AGENTS.md:166 (inaccurate documentation is a contribution basis); AGENTS.md:232 assigns docs/logprobs-design.md as the required guidance for "Change speculative decoding, log probabilities". Fix: 2-3 sentences in the "Preparation and scratch" section stating the merge is bounded (first 512 keys, then 480-key chunks keeping the running top 32) and that the four launches are shared across speculative widths. No measurements belong in the design doc (AGENTS.md:58). Note: docs/api.md:107-112 tie ordering ("decreasing logprob, with increasing token ID for ties") remains accurate — verified unaffected.
Supported by docs/logprobs-design.md:128-130 too:
A zero request flag bypasses vocabulary reads, sorting, and payload writes.
Requests without logprobs incur only the gated launches. Performance claims
about the reduction require complete replay and service measurements.
#3 [high] Claim accuracy: the _finish latency row cannot come from the chunked merge
FINDING (Major). PR body, Table row 2:
| Jetson Thor (`SM110`) `_finish` GPU latency (width 6) | `84.2 us` | `38.2 us` | **2.2× faster** |
Two independent defects:
- The attributed mechanism did not change.
_finish's sort block is unchanged for V=262,144: main computedtriton.next_power_of_2(tiles * _TILE_CANDIDATES)-> still 512 at 256 tiles:
- completion.token_id_counts, *dimensions,
- triton.next_power_of_2(tiles * _TILE_CANDIDATES), _TILE_CANDIDATES,
+ completion.token_id_counts, *dimensions, merge_block, _TILE_CANDIDATES,
and merge_block = min(next_power_of_2(tiles * 32), 512) (logprobs.py:164) with if total > BLOCK: (logprobs.py:141) — the loop body is dead at 8192==8192? No: for V=262,144, tiles=256, total=8192 > 512, so both versions sort 512 first and merge 16 chunks. The claimed BLOCK=8192 is the bundled _merge constant (completion.py:111) / the V<=16,384 path, not _finish at this vocabulary. So the 84.2->38.2 us belongs to width de-specialization / _MERGE_WARPS 8->4, not the "chunked top-32 merge" headline. Presenting it in the same table under the chunked-merge heading misattributes the gain.
2) It is not apples-to-apples. The PR body itself says: "Orin Nano's old BLOCK=8192 runtime latency ... [[was] not measured in this pass]", and Orin is the only device where main would have had BLOCK=8192 (V<=16,384 at 8 warps under 8 GiB). The PR also states extra variant: "· Limitations: SM103/SM120/SM121 GPUs, end-to-end ignition export / flare run serving benchmarks ... were not measured".
Rule: AGENTS.md:95-102 requires "the headline comparison and metric direction for a measured improvement, with its scope and material limitations attached. Distinguish component measurements from whole-model or service results"; docs/logprobs-design.md:128-130 requires complete replay/service measurements for reduction performance claims; charter line 42/#210.
Impact: a maintainer reads "2.2x faster _finish" as a user-visible reduction gain and cannot tell it applies to one shape on one unmeasured device; the true common-path effect is unpriced.
Fix: split the row — state that at V=262,144 the sort block is 512 both before and after, attribute the 84.2->38.2 us to width sharing + _MERGE_WARPS 8->4, and state the chunked merge's effect is only on V<=16,384 (a regression-risk path, unmeasured at 4 warps).
#4 [high] Unmeasured launch-config change for every vocabulary (_MERGE_WARPS 8->4)
FINDING (Major, performance). ignition/components/logprobs.py:21-26:
# Merge per-tile candidates in bounded chunks so large vocabularies (e.g. 256k -> 8192 keys)
# do not unroll an 8192-element bitonic network in Triton/PTX while keeping bit-exact ordering.
_MERGE_BLOCK = 512
assert _MERGE_BLOCK > _TILE_CANDIDATES and (_MERGE_BLOCK & (_MERGE_BLOCK - 1)) == 0
_REDUCTION_WARPS = 4
_MERGE_WARPS = 4
On main _MERGE_WARPS = 8. The PR body frames the launch change only as "Capped _finish's sort block at 512 elements (4 warps) instead of growing up to 8,192" — but
merge_block = min(triton.next_power_of_2(tiles * _TILE_CANDIDATES), _MERGE_BLOCK)(logprobs.py:164) differs from main ONLY when tiles*32 < 512, i.e. vocab <= 16,384 (<=16 tiles). Above that both are 512._MERGE_WARPS 8 -> 4applies to EVERY vocabulary, including the tiny ones, and is not mentioned as a separate change.
So for the common/small case the _finish launch shape is (4 warps, BLOCK=next_pow2(tiles*32)); for V=1024 it is 4 warps/32 lanes, for V=8000 4 warps/256 lanes. A 32-lane sort on 4 warps is 3/4 idle warps (tl.sort over an N-lane block with fewer elements than lanes, plus the surrounding scalar work in _sort_pair/_position/store): the risk is concrete but unmeasured — the PR reports no _finish or end-to-end latency for any vocabulary below 262,144, and explicitly lists "Orin Nano's old BLOCK=8192 runtime latency" as unmeasured.
Rule: charter #210 + docs/performance-work.md:1-7 ("Measure each optimization against a baseline with the same checkpoint, GPU assignment ... Correctness failures block performance claims") and 119-124 ("Measure every captured speculative shape ... Do not infer a speedup from ... a component benchmark alone").
Impact: the change is presented as a pure win; the ordinary 32k/128k-vocabulary serving path (V=128,256 -> tiles 128/256 -> BLOCK 512 either way, warps 8->4) may lose sort throughput with no measurement, and the <=16,384 path drops BLOCK as well.
Fix: report _finish latency at a few vocabularies including one <=16,384 and one ~128k at widths 1 and max before/after; or drop _MERGE_WARPS back to 8 and keep the 512 cap (the two are independent), or state why 4 warps was chosen with a measurement.
#5 [high] CORRECTION: verified main-vs-PR _finish launch table (retracts entries 3 and 4 reasoning)
VERIFIED against main branch (git ref main), supersedes the reasoning in entries 3 and 4, which inverted the comparison. Read ignition/components/logprobs.py at ref main directly:
main logprobs.py:21-22: _REDUCTION_WARPS = 4 / _MERGE_WARPS = 8 (no _MERGE_BLOCK).
main logprobs.py:128-130:
k = tl.arange(0, BLOCK)
keys = tl.load(Keys + (row * WIDTH + col) * TILES * CANDIDATES + k, k < TILES * CANDIDATES, other=0)
keys = tl.sort(keys, descending=True)
main logprobs.py:164-166 passes triton.next_power_of_2(tiles * _TILE_CANDIDATES) as BLOCK — UNBOUNDED, one sort of BLOCK elements.
So the true before/after launch table (_finish, vocab -> (tiles, total=tiles*32, main BLOCK/warps, PR BLOCK/warps)):
- 1,024 -> (1, 32, 32/8, 32/4)
- 8,192 -> (8, 256, 256/8, 256/4)
- 16,384 -> (16, 512, 512/8, 512/4) [loop dead either way]
- 16,385 -> (17, 544, main 1024/8, PR 512/4 + 1 loop iteration)
- 131,072 -> (128, 4096, main 4096/8, PR 512/4 + 8 iterations)
- 262,144 -> (256, 8192, main 8192/8, PR 512/4 + 16 iterations)
Consequences:
- The PR body's "Capped
_finish's sort block at512elements (4warps) instead of growing up to8,192" is ACCURATE. The 84.2 us -> 38.2 us_finishrow IS attributable to the chunked merge (one 8192-element bitonic network ~81921313/2 compare-exchanges vs 17 sorts of 512 ~175129*9/2). No misattribution. Entry 3 is retracted. merge_blockchanges from main for every vocabulary >= 16,385 tokens, i.e. essentially every real model (not "large vocab only"): main was next_pow2(tiles32) >= 1024 there. Entry 4's "differs only when tiles32 < 512" is backwards and is retracted.- What SURVIVES from entry 4:
_MERGE_WARPS8 -> 4 (logprobs.py:26) changes the warp count for EVERY vocabulary including the <=16,384 path where BLOCK is unchanged (e.g. V=1,024: 8 warps -> 4 warps over a 32-lane sort), and is unmeasured anywhere below V=262,144. The PR body mentions the 4 warps only as part of the 512 cap, not as an independent change with its own evidence.
#6 [high] Measured vocabulary coverage: one point (262,144) for a change reaching every vocab >= 16,385
FINDING (Major, performance evidence). The chunked merge changes the common path, but the only measured vocabulary is 262,144. Verified launch table (see entry 5): main BLOCK for _finish = next_power_of_2(tiles*32), so
- V=32,768 (tiles 32) -> main BLOCK 1024/8 warps -> PR 512/4 warps + 1 extra sort
- V=131,072 (tiles 128) -> main BLOCK 4096/8 warps -> PR 512/4 warps + 8 extra sorts
- V=262,144 (tiles 256) -> main BLOCK 8192/8 warps -> PR 512/4 warps + 16 extra sorts <-- the only measured point (84.2us -> 38.2us)
PR body lists as unmeasured: "SM103/SM120/SM121 GPUs, end-to-end
ignition export/flare runserving benchmarks, and Orin Nano's oldBLOCK=8192runtime latency". There is no_finishlatency for 32k or 128k vocabularies, and no width-1 measurement. Rules: docs/performance-work.md:1-7 ("Measure each optimization against a baseline with the same checkpoint, GPU assignment ... Correctness failures block performance claims"), :45-51 ("Verify improvements through an exported core loaded byflare run CORE"), :119-124 ("Measure every captured speculative shape. ... Do not infer a speedup from ... a component benchmark alone"); docs/logprobs-design.md:128-130 ("Performance claims about the reduction require complete replay and service measurements"); docs/core-design.md:1276-1279 ("Measure sampler cost inside the complete graph before changing it"); charter line 42/#210. Impact: 32k-128k vocabularies are the ones Flare actually serves locally (Qwen/GLM-class). At V=131,072 the PR replaces one 4,096-element block sort with nine serial 512-element sorts (a data-dependent chain under 4 warps): the compare-exchange count drops but the serialization depth rises, and which dominates at that tile count is exactly what was not measured. README-level caching caveat: the merged path is also the only path where a slot withcount == 0readsKeys1,024-8,192 times instead of once. Fix: add a_finish-only (or full prepared) latency row for V in {32,768, 131,072, 262,144} at width 1 and max width, and one end-to-endflutter run/ignition benchcomparison, or move this to docs/TODO.txt per AGENTS.md:57-58 and land only the width de-specialization (which is measured and unambiguous). Caveat to state honestly: the merge itself is bit-exact (entry 1) and the 262,144 numbers are large; the gap is evidence scope, not correctness.
#7 [high] No CI-gating test can detect a merge regression; CPU test only reads a private BLOCK int
FINDING (Major, tests). All behavioral verification of the rewritten kernels is CUDA-gated, and CI has no GPU. tests/components/test_logprobs.py:71,122,210:
@pytest.mark.skipif(os.environ.get("FLARE_RUN_CUDA_TESTS") != "1", reason="CUDA opt-in")
CI: .github/workflows/python-cpu.yml:30-33 runs .venv/bin/python -m pytest tests/ -q with
env:
CUDA_VISIBLE_DEVICES: ""
so the three tests that actually verify the merge (test_chunked_finish_matches_exact_top20_tie_ordering_and_preserves_inactive_slots, test_logprobs_kernels_share_one_specialization_and_execute_across_widths, test_logprobs_requested_token_ids_gating_and_functional_graph_capture) never run there.
The only CI-visible test, tests/components/test_logprobs.py:60-68, asserts a private-config integer:
finish_args = dict(zip(_finish.arg_names, op._preparation[3][1], strict=True))
assert finish_args["BLOCK"] == expected_block
It cannot detect a wrong merge: if the 480-key chunk arithmetic at logprobs.py:141-147 were off by one, BLOCK would still be 512 and this test still passes.
Rule: AGENTS.md:194-199 "Tests must exercise the affected behavior or contract; source-text checks and mocks that bypass the behavior cannot establish runtime correctness"; AGENTS.md:302-307 "Report a skipped test as an unrun check."
Impact: the entire tie-ordering guarantee this PR claims bit-for-bit depends on the author's two Jetsons; a future edit to _finish regresses silently in CI. (Fair caveat: every sibling tests/components/*_cuda.py is gated the same way, so this is repo-normal, and the PR does report its hardware run.)
Fix: hoist the merge into a CPU-runnable form (a plain-Python/NumPy transcription of logprobs.py:136-150 already exists in framing as _reference_logprobs, and _finish's ordering can be checked against it with torch.sort on CPU for the small vocabularies 1..64), or drive the existing tests/preparation/test_prepared_triton_serde.py fake-tensor path to at least execute the kernel shape. Alternatively state in docs/TODO.txt that the four logprob kernels are hardware-verified only.
#9 [high] Verified sound: contracts, export path, arg indexing, gating, tie-ordering
VERIFIED NO DEFECT in contracts / export / ABI (report positively):
- No exported-core format, buffer, or ABI change. Scratch layout, shapes, dtypes unchanged (logprobs.py:167-171): stats [b,w,tiles,2] f32, lse [b,w] f32, keys [b,w,tiles,32] u64.
_merge(logprobs.py:248-261) untouched. - The new runtime
widthargument survives export. ignition/preparation/aot.py:242-245 maps plain ints to aintsignature entry ("elif isinstance(value, (int, torch.SymInt)): result.append(int)") and :264-294_share_storage_descriptorssharestype(value) is intoperands, so a Python-int kernel operand serializes into the core. The constexpr->runtime move therefore does not require an ABI change, matching the PR's claim. - Argument positions after the change (logprobs.py:59-62,76-79,93-97,112-117) keep the downstream index arithmetic in prepare()/run() correct:
start = 3 if operation is self.normalization else 4(logprobs.py:215,241) still lands on (slots, epochs, live), andargs[0] = logitsstill skips the None-ed Records argument. Constexpr and runtime positions interleave identically to main, becausewidthreplacesWIDTHin the same slot. do_not_specializeis an established pattern here: ignition/components/engram.py:23 and helios/tests/fixed_core_fixture.py:27,33 already use@triton.jit(do_not_specialize=[...])on the same pinned Triton (pyproject.toml:22 torch==2.14.1+cu132). Not a new dependency.- Existing exported cores still load: they embed their own cubins and never recompile, so the specialization-key change only affects newly produced cores.
- Gating semantics preserved:
_position(logprobs.py:49-56) and thecount > 0/count == 0split (logprobs.py:127,135) are unchanged; onlyposis now int64.posmax is batch*width ~ 2^20, so the int64 promotion cannot change any address. Inactive/stale/unrequested rows still do no writes. - Tie ordering contract unchanged and still met: docs/api.md:107-112 ("ordered by decreasing logprob, with increasing token ID for ties") and docs/logprobs-design.md:92-100. Keeping 32 candidates per chunk (>= MAX_TOP_LOGPROBS=20, completion.py:15) satisfies docs/core-design.md:1276-1279's "threshold ties must never be truncated to a fixed number of candidates" exactly as main did.
- Concurrency/failure propagation:
_finishis one program per (row, col) with no cross-program communication (logprobs.py:118); the loop adds no barriers, no locks, no allocations, no host round-trips. Graph-capture safety is preserved (no dynamic allocation inside the kernel; scratch allocated outside). No new failure mode, no unbounded buffering, no memory amplification (scratch bytes identical).
#12 [high] Research summary
Reviewed PR #673 across correctness, system-level consequences, contracts, and claim accuracy. All findings are in the scratchpad with exact citations; entries 3 and 4 are retracted by entry 5 (I initially inverted the main-vs-PR BLOCK comparison and corrected it against ignition/components/logprobs.py at ref main).
The kernel change is correct. I proved the chunked top-32 merge (logprobs.py:136-150) exact by induction: each 480-key step folds exactly one chunk's worth of candidates into a 480-slot centre while preserving the running top 32, so the result equals a full sort of all tiles*32 keys; the per-iteration mask is not redundant under the final partial chunk, and padding sorts last. Keeping 32 crossings is not a fixed-candidate truncation, so docs/core-design.md:1276-1279 and the docs/api.md:107-112 tie ordering are respected. Also verified sound: argument positions after constexpr→runtime moves (the start = 3 if normalization else 4 index arithmetic at logprobs.py:215,241 still lines up), unchanged scratch layout/dtypes, int64 promotion cannot overflow, and gating semantics intact. The new runtime width operand survives export because ignition/preparation/aot.py:242-245 maps plain ints to an int signature and :264-294 shares them — so the "no ABI change" claim holds. do_not_specialize is already in use at ignition/components/engram.py:23. No locks, barriers, allocations, or failure propagation are added; this is one program per (row, col).
Two real evidence gaps. First, the chunked merge changes _finish's launch for every vocabulary ≥ 16,385 tokens (main passed the unbounded next_power_of_2(tiles*32) = 1024…8192), yet the only measured point is 262,144 µs — no 32k/128k data, and 32k–128k are the vocabularies Flare actually serves. Second, _MERGE_WARPS 8→4 (logprobs.py:26) changes the warp count for every vocabulary, including the ≤16,384 path where BLOCK is unchanged, and is framed only as part of the 512 cap with no measurement. _finish also remains vocabulary-specialized (TILES stays tl.constexpr), so compile cost is bounded per sort block, not vocabulary-independent.
Contracts/docs. No exported-core, buffer, or ABI change and existing cores still load, but docs/logprobs-design.md:90-100 still describes the pre-PR single merge and says nothing about width-agnostic kernels — the doc AGENTS.md:232 requires for logprob work.
Tests. Every assertion that actually validates the merge is FLARE_RUN_CUDA_TESTS-gated, and CI (.github/workflows/python-cpu.yml:30-33 (not opened), CUDA_VISIBLE_DEVICES: "") runs no GPU job, so the only CI-visible test asserts a private-config integer and cannot catch a merge regression. Plus minor items: an empty Discord: line and unrun checks that belong in docs/TODO.txt per AGENTS.md:57-58.
#13 [high] Verbatim quotes bundle for report (policy + PR text), avoid re-reading files
Verbatim quotes needed for report findings. File:line, then quote.
docs/performance-work.md:1-7:
The [core design](core-design.md#performance-acceptance) defines service
baselines and the native replay overhead limit. Measure each optimization
against a baseline with the same checkpoint, GPU assignment, activation
precision, graph capacity, sampling settings, cache conditions, and completed
work. Correctness failures block performance claims.
docs/performance-work.md:119-124:
Measure every captured speculative shape. Physical target rows, `P`, determine
whether expert execution stays in the small-row band or selects grouped kernels.
Rectangular rounds use `P = B × W`; ragged rounds can use fewer target rows.
The [MTP design](mtp-design.md) specifies
round-cost and acceptance measurements. Do not infer a speedup from draft
depth or a component benchmark alone.
docs/core-design.md:1276-1279:
Execution ABI 6 uses `sampling_mode="general"` as its sole
supported manifest value. Bounded top-k optimization is not implemented. Measure
sampler cost inside the complete graph before changing it; threshold ties
must never be truncated to a fixed number of candidates.
AGENTS.md:194-199:
- **Require focused, meaningful validation.** Tests must exercise the affected
behavior or contract; source-text checks and mocks that bypass the behavior
cannot establish runtime correctness. Do not present scaffolding or partially
wired features as supported. Identify missing hardware, inputs, and unrun
checks explicitly. Keep each PR focused on one coherent outcome and describe
its problem, resulting behavior, validation, and material limitations.
AGENTS.md:302-307:
Tests that need a GPU skip unless `FLARE_RUN_CUDA_TESTS=1`. Tensor-parallel tests
also require `FLARE_RUN_TP_CUDA_TESTS=1` and the assigned devices in
`CUDA_VISIBLE_DEVICES`. Tests that need a checkpoint, an exported core, or a
running service read a test-specific variable, such as `FLARE_QWEN38_SNAPSHOT`
or `FLARE_API_TEST_URL`, and skip without it. Report a skipped test as an unrun
check.
AGENTS.md:57-58:
the hardware and configurations on which it is qualified, and what
is not qualified. Record unresolved defects, unrun checks, and pending
measurements in [docs/TODO.txt](docs/TODO.txt), not in design documents.
AGENTS.md:144-153:
Every PR and issue description has a Discord line after the technical
explanation, so project developers can contact the person who opens it directly.
The line gives that person's Discord username, for example
`Discord: example_user`. Write the username without a leading `@`; GitHub treats
`@name` as a mention of the GitHub account with that name. When the person
provides no Discord username, the line states that explicitly:
`Discord: no username provided`. Never omit the line.
PR body, Result table (first and second data rows), for the evidence-scope finding:
| Jetson Thor (`SM110`) cold `PreparedLogprobs.prepare()` | `65.40 s` | `4.46 s` | **14.7× faster** |
| Jetson Thor (`SM110`) `_finish` GPU latency (width 6) | `84.2 us` | `38.2 us` | **2.2× faster** |
| Jetson Orin Nano 8 GiB (`SM87`) cold `PreparedLogprobs.prepare()` | ~19.5 min | 11.83 s | **~100× faster** |
PR body, Limitations section:
- **Limitations:** `SM103`/`SM120`/`SM121` GPUs, end-to-end `ignition export` / `flare run` serving benchmarks, and Orin Nano's old `BLOCK=8192` runtime latency were not measured in this pass.
PR body, What changed, chunked-merge bullet (demonstrates the claim the diff supports):
- **Chunked top-32 merge in `_finish` (`ignition/components/logprobs.py`):** Capped `_finish`'s sort block at `512` elements (`4` warps) instead of growing up to `8,192`.
This bullet is ACCURATE (see entry 5) — so the evidence-scope finding is about coverage, not misattribution. Do not claim misattribution.
docs/logprobs-design.md:128-130:
A zero request flag bypasses vocabulary reads, sorting, and payload writes.
Requests without logprobs incur only the gated launches. Performance claims
about the reduction require complete replay and service measurements.
#8 [medium] Process: empty Discord line and unrun checks not recorded in docs/TODO.txt
FINDING (Minor, process/completeness). Two unrun-check items are not filed where the repository requires them.
- Empty Discord line, PR body:
Discord:with no value. AGENTS.md:144-153: "When the person provides no Discord username, the line states that explicitly:Discord: no username provided. Never omit the line." - Unmeasured items live only in the PR body, not in docs/TODO.txt. AGENTS.md:57-58: "Record unresolved defects, unrun checks, and pending measurements in docs/TODO.txt, not in design documents." The PR body's own limitations list is: "
SM103/SM120/SM121GPUs, end-to-endignition export/flare runserving benchmarks, and Orin Nano's oldBLOCK=8192runtime latency were not measured in this pass." There is an existing, closely related open entry at docs/TODO.txt:175-178:
[ ] Measure the serving cost of the 258-field completion_logprobs output and of
width-masked mixed-graph merges on an exported core against a core whose
last extent is 42. Close when the cost is measured and accepted or reduced.
See helios/manifest.md.
Fix: (a) write Discord: no username provided (or the handle), (b) add one TODO entry covering the unmeasured _finish/_merge reduction at 32k-128k vocabularies and the unexported-core check, or fold it into the existing :175 entry.
Note: docs/TODO.txt is NOT where measurements go in design docs (AGENTS.md:58) — so the doc fix (entry 2) is architecture text only.
#10 [medium] _finish is still vocabulary-specialized (TILES constexpr unrolls the merge loop)
FINDING (Minor, claim scope). _finish is still specialized per vocabulary, so its compile cost was bounded but not made vocabulary-independent.
ignition/components/logprobs.py:137-143:
total: tl.constexpr = TILES * CANDIDATES
base = pos * total
keys = tl.load(Keys + base + k, k < total, other=0)
keys = tl.sort(keys, descending=True)
if total > BLOCK:
step: tl.constexpr = BLOCK - CANDIDATES
for offset in range(BLOCK, total, step):
TILES remains tl.constexpr (logprobs.py:114) and is passed from tiles = triton.cdiv(vocab, _VOCAB_TILE) (logprobs.py:163,183). Because total and step are constexpr, range(...) is resolved at trace time and the loop is fully unrolled: V=262,144 emits 1 + 16 = 17 unrolled 512-element sorts in one cubin. A larger vocabulary (V=1M, 1024 tiles) would emit 1 + 66.
So the PR's "one compiled kernel for all widths" is exactly right, and the 512 cap does cut the unrolled network cost sharply, but a core still carries one _finish cubin per prepared vocabulary (as on main). Worth saying explicitly because the PR title ("Bound PreparedLogprobs merge block") reads as if compile cost became vocabulary-independent, and the measurement table only covers one vocabulary.
Fix: one clause in the description — "_finish remains specialized per vocabulary because the merge depth follows the tile count; the bound is on each sort block, not on the number of blocks." No code change required.
#11 [medium] CPU test asserts on private _preparation tuple positions
FINDING (Minor, test brittleness). The CPU-readable test couples to a private tuple layout that this same PR edits. tests/components/test_logprobs.py:65-68:
op = PreparedLogprobs(logits, completion, slots, epochs, live, frame)
finish_args = dict(zip(_finish.arg_names, op._preparation[3][1], strict=True))
assert finish_args["BLOCK"] == expected_block
_preparation is a private tuple built at logprobs.py:176-186; [3] is the _finish entry and [1] its args tuple. It is emptied by prepare() (logprobs.py:203) and reordered by functional() (logprobs.py:214-218). The test also constructs PreparedLogprobs on device="meta" logits with a meta completion bundle, relying on validate_completion_buffers accepting meta tensors.
Impact: a future reordering of the prepared-operation tuple (which this PR itself already touches at logprobs.py:182-185) fails this test with a KeyError/ValueError that looks like a kernel regression. Test-only, CI-visible, cheap.
Fix: derive the block from a public expression instead, e.g. assert min(triton.next_power_of_2(triton.cdiv(vocab, 1024) * 32), _MERGE_BLOCK) == expected_block, or expose the value the constructor already computed (op.merge_block) and assert on that. That keeps the regression value (the cap is bounded) without pinning tuple positions.