mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #385] [CLOSED] Prompt path: a stager buffer's first job of a generation waits for the previous DMA from it (a narrow race with unpinned blobs) #2612
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#2612
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/Niko1221/Strata/pull/385
Author: @sergqwer
Created: 10/1/2026
Status: ❌ Closed
Base:
main← Head:pr/stager-dma📝 Commits (1)
c55854cPrompt path: a stager buffer's first job of a generation waits for the previous DMA from it📊 Changes
1 file changed (+5 additions, -3 deletions)
View changed files
📝
src/prefill/prefill.cpp(+5 -3)📄 Description
Stager::workwaits for a buffer's DMA only from a generation'skRing-th job on (j >= kRing). A generation's firstkRingjobsmemcpyinto their pinned buffers straight away.So the previous generation's last DMAs from those buffers are only known to be done where something else waits for them:
stream_all_min): the routing sync (cudaStreamSynchronize(m.cs)) before the layer'sstart();stream_allchunks: the sync at the end of a chunk, which runs only with an MTP drafter (on_chunk) or a layer split (on_stage_chunk).That leaves a window in two cases:
stream_allchunk that ends without that sync (no--mtp);In that window, the next chunk's first jobs can overwrite a pinned buffer that a
cudaMemcpyAsyncon the copy stream is still reading. It only matters with unpinned blobs, which go through the stager: the RAM-budget tier, or a partially pinned arena.The fix: the event is now waited for on every job. An event that was never recorded, or has already completed, returns at once. For
j < kRing, no job of the current generation can have recorded the event, so the wait is exactly the previous generation's last DMA from that buffer.We found it in an audit of our fork. We have not seen it corrupt a run: it needs that timing and the unpinned path.
Measured:
--mmap-experts --resident-budget-gib 16: 12,144 of the 48,668 streamed experts went through the stager.🤖 Generated with Claude Code
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.