Explore scratchpad · NVIDIA/hyperflare-inference #736

Raw Markdown for agents: https://autobot.eidonix.com/p/a7615e64-16bf-47c2-9fd9-123f270a92d1.md

#1 [high] Change: what PR #736 does, size, files

PR #736 (open, head 500b7746, base main, 11 files +601/−25) is byte-for-byte the same size and file list as closed PR #735 (+601/−25, same 11 files). Files:

Undeclared/notable behavioural details beyond the description:

Patch is a single commit (500b7746, author ebfio, date 2026-12-04), no CI checks configured (orientation packet: "no checks"), 0 reviews, 0 comments.

#2 [high] Related work: #181 (closed draft) is the same fix by a different mechanism

PR #181 "Clear released snapshot-alias pages before their first KV use" by mark-yong (CONTRIBUTOR), opened 2026-11-03, closed 2026-11-15 without merge, +353/−53, 18 files, labels area:caching, area:memory, model:qwen3.8-27b, triage:verify-for-closure; "Fixes #116".

Mechanism: scheduler marks a page when its last alias is released; when commit first moves a marked page from a request reservation into its KV pages, the submission carries the page id and the mark clears. Every executor zeroes listed pages with cuMemsetD8Async on the model stream, after input copies and before the step's graph. TP PREPARE frames carry the list to every rank (handshake layout 7), peers validate before READY. Explicit rationale in its description: "Pages are not cleared at release, where inbound host restores could still be writing, or at reservation, which may be returned unused."

That is the exact design point PR #736 reverses: #736 clears at release (inside release_snapshot queue) and adds an explicit zero-before-store.fetch barrier (runtime.rs:3998-4001) to cover the inbound-restore race #181 avoided by construction. #736 also clears before executor.submit (runtime.rs:3219) rather than inside the submission, and adds dedicated NON_BLOCKING streams instead of the model stream.

Same files touched by both: helios/src/cuda.rs, execution/parallel.rs, execution/parallel/tests.rs, execution/parallel/wire.rs, execution/ranks.rs, execution/threaded.rs, execution/transport.rs, scheduler.rs, scheduler/cache_memory.rs, server/runtime.rs — 10 of 11 files overlap. #181 additionally rewrote helios/src/runtime_package/cache_memory.rs and docs; #736 instead touches server/runtime/phase_tests.rs.

Note: #181's file list uses runtime_package/ naming that no longer exists on main (runtime_core/), i.e. the code moved underneath it.

Discussion on #181 (per read_item #181): 2026-11-05 original-el8 says the need for scheduler-level page clearing "should be re-established after the attention masking fixes"; FlashInfer PRs local-inference-lab/flashinfer#73 and #74 fix leading-window and MSA tail masking; labelled triage:verify-for-closure. 2026-11-08 refresh: main 86c217a0 pins FlashInfer 07c41f32 which contains window-lower-bound masking in attention/paged_decode/_kernel.py and MSA visible-extent checks, so the older triage note no longer applies; still wants the remaining DeepSeek/SM121 repro repeated. 2026-11-13 merge conflicts in helios/src/scheduler.rs. 2026-11-15 mark-yong "Closing this PR". So #181 was abandoned for staleness, not because the bug was disproven.

#3 [high] Why: issue #116 (open, P1, triage:partial) is the underlying bug report

Issue #116 (open, P1, labels area:caching, area:kernels, bug, model:deepseek-v4.1, model:qwen3.8-27b, triage:partial) by shadowpa0327, opened 2026-10-27, last updated 2026-11-19, 8 comments. Title: "Released snapshot aliases hand KV pages back with stale row bytes; masked attention turns them into NaN (device error 6 under KV pressure)".

Mechanism in the issue matches #736's premise exactly: snapshot rows borrow KV page bytes; when the last owner releases a snapshot, release_snapshot returns pages to the free list without clearing; a request receiving such a page as its partly filled tail page keeps old row bytes past its last token; masked positions still contribute 0 × NaN = NaN to P·V; target logits non-finite; commit reports INVALID_SPECULATION (device error 6).

Environment: DGX Spark GB10 (SM121), single GPU, CUDA 13.0, Qwen3.8-27B-NVFP4 qwen38_dense defaults, FP8 KV, adaptive MTP verification, Flare ca1f960e; code unchanged on main at 6256cf08.

Evidence in #116: "Released alias pages zeroed before reuse | no failures in 143 of 143 prompts. Default memory also passes 143 of 143, where it failed at prompt 67 before". Zeroing-on latency unchanged: 8k N=1..32 27.6/50.4/93.0/159/242/305 tok/s vs 28.2/49.0/92.8/154/244/308 tok/s without. The author's tested implementation was a single-GPU fork branch (shadowpa0327/flare-local-inference@b83d347a) using a global page list and pinned-zero H2D copies, explicitly not covering the multi-process TP executor, and referenced as reference not patch. Issue's three proposed fixes: (1) zero pages leaving alias use, (2) clear only dead tail, (3) make masked positions inert in kernels.

Data points in comments: fahrenhe1t 2026-11-03 RTX PRO 6000 Blackwell SM120 + DFlash2, 32 mid-stream device error 6 failures over ~15 min agentic traffic, mostly batch=1 width-8 packed rounds; mark-yong 2026-11-04 poison-test matrix on SM120 FlashInfer 3c2729e7 saying all SM120 kernels he tested mask K correctly but four kernels leak masked V/MLA rows into P·V (b12x paged_decode #201, paged_tma #202, selected-block prefill #203, sparse_mla #204) and explicitly "Not covered: SM121 and SM103 paths" and "CUDA graph replay; all runs were eager"; jwnand 2026-11-05 DeepSeek-V4.1-Flash GB10 SM121 TP4 4x DGX Spark failure too; yatesdr and mark-yong 2026-11-19 discussing scripts and speculation.py:412-428 / :674-703.

Significance for #736: #116 is the single linked report of the bug in-repo, it is labelled triage:partial (not closed), it was reproduced on SM121 (GB10) and SM120, and the kernel-level fixes proposed there (flashinfer P·V masking) are the competing remedy. #736 targets SM103 (GB300/GB10*? actually CC 10.3) which #116's poison matrix explicitly did not cover.

#4 [high] Related work: kernel-masking fixes (#14, #201, #202) are the competing remedy, SM103 never covered

Same-class bug was already fixed in kernel/masking space for SM120, and project triage preferred that route. Chain (all closed, all explicitly "SM121 and SM103 not exercised"):

Consequence for #736: the project's own precedent (#202's decision, #181/#116 triage notes) was that the finite-padding contract would be met in the kernels, not by clearing cache pages in Helios. #736's own isolation matrix shows that on SM103 the trtllm FP8 FMHA path still lets masked V tail bytes reach P·V (B_v_nan: 100% NaN across every backend/mode/window/seq_len, inf 0) — i.e. the SM103 kernel has not received the masking fix SM120 got, and #736 works around it at the cache layer instead. Nothing in the repo issues/pulls reports an SM103 kernel fix in flight (search for "SM103" + V-cache tail returns only #735/#736).

Corollary advantage of #736's approach: it is scheduler/runtime-side, so it applies to already-exported cores without re-export (contrast #14's comment that kernel fixes require re-export).

#5 [high] Change: things the description does not say

Verified from diff + head commit 500b7746 (single commit, author ebfio, 2026-12-04):

  1. A new CUDA stream is created unconditionally for every GraphExecutor at construction (transport.rs:626 let zero = Stream::open(...), stored at :720, Resources.zero :573) and drained in close() — even for cores with no snapshot aliasing. One extra CU_STREAM_NON_BLOCKING per rank per process regardless of feature use.
  2. TP zeroing is synchronous and blocks the coordinator: TensorParallelExecutor::zero_kv_pages sends ZERO_KV_PAGES to every peer with nonblocking(false), zeroes locally, then blocks in peer.channel.wait(false) per peer with a per-peer TIMEOUT (120 s) deadline (parallel.rs:288-330); any error sets self.poison for the whole executor.
  3. Threaded (single-process TP) zeroing synchronizes every peer stream after enqueue (threaded.rs:1235-1245) and holds WatchdogCallGuard::enter(&self.watchdog_state, !self.pending.is_empty()) (:1227), so a snapshot release can stall the coordinator loop mid-frame.
  4. Rank control protocol gains two message tags with no version/layout bump: ZERO_KV_PAGES = 14, ZEROED_KV_PAGES = 15 (parallel/wire.rs:27-28); an old peer rank would hit => return Err(invalid("unexpected rank command")) (parallel.rs:752). Page-id payload capped at MAX_PACKET 64 MiB (wire.rs:500-509).
  5. coalesce_page_runs treats an out-of-range page id as a fatal error (transport.rs:1442-1463: "reclaimed KV page {page} exceeds cache page capacity {capacity}"), which then poisons the executor — a scheduler bookkeeping bug becomes a fatal worker error.
  6. Construction ordering dependency: peer zero streams are opened before rank zero's GraphExecutor specifically so rank zero's CUDA context stays current on the coordinator thread (threaded.rs:873-880 comment).
  7. Teardown asymmetry: clean close() drains + clears peer_zeros; poisoned teardown std::mem::forget(std::mem::take(&mut self.peer_zeros)) so cuStreamDestroy_v2 is never called on a wedged context (threaded.rs:1297-1308).
  8. Worker::admit is now #[cfg(test)]-only and delegates to the new admit_with_executor(Option<&mut RankExecutor>) (runtime.rs:1796-1804); admit_with_host_store gained a closure parameter mut zero_kv_pages: impl FnMut(&[u32]) -> Result<()> (runtime.rs:3859), a fairly invasive signature change for a single caller.
  9. GraphExecutor::zero_kv_pages returns silently when the manifest has no cache geometry (transport.rs:1366-1369 Ok(false)), and ThreadedExecutor skips peer sync for caches with empty planes.

#6 [high] Claims and evidence: 4 CPU tests verified; GPU path and SM103 numbers unbacked in-repo

Claims vs backing (no CI checks exist on head 500b7746; verified from the PR text and repo state): Backed:

#7 [high] People: author ebfio (first-time contributor, SM103/GB300 operator); no engagement on #735 or #736

Author ebfio, GitHub association FIRST_TIME_CONTRIBUTOR; 0 merged PRs in 180 days, 1 closed PR, 4 open PRs/issues:

Who normally works these areas (commit counts last 180 days, helios/src): Luke Alonso (249), Martin Vit (52), yatesdr (52). The touched files' recent owners: transport.rs — lukealonso (#645 prefill scheduling/two-frame pipelining, #613 deferred_prefill/shared_pages/teardown, #507, #430); scheduler/cache_memory.rs — lukealonso (#595 TLA+ invariant + retain_snapshot cache wipe + DispatchRing race, #568), original-el8 (#473 KV plane granule padding + two-row snapshot selection), yatesdr (#674 snapshot packing, #346, #354), FujitsuPolycom (#309); server/runtime.rs — jcartu (#621, #691, #692, #705), lukealonso (#709, #711, #729), yatesdr (#663, #694). Engagement on this PR: none. pr_comments returned "No comments"; orientation packet: "Reviews: none yet", "CI on the head commit: no checks". Closed #735 also had 0 comments. No reactions anywhere.

#14 [high] Connection: #735→#736 is a 4-minute close/reopen of the identical patch; #116 link missing

#735 vs #736 — same patch, two records. The public record therefore contains the identical description twice:

Also worth recording: the PR never links #116, the only open issue describing this exact root cause (P1, triage:partial, 8 comments, reproductions on SM121 GB10 and SM120). #116's own proposed fix #1 is this change, and its "what fixes it" A/B ("Released alias pages zeroed before reuse | no failures in 143 of 143 prompts") was measured with a single-GPU implementation that #116's author explicitly says "doesn't cover the multi-process tensor-parallel executor". #736's contribution beyond #116's experiment is precisely the multi-executor + TP-wire + host-restore-ordering coverage.

#15 [high] Research summary

I prepared the case file for PR #736 (open, head 500b7746, 11 files +601/−25) with 14 scratchpad entries covering every angle.

What the change does, verified from the diff: it adds a reclaimed-page queue to RequestScheduler (scheduler.rs:669, pushed at cache_memory.rs:831 when page_snapshot_refs drops to 0, drained via take_reclaimed_snapshot_pages :844), a dedicated CU_STREAM_NON_BLOCKING zero stream per GraphExecutor and per cache-owning peer in ThreadedExecutor, coalesced cuMemsetD8Async over cache planes, new ZERO_KV_PAGES/ZEROED_KV_PAGES rank wire tags, and six flush points in Worker's loop plus a zero-before-store.fetch barrier in admit_with_host_store (runtime.rs:3998-4001).

Highest-value findings a reader could not get from the description:

#16 [high] Why: six-week, three-hardware-class, four-reporter history behind one PR

Timeline (how long wanted, how widely):

#8 [medium] Project fit: charter #210/#397/#404/#267 vs the change; docs untouched

Charter (read_charter) relevant lines, as facts:

Documentation: docs/runtime-core-design.md:942-951 qualifies native/DCP startup and says "GPU tests preserve snapshot bytes while released KV pages are overwritten. These checks do not constitute model-quality evaluation." — the design doc documents released-KV-page overwrite but says nothing about snapshot-backed pages being zeroed after release; #736 does not update any doc (docs/runtime-core-design.md and docs/prefix-cache-offload.md are untouched, while #181 did touch docs/runtime-package-design.md). Also docs/runtime-core-design.md:1011-1014 documents flare_snapshot_backing_pages / flare_free_snapshots semantics that this change leaves intact; no new metric or config key is added. helios/src/runtime_core/cache_memory.rs:2110 — "Zero each physical byte once, before any graph or transfer can read an alias" is the existing startup-time zeroing; #736 adds a second, release-time zeroing pass. That invariant comment is the documented premise the bug breaks. docs/core-design.md:3 and docs/cli-design.md:6 confirm SM87/SM103/SM120/SM121 as supported targets.

#9 [medium] Reach/evidence: the race barrier covers store.fetch but pool-tier fetches go through the same HostStore

Code verification of the design's safety argument (from source, not a code review of style):

#10 [medium] Reach: Local/Threaded/Parallel executors and cross-node peers; no operator surface; conflicts with open runtime.rs PRs

Reach in code (who/what is touched):

#11 [medium] Process: ready-for-review, no CI checks, no reviews, no issue link, agent-generated patch

Process facts:

#12 [medium] Related work: #674, #621, #659, #729, #705 and other runtime.rs PRs

Adjacent items checked and judged not directly competing, with reasons:

#13 [medium] Recent activity: main moved (#723/#729) after the PR base; no prior landing of this fix

Recent activity in the touched areas (default branch, last 60 days, per orientation packet + module history):

#17 [medium] Community: nothing found (no comments, reviews, labels, reactions, or maintainer engagement)

Community angle — explicitly nothing found: pr_comments on #736 returns "No comments." The orientation packet records "Reviews: none yet" and "CI on the head commit: no checks". Closed sibling #735 also has 0 comments/reviews (read_item #735: "Discussion (0)"). No labels on #736 (no area:/triage: label, unlike merged helios PRs such as #659 which carried area:memory, performance, triage:validation). No reactions anywhere. No maintainer (lukealonso / original-el8 / yatesdr / jcartu) has engaged. For contrast, the neighbouring #705 (jcartu) drew three Autobot review rounds within two days and #659 drew an Autobot review plus author follow-ups — so the absence of any engagement on #736 is a factual gap in the record, not a signal of judgement.

Also nothing found for: no documentation update anywhere in the diff (docs/ untouched), no new tests other than the four listed, no changelog entry, no feature flag or config key, no dependency or pin change, no wire-format version bump beyond the two new u8 tags, no metric added, and no evidence of prompt-injection content beyond the patch-pack apply instructions in the body.