Verify: the commit graph no longer waits; it overlaps the MTP draft
The commit's cudaStreamSynchronize held the host ~0.45 ms a round. The next window follows it on the same stream and the drafter (its own stream) reads only this window's final rows and its own K/V, so a single-GPU session (Verifier::set_commit_async) returns at once. Whatever touches the session from another stream or the host afterwards synchronizes the device: the start of each --serve request (checkpoint restore, zeroing, the prompt path) and the end of a generate run; checkpoint saves already did. A layer split keeps the wait, as does STRATA_COMMIT_SYNC=1. IQ2_XS, 400-token answers, 3 runs each: 128.6 -> 135.8 tok/s decode (+5.6%), the same tokens. NVFP4 pack +0.8%.
This commit is contained in:
1 parent
272c16c767
commit
a1e4fb4c80
3 files changed
+20
-2
No files matched your search
+10
-2
@@ -1292,6 +1292,9 @@ bool Verifier::window_logprobs(const int32_t* targets, int T, int64_t pos0, int3
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace { bool g_commit_async = false; }
|
||||
void Verifier::set_commit_async(bool on) { g_commit_async = on && std::getenv("STRATA_COMMIT_SYNC") == nullptr; }
|
||||
|
||||
bool Verifier::commit(int n_keep, std::string& err) {
|
||||
const OnDevice on_device(device_);
|
||||
if (n_keep < 1 || n_keep > last_t_) { err = "verify: commit count out of range"; return false; }
|
||||
@@ -1302,8 +1305,13 @@ bool Verifier::commit(int n_keep, std::string& err) {
|
||||
std::atomic_thread_fence(std::memory_order_seq_cst);
|
||||
const cudaError_t le = cudaGraphLaunch(commit_exec_, cs_);
|
||||
if (le != cudaSuccess) { err = std::string("verify: commit launch: ") + cudaGetErrorString(le); return false; }
|
||||
const cudaError_t se = cudaStreamSynchronize(cs_);
|
||||
if (se != cudaSuccess) { err = std::string("verify: commit: ") + cudaGetErrorString(se); return false; }
|
||||
// set_commit_async: no wait here - the next window runs on the same stream after it, and the drafter (its own
|
||||
// stream) reads only this window's final rows and its own K/V. h_commit_ is next written after the next window's
|
||||
// results are read, i.e. after this graph has run.
|
||||
if (!g_commit_async) {
|
||||
const cudaError_t se = cudaStreamSynchronize(cs_);
|
||||
if (se != cudaSuccess) { err = std::string("verify: commit: ") + cudaGetErrorString(se); return false; }
|
||||
}
|
||||
if (ple_stage()) // stages that share one session must advance it once
|
||||
for (int t = 0; t < n_keep; ++t) {
|
||||
ss_->ple_prev[0] = ss_->ple_prev[1];
|
||||
|
||||
Reference in new issue
Block a user