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:
sergiywith authored and Niko1221 committed 2026-10-01 08:33:05 +02:00
1 parent 272c16c767
commit a1e4fb4c80
3 files changed
+20 -2

No files matched your search

+5
View File
@@ -2054,6 +2054,7 @@ int main(int argc, char** argv) {
}
}
}
strata::core::Verifier::set_commit_async(!multi_gpu); // see Verifier::set_commit_async
// ---- layer split across GPUs: each later stage's own copy of the dense weights, its session and (the last) the
// head, made on its device before the host arena is mapped (as the drafter below, for the same WDDM reason)
std::vector<std::unique_ptr<GpuStage>> stages;
@@ -4607,6 +4608,9 @@ int main(int argc, char** argv) {
return imgs_below(req_imgs, L) == pre_imgs;
};
const bool want_cvec = strata::kernels::cvec().loaded() ? req_cvec != 0 : true;
// the last request's final commit may still be running on the verifier's stream (set_commit_async):
// everything below reads, restores or zeroes the session from other streams and the host
cudaDeviceSynchronize();
int64_t resume = 0;
bool from_live = false;
if (o.prompt_cache > 0 && want_cvec == cvec_cached) {
@@ -6016,6 +6020,7 @@ int main(int argc, char** argv) {
for (int64_t t : produced) std::printf(" %lld", (long long) t);
std::printf("\n");
const double decode_ms = decoded > 0 ? total_ms / (double) decoded : 0.0;
cudaDeviceSynchronize(); // the last commit (set_commit_async) before anything reads the session
std::printf("%-24s %lld tokens in %.1f ms -> %.2f tok/s\n", "decode", (long long) decoded, total_ms,
decode_ms > 0.0 ? 1000.0 / decode_ms : 0.0);
if (n_prompt > 1)