Stage buffers: fence a pinned buffer's queued copy before the buffer is recycled (#1237)
A page-locked stage buffer is the source of the cache fill's cudaMemcpyAsync, which the DMA reads after the call has returned; a pageable one is staged by the driver before it returns. The pool recycles a buffer after kStageAge layers or 256 assemblies, so a 4096-token prompt read (up to ~500 distinct experts per layer) could overwrite a buffer whose copy had not run yet: the corrupted IQ3_S decode of #1237. note_async_read(blob, stream) records an event per pinned buffer after each queued copy (hit-path fill, peer fill, remote-expert swap); claim_stage waits for it before it hands the buffer out again. Pageable buffers and every other source are unchanged. STRATA_STAGE_PIN stays opt-in.
This commit is contained in:
1 parent
fb58e0dbc8
commit
f71c5307c6
4 files changed
+71
-2
No files matched your search
@@ -170,6 +170,7 @@ bool PeerExperts::open(int device, const std::vector<std::pair<int32_t, int32_t>
|
||||
close();
|
||||
return false;
|
||||
}
|
||||
src.note_async_read(b, refill_); // #1237
|
||||
res_[(size_t) (pr.first * n_expert + pr.second)] = slot;
|
||||
}
|
||||
if (!ck(cudaStreamSynchronize(refill_), "fill", err)) { close(); return false; }
|
||||
|
||||
Reference in new issue
Block a user