mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #879] All-logits-NaN degeneration (one repeated token forever) still fires on 0.1.39b / current main — first poison traced to the MoE output rows: garbage bits, varying layer #385
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#385
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @66419118nnn on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/879
Follow-up to ROCm/legacy-rocm-build#606 with a working statistical reproducer and a full instrumentation suite. TL;DR: the degeneration survives 0.1.39 (both q8_1 clamps +
repeat_stop_tokens); it also survives disabling the unclamped fused-SwiGLU quantizer that rwkeyes identified below. Layer-trace instrumentation on current main (6f32ec0) shows the first non-finite value of a window being produced in the MoE path — of the 13 fires with per-layer traces, the first poisoned signal is the routed-expert rows in 11, the attention block's output of layer 28 in one (with that layer's input, GDN state and PLE all clean), and the layer's combined contribution only (a 2-signal early build) in the last — while the layer input, GDN/QSA state, PLE history, KV, CPU-pool output and the expert-cache slot bytes are clean in every fire. In all 6 fires that recorded raw bits, the GPU-side value is the same non-canonical NaN payload 0x7FFFFFFF; the miss side recorded garbage payloads twice (0x7FD6E000, 0x7FD3E000) and a canonical arithmetic NaN once (0xFFC00000). This is a data-path defect, not an overflow, so the clamp family of fixes cannot close it.Environment
main6f32ec0(0.1.39b), built locally (CUDA 13.0, sm_120) — and, for the earlier half of the fires, 0.1.35 with an equivalent local patch set. The signature is identical across both (300 commits apart, including the ROCm/legacy-rocm-build#606 fix).--expert-cache auto(6 493–6 714 of 24 576 experts resident in VRAM across boots, ≈ 26–27%),--resident-budget-gib 53(clamped to 50.5–51.6 GiB page-locked complement, whatever the boot leaves free),--spec 3, suffix drafts on,--pcie-frac 0.55,--kv int8,--prefill auto:32768, ctx 224 000.Reproducer (statistical: 1 fire per 1–18 replays; every completed 30+-try round has fired at least once)
A real agentic request whose window failed (85 688-token prompt, 47 messages, 26 tools,
reasoning_effort xhigh), captured verbatim at guard failure by a serve-layer hook in our local patch, then replayed with fresh seeds:(
replay-degen.pyis in the gist; the capture contains my private conversation, so I will share it directly on request rather than attaching it. It reproduces on this 5090 D with a partial-residency tier; not yet verified on other cards.)Every observed ignition in long-context traffic lands at positions 77 261–88 443 — in every fire whose prompt length is known, within ~3 000 decoded positions after prefill — plus one short-context fire at position 311, three minutes after a cold start. On four 0.1.39b rounds today the fires landed at try 6, 18, 1 and 9 of 40; earlier 0.1.35 rounds hit ~1 fire in 15–20 tries. Deterministic per-seed reproduction does not survive an engine restart — the trigger needs process-level state (cache residency/swap history), which is why rounds must be Monte-Carlo.
What the instrumentation is (all of it is in
local-patches-20261005-0139b.diff, ~440 lines on top of6f32ec0)logits_nonfiniteinsampler.cu, enqueued into the captured verify-window graph, flag read after the sync the window already performs — measured zero cost): a window whose logits are non-finite fails instead of being sampled, so the symptom becomes a clean request error instead of 9 613 consecutive!.lay_flags_inverify.cpp): layer input (folded residual), attention block, shared expert, routed total (post-fold), combined output, GPU cache-hit rows (hit_out_), CPU miss rows (parts_pre-fold).audit_hit_rows): scans only the rows in this layer's GPU plan (p_dst[0, counts[1])), so a stale row the engine never reads cannot masquerade as poison.STRATA_KERNEL_AUDIT=1, innative_expert_grouped): scans the gu (gate/up) outputs, the SwiGLU output, and the down-projection output.Evidence
Fire A (0.1.39b + guard only, try 6): position 88 443 — fires with the owner's full 0.1.39 fix in place.
Fire B (0.1.39b +
STRATA_FUSED_SWIGLU_Q81=0, try 18): position 87 353 — the third unclamped quantizer is not the cause either.Fire C (0.1.39b + layer trace, try 1): position 87 611 — (log lines verbatim; the ← annotations are mine) —
Fire D (0.1.39b + everything, try 9): position 85 965 —
From the 0.1.35 instrumentation (13 fires with dumps, same shapes):
Across 21 fires (0.1.35 + 0.1.39b): the first poisoned layer varies — {3, 13, 15, 16, 18, 20, 22, 26, 28, 37} — with GDN and QSA layers both appearing, and both sides of the hit/miss split having fired first (the routed-expert rows are the first poisoned signal in 11 of the 13 fires with layer traces; one, position 85 683, has the attention block's output of layer 28 first, with that layer's input, the GDN state and PLE all clean — so the defect is not exclusive to the expert GEMMs). What is invariant: the GPU-side first non-finite value is the same garbage payload 0x7FFFFFFF in all 6 fires that recorded bits, and everything else — weights, cache slots, pool output, persistent state — is clean at the moment of the failure dump.
What is ruled out, and what is left
ent_dst-indexed write, or — for the miss-side fires — the host-publish → mapped-memory read-back of the pool's rows) is what the instrumentation localizes to; I have not been able to close that last inch from outside the kernels.Suggested places to look (in
native_expert_groupedand the window graph)launch_gu/launch_down: the GEMMs writegate/up/outrows for the plan's entries; if any launch's row range orent_dstbase assumescounts[1] == cap(or strides bycapwhile the plan is shorter), it writes or reads rows the plan does not own — which is exactly where a stale-scratch 0x7FFFFFFF can be laundered into a consumed row.hit_scratch_/nat_xq_reuse across CUDA-graph replays with varying window T (spec 3 + suffix drafts means T cycles 1–5 and the graphs are instantiated per T): the stage audit caught garbage in the gu output of a late layer, i.e. bytes surviving in scratch from earlier in the window or from a previous window.expert_pool_dispatch_multi→ host publish →copy_rows_from_mapped): the host's rows are finite at publish and at failure time, yet the pre-fold miss row held 0xFFC00000 — worth checking the flag-ring (m_flag_/wait_flag_ge) sequencing under graph replay for the group-skip (skip_ + grp) cases, and the pool's memset of GPU-kind rows (expert_source.cpp, thekind[i] >= 0branch).0x7FFFFFFFpayload specifically: four 0xFF bytes. In a q8_1 block that is the pattern ofds = {inf-ish, inf-ish}written as raw bytes, or a half2 sentinel — a hexdump of the 16 bytes around the recorded (row, col) ingate/hit_outwould tell which.Mitigation we run in production (offered as-is)
The verify-window finiteness guard from the attached diff: a non-finite window fails cleanly (one bad request instead of minutes of
!spam), the engine exits, and the failure dump lands in the engine log with position/row/bits. Together withrepeat_stop_tokensit bounds the damage; it does not, of course, cure the root cause.Everything referenced above is in this gist: https://gist.github.com/66419118nnn/7c9399d982d98229c61fcefaaa0b9215 — the full experiment report (Chinese),
fires.jsonwith all 21 fires and their verbatim dumps,replay-degen.py, both patch sets (0.1.35 and6f32ec0), and the four round logs.@66419118nnn commented on GitHub (Oct 5, 2026):
Addendum: deterministic reproduction, race hypothesis, and corrected residency model
1. Deterministic repro (~100% within a few rounds, any client)
Output degenerates into single-character
!spam within a few rounds. Verified on oh-my-pi, Qoder, and zCode — all behave identically, so this is client-independent.2. Hypothesis: deferred-abort teardown/setup race
Abort is deferred until the next request arrives, so request N's teardown (slot / KV block / scratch release) runs concurrently with request N+1's setup reusing the same buffers. This window is the likely injection point.
This also suggests where
0x7FFFFFFFcomes from: it isINT32_MAX, the standard sentinel / invalid-ID value in engine code. An int32 sentinel landing in memory later read as fp32 decodes exactly as NaN (all-ones exponent, non-zero mantissa) → NaN in the MoE output row → collapsed distribution → garbage token.3. Corrected residency model
!tail is in KV, keeps being attended to, and in-context degeneration self-sustains.Lifecycle: race seeds the poison into the new session's KV at birth → in-context degeneration perpetuates it. This matches the ROCm/legacy-rocm-build#728 observation that presence_penalty 1.5 "helps for a while, still recurs less often": the penalty weakens the attractor (perpetuation) but doesn't remove the seed.
4. One-line discrimination experiment
In a poisoned session, truncate context back to before the loop and regenerate. Recovers → KV-tail self-sustainment (fix: detect + KV rollback). Still spamming → a session-private buffer re-poisons every step (fix: session buffer lifecycle).
5. Why agent users are hit hardest
Agents constantly abort + edit + resend (retries, cancelled tool loops). Incidence is plausibly a function of abort-resend cycles, not uptime — consistent with ROCm/legacy-rocm-build#606's 36k-token trigger and ROCm/legacy-rocm-build#728's "after a while".
6. Suggested audit targets
Side note: "abort only takes effect when the next request arrives" is a user-visible abort-latency bug on its own — possibly worth a separate issue.
7. Guard improvement
The 256-repeated-token guard misses whole-sentence loops (1,110× sentence loop in ROCm/legacy-rocm-build#728, traced to ROCm/legacy-rocm-build#819 — separate chain). If the KV-tail hypothesis confirms, the right response on detection is auto truncate-KV-tail + regenerate, turning the guard from session-fatal into self-healing.
@cjdell commented on GitHub (Oct 5, 2026):
Following this issue with an independent data point — a second card/toolchain/quantization tier, so the defect reproduces on HIP/RDNA4, not just CUDA/sm_120.
Box: Radeon R9700 32 GB (gfx1201, HIP), Ryzen 5700G, 93 GB RAM, Strata 0.1.39 built from
6f32ec0(the same revision you used). Model: Qwen3.8-Flash-Next IQ3_XXS (ISTA-DASLab GSQ-RCO, native pack). Engine args:--spec 4 --spec-min-p 0.5 --kv int8 --kv-resident 32768 --max-context 262144 --expert-cache auto --prefill auto(only the R9700 is visible;HIP_VISIBLE_DEVICES=0). Our build carries all four fp16 clamps (native_swiglu_quantize_q8_1_kernelfrom437a753, theiq_kernels.cufused gate/up store, and thekv_q8.cu+prefill/kernels.cuint8-KV scales — verified present in the running derivation), so this fire is with the full clamp set in place, matching your finding that the clamp family is insufficient.The fire: a ~3h45m Pi agentic session, one ignition near its end. Prompt only 100,134 tokens (not 130K+): the reply came back as a thinking block of
!×255,finish_reason: "length", output 256 tokens, cacheRead 99,889. Engine log, same second:the reply repeated one token ('!') 256 times in a row: ended as "length" (repeat_stop_tokens ...)followed bythe reply reached max tokens while still thinking, so it has no answer. Two extra observations that may help localise it: (1) this is the first fire we've seen in the reasoning channel rather than the answer text; (2) the clamps did close the long-context site — on the same restart a previously-failing ~132K (索) prompt completed (reading the prompt: …132,947 tokens→done: 2560 tokens (stop)), and the engine went on to serve 141K–149K prompts fine immediately afterwards, so the post-fire engine was not in a global ROCm/legacy-rocm-build#606 state. The ignition is intermittent and process-state-dependent, exactly as your reproducer reports. We don't have raw-bit instrumentation on this build yet; if it's useful I can port your guard (or therecord_first_nonfinite/STRATA_KERNEL_AUDITbits) to HIP and report the payload — happy to know which of the two you'd prefer as a confirmation.My workarounds:
https://github.com/cjdell/nixos-config/blob/main/hosts/zen3-nixos/ai/strata-package.nix
@Niko1221 commented on GitHub (Oct 6, 2026):
Thank you for the traces. 0.1.40 changes three things that touch this. The residency-table uploads wait for their own copy before the verifier reads the table (PR ROCm/legacy-rocm-build#550). A window no longer runs the 100%-resident graph while any expert is out of VRAM (#871). And a Stop sent during the prompt read now reaches the engine at once. We ran stop, edit, resend 8 times on 0.1.39 and 8 on 0.1.40 (Q2_0, partial residency, RTX 5070, STRATA_DBG_NAN=1) and saw no degeneration and no non-finite values, so we could not reproduce it. Please retry on 0.1.40. If it still fires, send the log with STRATA_DBG_NAN=1 and try --adapt-every 100000 and no --resident-budget-gib.
@Kelsidavis commented on GitHub (Oct 7, 2026):
Additional reproduction on Linux with Strata 0.1.40 (locally built CUDA 12 engine, sm_70 + sm_86; Tesla V100 and RTX 3060). Checkout HEAD is
82f46a8c8f475f001ad76d92f58f4a4f8ffb0253; its latest engine-source commit is1cbcacbcae2953f3be9edc46369f0c875bc6ab8b. The binary’sBUILD.jsonsource fingerprint is6f298dff754d187f, and it matches the current engine-source fingerprint. V100 ECC was disabled (no retired ECC pages reported). Relevant engine options:--max-context 131072 --kv int8 --kv-resident 32768 --spec 4 --spec-min-p 0.5 --mtp [model] --expert-cache auto.After a fresh server/engine start, requests worked normally for about 21 minutes. The first observed degenerate response was at 18:49:39 PDT: a 35,278-token prompt, 16,384-token output limit, and 478 generated tokens before the server detected 256 consecutive
!tokens in reasoning and ended withfinish_reason=length. Subsequent requests also produced!: a 21,818-token prompt with a 6,000-token limit stopped after 282 generated tokens, and an 18,943-token prompt stopped after 348. The 21,818-token request had thinking disabled and repeated!in answer text, so it was not confined to reasoning.I then tried an independent synthetic 57-token health check, with
max_tokens=64,temperature=1.0,top_p=0.95,top_k=20. It returned 64!tokens inreasoning_content,finish_reason=length, and no answer. This was a fresh prompt and the engine remained reported as loaded; changing sampling did not clear the state. Its last reported expert-cache hit rate was 95.6%, with all 30 draft tokens accepted.POST /unloadfollowed byPOST /load(same Python server process) cleared the problem. The identical health check then returned a normal answer,finish_reason=stop, 27 generated tokens, with 18 of 21 drafts accepted. This appears consistent with the follow-up investigation in #879. I do not have a minimal trigger, but this confirms the stuck output can recur on 0.1.40 and persists across unrelated requests until the engine is reloaded.@Niko1221 commented on GitHub (Oct 7, 2026):
0.1.40.2 adds tools/stop_resend_test.py: it streams an answer, stops reading, and resends or edits the prompt after 0 to 0.4 s (or with another request already running), and fails on an empty answer or a repeated token. Please run it against your server with the engine started with STRATA_DBG_NAN=1 and tell us what the log names.
@VeenLee commented on GitHub (Oct 9, 2026):
My machine has encountered the same peoblem:
the reply repeated one token ('!') 256 times in a row: ended as "length".
Enter COMS setting and disable XMP solved my problem, RAM frequency has dropped from 6400MHz to 4800MHz.
@MKheru commented on GitHub (Oct 10, 2026):
HIP / RDNA4 (R9700): the poison is born in the batched prompt path for chunks of ~193–256 tokens —
--short-read 260avoids it (0 / 770 vs 27 / 1,471 in that window)A night of targeted runs on 0.1.40.2. Short version: every all-
!fire we could produce (28 of them) came from a prompt read of 198–258 new tokens on top of a cached conversation, i.e. a batched prompt chunk of about 193–253 tokens. There were none in 4,419 requests whose read fell outside that window.STRATA_DBG_NAN=1puts the first non-finite values in a layer's MoE output during that chunk. Raising--short-readto 260, so those reads go through the verify windows instead, gave 0 fires in 770 requests (312 of them inside the window) at no measurable speed cost.Setup
Local patch, for transparency. Three files are changed:
remote_experts.cpp,remote_expert_opt.cuandgenerate.cpp. The patch lets the HIP engine use an NVIDIA card as--expert-cache-device1through a dlopen'd CUDA library, and accepts--resident-expertswith that helper. It does not touchprefill.cpp, the prompt-path kernels or the verify kernels. The helper only takes part inRemoteExperts::begin/finish, which run in the decode windows. We did not run without the helper. cjdell's report above, which has the same shape on a single R9700, suggests it is not needed.Engine arguments (container paths):
In production
We traced about 730 agent requests (an OpenAI-compatible coding agent with tools). Two fires had the same shape:
!from the first token; the next 15 requests of that conversation too!from the first token; the next 3 requests tooA new conversation was always clean. Replaying the failing request verbatim on a fresh engine, alone or after the requests that led to it, was clean. cjdell's fire above has the same shape: 99,889 cached + 245 read.
tools/stop_resend_test.pypassed 40/40 withSTRATA_DBG_NAN=1.Localisation (
STRATA_DBG_NAN=1, verbatim; 204 tokens read → chunk T 199)550,400 / 1,280 = 430 GU rows, and 1,100,800 / 2,560 = 430 Dm rows, i.e. 43 tokens × K = 10. So 43 of the chunk's 199 tokens have all their expert rows non-finite, which points at per-token data rather than one expert's weights. Only one fire was captured with this flag, because it lowers the fire rate (about 0.14 % of requests here against 0.43 % without it), probably through the per-layer syncs.
Method
The script at the end replays agent-like turns: each request resumes the previous conversation from the cache, appends N new tokens of text, and generates 160 tokens. Conversations start at about 12 k tokens and are restarted at 60 k, and after a fire with a different first message (no shared prefix).
Read size vs fires (all runs except
--short-read 260, pooled)All 28 fires had 198–258 tokens read. That is 28 in 1,636 window requests (1.7 %) and 0 in 4,419 outside it.
One change at a time (default config; band 151–400 tokens read unless noted)
--no-prefill-borrow--adapt-every 100000STRATA_PF_STEP_SYNC=1STRATA_HIP_WMMA(band 195–260)--short-read 260(band 195–260)None of the other changes removes the fire. The prompt-cache-slot borrowing, cache adaptation, a per-step sync and the WMMA prompt attention all still fire. Pooling the other runs gives 27 fires in 1,471 window requests (1.8 %), so about 5.7 were expected with
--short-read 260. Seeing 0 has a probability of roughly 0.3 % by chance. The median request time was 4.4 s with--short-read 260against 4.6 s at baseline.One case is not covered: a read longer than
--prefillwhose last chunk lands in the window.GPU hangs on the same path
Twice, once with
STRATA_DBG_NAN=1and once withSTRATA_PF_STEP_SYNC=1, a short read never finished:In both cases the server restarted the engine and it ran normally afterwards. Neither hang happened in the runs without extra syncs, which had 0 hangs and 25 fires. So the same defect may show up either as non-finite rows or as a hang, depending on timing.
Reproducer (any long plain-text file as the corpus, e.g. docs/DETAILS.md)
python3 stress_short_reads.py http://127.0.0.1:8080 docs/DETAILS.md --minutes 60(defaults: reads of 195–260 tokens, 160 generated). At our rate, expect about one fire per 50–70 requests in the window, without--short-read 260.@MKheru commented on GitHub (Oct 10, 2026):
XMP update (re @VeenLee's report): on our R9700 box XMP is off. The board can't run the profile at all (enabling it makes the BIOS fail to boot), so the RAM runs at its default JEDEC settings. All the all-
!fires reported above happened with XMP off, so on our side this is not a RAM overclock issue: the trigger is still the batched prompt chunk of ~193–256 tokens, and--short-read 260still avoids it.@Niko1221 commented on GitHub (Oct 11, 2026):
Thank you for the stress script and the read-length analysis; we used both.
What we tried on an R9700 (gfx1201): your stress_short_reads.py, 1,870 requests over four configurations (IQ3_S and an IQ3_XXS pack with the same expert types as yours, --short-read 150, --prompt-cache-root 256, the 0.1.40 and 0.1.42 engines), about 830 of them reading 192-258 new tokens. No fire. A separate test of the prompt MMQ kernels at 8-420 rows per expert (276 cases, IQ2_XXS / IQ4_NL) gave finite outputs matching a CPU reference every time.
0.1.43 adds lask3802's NaN guard (#1892, on by default): a window whose logits are all NaN emits nothing, the caches are dropped and the prompt is read again from token 0, and the server retries once, so the '!' answers should not reach you even if the cause is still there. The engine logs
non-finite logits (#879)when it fires.To find the cause, could you check on 0.1.43:
STRATA_PREFILL_CPU_SHARE=0, with--pcie-frac 0, and at the card's default power limit?expert cache N slotsline, and STRATA_DBG_NAN output from more than one fire: is the bad row range always one group?@MKheru commented on GitHub (Oct 12, 2026):
It follows ROCm 7.2.1's runtime libraries: same 0.1.43 source on ROCm 10.0.0, 0 fires in 1,911 requests; cross builds point at the libraries, not the compiler
Thank you for running the stress script. Here is everything from one night and one day of runs on our box (about
18 hours), on your three points and on what came after them.
In short. On our R9700, nothing in Strata's settings removes the fire, and the debug prints show bad rows written
by several different kernels. The same 0.1.43 source, rebuilt and run on ROCm 10.0.0, gives 0 fires in 1,911
requests. At the 7.2.1 rate we would have expected about 12. A cross build settles where the fault is. The engine
built with 7.2.1 but run on 10.0.0's libraries gives 0 fires in 1,183 requests. The engine built with 10.0.0 but run on
7.2.1's libraries fires again within two minutes: 9 fires in 941 requests, the 7.2.1 rate. So the fault sits in ROCm 7.2.1's runtime or
libraries, not in the code the compiler makes and, as far as one card can tell, not in Strata.
Setup.
v0.1.40.2andv0.1.43tags with no local change,except the debug prints described below, which only run under
STRATA_DBG_NAN.--resident-experts --pool-workers 4 --kv int8 --max-context 262144 --kv-resident 262144 --prefill 16384 --short-read 150 --prompt-cache-root 256 --spec 4 --spec-min-p 0.5, plusSTRATA_HIP_WMMA=1.stress_short_reads.pyfrom my previous comment. It sends reads of 195–260 new tokens on a resumed12k–60k conversation, with 160 tokens out; about 40 % of the requests land in the 192–258 window.
non-finite logits (#879)lines (0.1.43) orlogits non-finitelines(0.1.40.2).
1. Without the helper patch: yes, on both engines
STRATA_DBG_NAN=1)0.1.43's guard caught every fire of the night (21): no
!reached the client. WithoutSTRATA_DBG_NAN, each caughtrequest was answered normally in 15–23 s, re-read of 15k–28k tokens included. With it, the retry took 106–440 s,
because the debug checks slow the re-read to ~125 tok/s.
2. One setting at a time, on 0.1.43: none of them removes it
STRATA_PREFILL_CPU_SHARE=0(already off on HIP, so this repeats the default)--pcie-frac 0--kv fp16instead of int8STRATA_DBG_NAN(stock 0.1.43)Durations include the engine start (1–5 min).
The fire rate varies between runs (0.17–1.2 % of requests), so with these counts I can't say one engine fires more
than the other.
3. The expert cache line, and where the bad rows are
(12088 slots, 19.63 GiB with
--kv fp16.)Only full-attention layers. Every report came from layers 3, 7, 19, 23, 27, 31, 35, 39, 43 or 47. This model's
full-attention (QSA) layers are exactly 3, 7, 11, …, 47 (read from the GGUF tensors:
attn_k, nossm_*). None of the36 GDN layers was ever reported.
Whole tokens. In 76 of 77
STRATA_DBG_NANlayer reports, every expert row of a bad token is bad: the non-finite rowsof GU, H and Dm are exactly 10 × the bad tokens of
bo.Already bad at the MoE's input, never in the first 64 rows of the chunk. I added one print (diff at the end) that
lists the non-finite tokens of
boand ofm.mixed. In 10 of 11 night fires, the same tokens are already non-finite inm.mixed. The 11th has a finite input, and the bad values first appear at the combine, for tokens in the same range.The finite values are small (largest |x| 3.3–10.5), so it is not an overflow. To your question: no, the bad rows are
not one group. They come in one to twelve runs with holes, from row 64 to the end of the chunk, and never below
row 64.
The 11 night lines, verbatim
4. Inside the attention half: three different kernels write the bad rows
Next I took the attention half of the QSA layers apart, still on stock 0.1.43 with debug prints only, under the same
load. There were four prints, all under
STRATA_DBG_NANand only for chunks of 1024 tokens or fewer:m.mixed, K, V, Qf, q, the indexer'stwo projections, the selected cells checked against
[0, p0 + t],m.attn,m.attn_h,m.bo,m.inj).R, its row scales,xn16,lo,gated,mixed).norm/rope + KV append, Q split/norm/rope, indexer append, selection, attention, gate, out proj), the first step after
which each buffer holds a non-finite row.
0xFFbytes before the half, then the rows still holding that patternreported. It never fired: every bad row was written, with wrong values.
These three debug runs lasted 14, 56 and 31 min (614 requests). The three fires that went through these prints,
verbatim:
[69,80-95], then[208-223]right after the V GEMM);[84-191], with clean q, K, V and selection);m.attnandQfare finite).input, K comes out right and V wrong, so this is not a shape the GEMM gets wrong.
downstream was non-finite, the guard did not fire and the reply went out normally, with 16 wrong K/V cells in the
cache.
None of this looks like one kernel's bug. It looks like something that sometimes corrupts the rows a kernel writes in
this window, below Strata. So the next step was to change the layers under it, one at a time.
5. One change at a time below Strata
All runs use stock 0.1.43 without the debug prints, under the same load.
STRATA_DBG_NAN)GPU_MAX_HW_QUEUES=1STRATA_DENSE_MMQ=1(dense projections through MMQ, no hipBLAS/hipBLASLt)* Stopped by hand once they had fired 4–5 times. Stopping on fires inflates their rates; it does not change the
fact that they fire. The ROCm 10.0.0 and cross runs ran their full planned length, whatever they showed.
ROCm 10.0.0 should have shown ~12 fires; getting 0 by chance has a probability of about 4 × 10⁻⁶. The 7.2.1-built
engine on 10.0.0's libraries should have shown ~8 (probability of 0 by chance ≈ 5 × 10⁻⁴).
--short-read 150(checked in the generated config of eachrun) and the same load.
(
libamdhip64.so.7,libhsa-runtime64.so.1,libhipblas.so.3,libhipblaslt.so.1,librocblas.so.5,libamd_comgr.so.3) resolve from the image the binary runs in (checked withldd).STRATA_DENSE_MMQ=1row suggests it is not the dense GEMMs.rocm/dev-ubuntu-24.04:10.0.0-fulldoes not put/opt/rocm/libonthe loader path. Our first start failed with
libhipblaslt.so.1: cannot open shared object file; anld.so.conf.dentry plus
LD_LIBRARY_PATH=/opt/rocm/libfixed it.STRATA_PF_GEMM=1would have been the obvious A/B for the GEMM, butstrata_pf_gemm_f16returns false below gfx11's WMMA check on gfx12 (wmma_gemm.cu:688), so it is a no-op here.STRATA_PROMPT_ATTN_OLDandSTRATA_SELECT_OLDare already the HIP defaults.Speed on 10.0.0 (
mesure.py, one pass each, our daily settings with--short-read 260):The writing difference is within the noise of a single pass.
6. The card hangs: a separate issue, not settled
MES(0) failed to respond to msg=REMOVE_QUEUE, then a MODE1reset). That issue is open, and its author reproduces it on ROCm 6.4.4, 7.x and 10.0.0. Firmware there is MES 0x8b;
here it is MES 0x93, on kernel 7.2.
reading the prompt: … 10 s … 20 s … 30 s so far), and the queue-removal failure comes 2.5 to 33 s after the read started. The driver message is the end of thestory, not its start. Once, the engine's own watchdog named the step:
waiting for the GPU (attention, router) at layer 15.10.0.0-built engine; the read stalled
waiting for the GPU (attention, router) at layer 7).none), so this hints that the hang follows the libraries too, but it does not show it.
STRATA_HIP_ADAPT_KERNEL_COPY=1is worth a try for that, since our setup has MMQ, adaptiveswaps and SDMA together. I have not run it yet.
7. What I take from it
It may be worth a line in the README for HIP users.
--short-read 260kept the window path out of use entirely (0 fires in 770 requests in my earlier run, at no measuredcost).
wrong cells in the cache without tripping it.
was newer than 7.2.1, that would fit.
The night's debug print (0.1.43,
src/prefill/prefill.cpp, only under STRATA_DBG_NAN)The morning's prints (attention half, MoE input, step by step, fill pattern) are larger. I can post them as a gist if
they are useful.
@cjdell commented on GitHub (Oct 13, 2026):
Another update with an admittedly LLM generated response (this is way out of my depth):
0.1.43 on a single R9700 (ROCm 7.2.3, Linux): the guard now recovers,
but it still fires ~4×/day; per-stage audit gives raw bits for every fire
Niko1221 — answering your three points from 2026-10-11, on 0.1.43 with no local
patch of any kind (no CUDA-helper patch, nothing beyond the two int8-KV clamps we
have carried since 0.1.41 — see note at the end):
only, no second GPU involved. ROCm/legacy-rocm-build#1892's guard recovers as designed (drops the
caches, re-reads from token 0, retries once) and never emits
!, but thepoison is still produced: 4 fires on 0.1.43 between 2026-10-12 18:19 and
2026-10-13 12:21 BST (positions 102,465 / 145,770 / 163,011 / 131,417).
STRATA_PREFILL_CPU_SHARE=0/--pcie-frac 0/ power-limitA/Bs. Our current defaults:
--pcie-fracis unset (so the new measured-PCIedefault is on),
STRATA_PREFILL_CPU_SHAREunset, no power-limit override.We can run those next if you want them before anything else.
expert cache 10679 slots(24.08 GiB VRAM; 31.35 GiB page-locked in RAM).Our per-stage dump prints on every fire, not just the first — four fires
below. The bits are always
0x7fc00000(canonical positive quiet NaN),never the CUDA reporter's
0x7FFFFFFF.Environment
gfx1201, single card, no helper GPUclr7.2.3,hipblaslt7.2.3,hipblas7.2.3,rocm-runtime7.2.3,rocm-comgr22.0.0-rocm7695859a), HIP/gfx1201,/nix/store/1s8ca3glsa0arp6hk39xnqv6sc7rkcgp-strata-0.1.43/bin/strata10679GPU slots, 24.08 GiB VRAM; 31.35 GiB page-locked RAM; pre-filled from the profile0x00685000)Command:
Env:
HIP_VISIBLE_DEVICES=0,HSA_USERPTR_FOR_PAGED_MEM=0,STRATA_KERNEL_AUDIT=1.The four fires (0.1.43)
Every one is a prompt read (
before the first token), CPU/miss path clean,first poison in the GPU expert-cache HIT rows of a GDN layer, and every
non-finite value is
0x7fc00000:Fire 1 (
#879, 2026-10-13 01:36 BST, position 102,465):Fire 2 (2026-10-13 02:23, position 145,770): cache-hit rows layer 20 (input 21);
HIT row 3 (slot 3) col 768; stage gu layer 47 flat 320; planned layer 20 row 14
(token 1, slot 4) col 1120 expert 4; miss 0/102400, max|x| 0.2536.
Fire 3 (2026-10-13 02:30, position 163,011): cache-hit rows layer 4 (input 5);
HIT row 5 (slot 5) col 1472; stage gu layer 47 flat 1056; planned layer 4 row 0
(token 0, slot 0) col 2048 expert 0; miss 0/102400, max|x| 0.3728.
Fire 4 (2026-10-13 12:21, position 131,417): cache-hit rows layer 16 (input 17);
HIT row 3 (slot 3) col 2080; stage gu layer 47 flat 384; planned layer 16 row 4
(token 0, slot 4) col 1568 expert 4; miss 0/102400, max|x| 0.3287.
Two things we'd like you to read off this
0x7fc00000, never0x7FFFFFFF. On HIP thefirst non-finite is an ordinary NaN from real arithmetic in all four fires,
not the all-
0xFFINT32_MAX-shaped write the CUDA reporter sees. Ourrouted total (hits+misses)probe reads-1(never poisoned); the CPU misspublish is clean every time (0 of 102,400). It is always the GPU cache-hit
expert row write that first goes bad.
trace names layer 4 / 16 / 20. Layer 47 is fixed across all four fires, the
layer trace is not. Is that what you expect (the last layer's probe runs first
/ the record is last-wins), or is it a bug in the dump ordering? If it is real,
layer 47's
guoutput looks like a constant first-touch point.ROCm version note
MKheru's 2026-10-12 cross-build (0.1.43 on ROCm 10.0.0 = 0 fires; 7.2.1 libs =
fires) points squarely at the 7.2.x runtime. We are on 7.2.3 and fire the
same way, which is a third data point for "7.2.x libraries, not the compiler".
If you want a ROCm-10 run on this exact box to confirm, say so and we'll build it.
(We carry two local clamps, both still unclamped upstream:
kv_q8.cuandsrc/prefill/kernels.cukv_append_kernelwriteamax / 127to fp16 without aclamp. They are on the int8-KV path and are not what closes ROCm/legacy-rocm-build#879 — flag if you
want them A/B'd off.)
@MKheru commented on GitHub (Oct 13, 2026):
@cjdell thanks for the 7.2.3 data, it lines up with what we see. Two things since our last comment, and one suggestion.
0.1.43.1 does not change it on 7.2.x. We built 0.1.43.1 (with ROCm/legacy-rocm-build#1996's pinned-ring prompt copies) and ran it on
ROCm 7.2.1's libraries: 1 fire in 574 requests (about 3.7 expected at the 0.1.43 rate), plus two card hangs in 62
minutes. So ROCm/legacy-rocm-build#1996 does not remove it. Our daily server stays on 0.1.43 built and run on ROCm 10.0.0, and the watcher
that reads its engine log has recorded no fire since we switched on Oct 12.
Your fires are not the same trigger as ours. Ours came from short batched prompt reads (about 193 to 256 new
tokens, IQ3_XXS). Yours come from long prompts (100K to 163K tokens, UD-IQ4_XS). Same card, same 7.2.x line, but a
different path into it. So yes, a ROCm 10 run on your box would be worth a lot: it would test whether the long-prompt
fires go away too, which our box cannot show.
How we ran ROCm 10 (a container, so it does not touch the host):
We built 0.1.43 for gfx1201 inside that image and ran it in the same image, with
/dev/kfdand/dev/dripassedthrough. Inside,
rocm_version.hsays 10.0.0, the HIP runtime is 7.15.26333 and hipBLASLt is 1.4. ROCm 10.1.0 isout now as well; we have only tested 10.0.0.
If you want to split it the way we did: run your 7.2.3-built engine against the ROCm 10 libraries, and the
ROCm 10-built engine against 7.2.3's. On our box the fires followed the libraries both ways.
@Niko1221 commented on GitHub (Oct 13, 2026):
Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.
If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
@shiftonetothree commented on GitHub (Oct 19, 2026):
Reproduction, with the captured request body (the prompt and its 48 tool schemas), the launch parameters and a replay script: https://github.com/shiftonetothree/strata-879-repro -
python replay.py request/request.json --port 8080sends that body unchanged and gets the same 503.Reproduced on a 3080 and narrowed to one path. The prompt is 18442 tokens (48 tool schemas from an agent harness). With the default MMQ prompt path the engine returns
non-finite logits (#879)at the last 5-token window every time; withSTRATA_PREFILL_MMQ=0the same request answers normally. The NaN is born in layer 1's MoE gate/up, MMQ path, three prefill chunks in a row.Environment
Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S, args:--max-context 524288 --rope-scaling yarn --rope-scale 2 --kv int8 --kv-resident 32768 --spec 4 --spec-min-p 0.5 --mtp ... --prefill auto --expert-cache autostream: true, 48 tools, 4 messages,max_completion_tokens: 32768,stream_options.include_usageReproduce
Send the captured body (18442 tokens, 48 tools) to
POST /v1/chat/completions.Expected: an answer. Actual, every time:
The server retries once, the retry fires at the same position, and the client gets the 503
the model's output became non-finite (NaN) twice in a row (#879).With
STRATA_PREFILL_MMQ=0and nothing else changed, the same body answers:So the two runs read the same prompt, at 1273.8 vs 852.5 tok/s, and only the first one ends non-finite.
Where it dies (
STRATA_DBG_NAN=1, used only to locate the failure, not to measure speed - it changes timing):All three chunks (8192 + 7411 + 2834 = 18437), the whole gate/up output and the whole down output of layer 1, at
mmq 1. PLE and the GDN state are finite there.What I ruled out (measured, not read)
token_embd.weight(IQ4_XS, 248320 x 2560): 0 non-finite block scales, per-row max |v| median 0.0368, p99 0.0787, p99.9 0.1211, max 0.2381. Row 96202 is normal (0.0308).传= ids 220, 96202) read straight out ofper_layer_token_embd.weight: max |v| 0.019 to 0.033, block scales ~1e-4, like their neighbours.--kv int8is in both runs above, so its quantizer is not the site.0 reused, and the guard drops the session before the retry.The trigger is content, not length
Bisecting the captured body with MMQ on: dropping all 48 tools still fails; keeping only the system message and
你好still fails. The smallest reducer I found is a system text that ends in传preceded by a space token (ids 220, 96202). As the whole system message,"x 传"," 传"and"abcdefgh 传"reproduce it;"传","传传","a传","\n传"and" 转"do not. Caveat: that reducer only fires against a warm engine (a cached prefix); from a cold engine the same 58-token prompt passes. So the token path is not fully understood yet - the reliable reproducer remains the full 18442-token body.Candidate sites (static reading, unverified: I cannot build here - nvcc 13.4 is present, cmake and MSVC are not)
quantize_mmq_q8_1in the vendoredggml-cuda/quantize.cu, DS4 layout: it writesd = amax/127and the 32-valuesumthroughmake_half2, i.e. into fp16.dis inf aboveamax8.32e6, and a sum of 32 same-sign values overflows 65504 earlier than that. Both are a clamp away from being finite. Which of the two actually overflows needs one measurement of the activation magnitude at the failing layer.mmq_plan()insrc/prefill/prefill.cpp, the 2466 CUDA0 slots the prompt borrows).STRATA_MMQ_DIRECT=1,STRATA_MMQ_GROUP_SORT=0/1and--prefill 2048are the three switches that separate this from (1) without a build.src/prefill/kernels.cu(hf(amax / 127)) has the same unclamped fp16 scale. Not this failure (see above), but the same class.Workaround in use
set STRATA_PREFILL_MMQ=0before starting the server. Cost measured here on the same 18442-token prompt: 852.5 vs 1273.8 tok/s of prompt read (21633 vs 14475 ms), i.e. about 30% slower prefill; short prompts are unaffected. Answers from the FP16 prompt path are not bit-identical to the MMQ path, which is expected.Reproduction status
Reproduced locally: 4 failing requests across 3 engine starts of the same build, and 2 passes with MMQ off on the same body. The two candidate sites are unconfirmed static analysis; I have not built the engine.
@shiftonetothree commented on GitHub (Oct 20, 2026):
Same hardware with Ubuntu 26.04 work very well.