Session files: join the background copies in the SAVE/RESTORE handler, not in conversation_file.cpp

0d512925 (STRATA_CKPT_ASYNC) and 3e0c141c (STRATA_PARK_ASYNC) made conversation_file.cpp include
conversation_snapshot.hpp and call the joins, so conversation_file_test and session_save_reclaim_test (built
from conversation_file.cpp without CUDA) stopped compiling with STRATA_BUILD_CONVERSATION_TESTS=ON.

The joins move to the start of the SAVE/RESTORE handler in generate.cpp. That is also earlier: the save copies the
checkpoints (session_save_checkpoints) and may reclaim some before put_checkpoint ran, and the join there only
matched the copied vector, not the one the copy in flight writes. conversation_file.cpp is upstream's again.

Reported by bitaccesscomau in #3779.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
linxuhaoandClaude Opus 5.5 committed 2026-10-26 16:47:05 +00:00
1 parent 6d6f0f39fd
commit 33a8146a86
2 files changed
+4 -3

No files matched your search

-3
View File
@@ -1,5 +1,4 @@
#include "strata/core/conversation_file.hpp"
#include "strata/core/conversation_snapshot.hpp"
#include <algorithm>
#include <bit>
@@ -680,7 +679,6 @@ void put_kv_header(Out& o, int format, int64_t cells, int64_t heads, int64_t hea
}
void put_checkpoint(Out& o, const ConversationCheckpoint& c) {
conversation_checkpoint_join(c.gdn.data());
o.vec(c.ids);
o.u64(c.imgs.size());
for (const auto& k : c.imgs) { o.i64(k.start); o.u64(k.hash); }
@@ -689,7 +687,6 @@ void put_checkpoint(Out& o, const ConversationCheckpoint& c) {
}
void put_payload(Out& o, const SavedConversation& s, const std::vector<SessionKvSource>* sources = nullptr) {
conversation_park_join();
for (int64_t g : s.geometry) o.i64(g);
o.i64(s.layer_lo); o.i64(s.layer_hi); o.u64(s.cvec ? 1 : 0);
put_checkpoint(o, s.live);
+4
View File
@@ -12018,6 +12018,10 @@ int main(int argc, char** argv) {
std::fflush(stdout);
};
strata::core::progress_at(save ? "saving a session" : "restoring a session");
// the background copies of the last turn checkpoint and park (STRATA_CKPT_ASYNC, STRATA_PARK_ASYNC) land
// before anything below copies, frees or writes the checkpoints and parked images
strata::core::conversation_checkpoint_join(nullptr);
strata::core::conversation_park_join();
if (path.empty()) { refuse("missing path"); continue; }
if (!stages.empty() || multi_gpu) { refuse("session files do not support --layer-split"); continue; }
if (o.peer_device >= 1) { refuse("session files do not support --peer-device"); continue; }