mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #646] [CLOSED] DeepSeek ds4 recent slots: a failed fill must not publish its slot (+ DS4_FAULT_RC_FILL test lever) #647
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#647
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?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/646
Author: @handmade0octopus
Created: 10/29/2026
Status: ❌ Closed
Base:
main← Head:pr/rc-fill-error📝 Commits (2)
9308175ds4 recent slots: DS4_FAULT_RC_FILL=N test lever (every Nth fill fails at issue)fa4b5d7ds4 recent slots: a failed fill must not publish its slot📊 Changes
1 file changed (+38 additions, -2 deletions)
View changed files
📝
src/ds4/ds4_model.cu(+38 -2)📄 Description
DeepSeek ds4 recent slots: a failed fill must not publish its slot (silent stale-weight inference)
Follow-up to the cache-management bug report shared by a delta-inference-engine dev (a failed
promotion still published the expert→slot mapping, silently corrupting inference). Auditing the same
class here found the discipline already present in the streamed-expert landing path (
lane_copysets
pull->bad[i]on a failed read, and the mapper publishes a landing only whenP->done == seq && P->bad[q] == 0) — but absent in the recent-slot fills path, which had the bugthe report describes, verbatim.
The bug (
rc_loop, fills)stream_expertcarefully checks everycudaMemcpyAsyncenqueue and returnsfalse+ fillserronfailure — the fills path threw that away. A failed enqueue still recorded the event, still stored
rc_done, and the tick published the mapping and the device table entry (vram_tab[e]→ theslot's address) over stale or partial bytes. The
errtext was written and then discarded. Nothingwas logged.
On this engine the fill source is the pinned RAM tier (not storage), so the realistic triggers are a
failed H2D enqueue or a lost device rather than a failed file read — but the failure class, the
silent publish, and the corruption are exactly the ones reported.
The fix
Mirrors the landing path's own discipline and the report's fix semantics:
stream_expert()'s return; on failure the job never reachesfly, sonothing stores
rc_done, and the tick'src_done != rc_gencheck never publishes the slot norits
vram_tabentry — the previous mapping (if any) stays intact;rc_pendingis decremented at once, sorc_drain's bounded wait cannot count the dead job;(
ds4: recent-slot fill failed, slot left unmapped: ...) instead of being discarded;(
rc_fillkeeps holding it out of the free list — bounded by the small per-layer recent-slot pool).Proof by injected failure
New test lever, off by default:
DS4_FAULT_RC_FILL=Nmakes every Nth fill fail at issue (as ifits first H2D enqueue failed — nothing copied) while the completion event still records. Commit 1
keeps the pre-fix behavior, commit 2 is the fix; same lever, same stimulus, both builds:
rc_drainstallsslot left unmappedDS4_STREAM_ZC_ALL)slot left unmappedIdentical stimulus, opposite publish behavior,
rc_drainhealthy everywhere.Two honest observations from the end-to-end runs (4 fixed greedy prompts, temperature 0, pinned lane
calibration):
pre-fix arm produced fluent, on-topic answers — every arm did. Nothing in the output text flags the
corruption; only the bytes are wrong. That matches "silently corrupt inference results" and is
exactly why this class needs the publish gate rather than an output-level check.
DS4_STREAM_ZC_ALLfull coverage thedecode arm streams every pick in place from the pinned RAM tier, so the
vram_tabentries thecorrupt publishes wrote were not consulted for compute. In the default (non-ZC) configuration the
table is the compute source (kernel-side
tab[e]), which is where the stale bytes feed inference.This is a good example of the bug hiding behind a fast-path configuration.
A note on methodology for anyone repeating this: ds4 greedy answers are not byte-stable across
boots when expert transport changes (landing/fill timing, CPU-lane vs VRAM rounding). Answer-level
A/Bs on this engine need a pinned
DS4_LANE_CALand drift-envelope comparisons; the decisiveevidence for a publish-gate change is the mechanism log above.
Performance
The change is once-per-fill bookkeeping: one bool, one compare, and an atomic sub on the failure
path only; the success path adds a single not-taken branch.
--dspark on): pre-fix 1,014 t/sprefill / 42.3 t/s decode aggregate — post-fix cell not directly comparable on the same machine
(a second engine cannot fit beside the production one in 128 GB; aborts on the RAM floor).
fresh boots): prefill 322.1 → 319.6 t/s (−0.8 %), decode aggregate 39.69 → 38.57 t/s (−2.8 %,
within this box's established single-cell noise of ±5 %). Both cells were also partly hit by the
unrelated early-
finish=lengthbug (#638), which truncates conversations and invalidates wall-timecomparison; prefill completes before decode and is unaffected.
Consistent with a success path that gains one branch.
Notes for review
fills.
prints a
FAULTline per injection, so it can serve CI-style failure tests (the same way thereporter's team verified their fix).
tick-owned
rc_fillfrom the copy thread); failures are pathological, and the bound is the smallper-layer recent-slot pool.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.