From c81f99849e4cb4ea12752f976ec5738000af3a49 Mon Sep 17 00:00:00 2001 From: CC-David-CC Date: Fri, 9 Oct 2026 03:31:56 -0400 Subject: [PATCH] fix: defer pipelined one-token commits to the host verdict --- src/core/verify.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/verify.cpp b/src/core/verify.cpp index f96094a3..b148b68f 100644 --- a/src/core/verify.cpp +++ b/src/core/verify.cpp @@ -739,7 +739,8 @@ bool Verifier::record_window(int T, cudaStream_t cs, std::string& err) { const bool ple_on = ss.ple.ready() && ple_stage(); auto Rt = [&](int t) { return R_ + (size_t) t * HC * N; }; const int G = (split_ && T >= 2 && !batch_rec_) ? 2 : 1; // a batch window is one group - const bool self_commit = T == 1 && !batch_rec_ && !g_qfuse() && one_token_self_commit(); // see Verifier::commit + // Pipelined windows must wait for the host verdict/snapshot fence before mutating state. + const bool self_commit = T == 1 && !always_publish_ && !batch_rec_ && !g_qfuse() && one_token_self_commit(); // see Verifier::commit static const bool dec_batch = [] { const char* v = std::getenv("STRATA_DEC_BATCH"); return v == nullptr || std::atoi(v) != 0; }(); auto stamp = [&](int64_t l, int i, int grp) { if (prof_on_ && grp == 0) gpu_stamp(prof_, (int) (l * kProfPer + i), cs); @@ -2294,7 +2295,7 @@ bool Verifier::commit(int n_keep, std::string& err) { h_commit_[0] = n_keep; h_commit_[1] = n_keep - 1; for (int t = 0; t < max_t_; ++t) h_commit_[2 + t] = t < n_keep ? (int32_t) (last_pos0_ + t) : -1; - if (last_t_ == 1 && one_token_self_commit()) { + if (last_t_ == 1 && !always_publish_ && one_token_self_commit()) { // a one-token window has advanced the state itself (record_window): no commit graph } else { std::atomic_thread_fence(std::memory_order_seq_cst);