[PR #752] [CLOSED] cache: preserve checkpoints when split allocation fails (depends on #559) #2807

Closed
opened 2026-11-04 02:03:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/752
Author: @zengyishou
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: fix/checkpoint-split-exception-safety


📝 Commits (10+)

  • ba707d8 Several conversations at once: batch slots, pipelined layer split, per-stage dense weights
  • c67052c server: a client that stops reading early keeps the engine in step
  • e11166b Conversation parking with --layer-split
  • 220ccbb Tests and docs: parking with a layer split, tools/parking_test.py, a Testing section
  • f67bf51 Parking with a layer split: the draft ring once, every stage's K/V reused, checkpoints moved not copied
  • 537588f Parking with a layer split: the draft ring with the last stage, on its GPU; guards; trim log
  • bd400f7 Layer split comment: KV streaming and images do run across a split
  • f0c61d3 Speculative batch, step 1: rows per slot in batch windows and commits (set_batch_rows; 1 = unchanged)
  • 6840647 Speculative batch, step 2: MtpDrafter::clone_from (a drafter per slot sharing the weights) and copy_kv_from
  • 72774f2 Speculative batch, step 3: --batch-spec N (MTP drafts in batch windows, a drafter per slot)

📊 Changes

24 files changed (+3195 additions, -133 deletions)

View changed files

📝 CMakeLists.txt (+3 -0)
➕ docs/BATCHING.md (+148 -0)
📝 docs/DETAILS.md (+23 -3)
📝 docs/MULTI_GPU.md (+5 -0)
📝 include/strata/core/conversation_cache.hpp (+91 -3)
📝 include/strata/core/conversation_snapshot.hpp (+17 -0)
📝 include/strata/core/mtp.hpp (+15 -0)
📝 include/strata/core/native_dense.hpp (+3 -1)
📝 include/strata/core/verify.hpp (+88 -0)
➕ serve/prometheus.py (+153 -0)
📝 serve/server.py (+295 -9)
➕ serve/test_prometheus.py (+181 -0)
📝 src/core/conversation_cache_test.cpp (+92 -0)
📝 src/core/conversation_snapshot_test.cpp (+41 -0)
➕ src/core/conversation_split_failure_test.cpp (+46 -0)
📝 src/core/conversation_state.cpp (+45 -18)
📝 src/core/mtp.cpp (+75 -10)
📝 src/core/native_dense.cpp (+8 -2)
📝 src/core/verify.cpp (+559 -52)
📝 src/program/generate.cpp (+714 -35)

...and 4 more files

📄 Description

Dependency and review scope

Draft: blocked on #559. Do not merge before #559. This branch is based on #559 head f65301b3bfc621229c7d5ddb1e268f652be43a59. Because GitHub can only target an existing branch in this repository, the current comparison against main also includes #559's unmerged changes. The contribution from this PR is the final single commit only; after #559 lands this branch must be rebased and the diff rechecked before marking ready.

Review the isolated increment here: incremental diff. The same increment is also proposed directly to #559's author in the focused companion PR. These are alternative review routes for the same change, not patches to apply twice.

Summary

Follow-up to Niko1221/Strata#559, prepared on its multi-sequence-batching branch. The checkpoint split currently moves running state before copying identity metadata. If a later allocation throws, the input checkpoints are partially moved and cannot be restored safely.

Reserve output storage and prepare identity copies before moving any state. Catch allocation failure at the parking call site and skip parking while retaining the live checkpoints. Add a deterministic allocation-failure regression and register it with the standalone conversation tests. This does not repeat the branch's existing KV reuse, draft ownership, or all-stage compatibility changes.

Validation

  • Standalone conversation_cache_test: 4,191 checks passed.
  • Allocation injection: seven failure points preserve the input; successful split can merge back without allocation.
  • git diff --check passes.

Tests use synthetic checkpoints and require neither model data nor a GPU. This PR makes no throughput claim.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/752 **Author:** [@zengyishou](https://github.com/zengyishou) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/checkpoint-split-exception-safety` --- ### 📝 Commits (10+) - [`ba707d8`](https://github.com/Niko1221/Strata/commit/ba707d88ff742d0be9c2b2fe51e8f10d6edc071b) Several conversations at once: batch slots, pipelined layer split, per-stage dense weights - [`c67052c`](https://github.com/Niko1221/Strata/commit/c67052c7792e7a4bcdf6501b92e7f35f1f4903f1) server: a client that stops reading early keeps the engine in step - [`e11166b`](https://github.com/Niko1221/Strata/commit/e11166bdab266523e64b09d66789d7fcf5c48747) Conversation parking with --layer-split - [`220ccbb`](https://github.com/Niko1221/Strata/commit/220ccbbe606ee90c2d3878e1d3ccab159f8df208) Tests and docs: parking with a layer split, tools/parking_test.py, a Testing section - [`f67bf51`](https://github.com/Niko1221/Strata/commit/f67bf51a2bec929c3f3bc8fe5f11ae8b84211011) Parking with a layer split: the draft ring once, every stage's K/V reused, checkpoints moved not copied - [`537588f`](https://github.com/Niko1221/Strata/commit/537588f55a03dcf0a2639c2ebd919054d6a77c43) Parking with a layer split: the draft ring with the last stage, on its GPU; guards; trim log - [`bd400f7`](https://github.com/Niko1221/Strata/commit/bd400f772ab0334e28a5786c41ebe8e7051bcbec) Layer split comment: KV streaming and images do run across a split - [`f0c61d3`](https://github.com/Niko1221/Strata/commit/f0c61d3fb21fdbf6087e8ceac16d64e9a3101a56) Speculative batch, step 1: rows per slot in batch windows and commits (set_batch_rows; 1 = unchanged) - [`6840647`](https://github.com/Niko1221/Strata/commit/6840647e0b2b9c7d60f7bb0606a46b97b66afca2) Speculative batch, step 2: MtpDrafter::clone_from (a drafter per slot sharing the weights) and copy_kv_from - [`72774f2`](https://github.com/Niko1221/Strata/commit/72774f2c1afc267e41824381b8b160ab0a7a545c) Speculative batch, step 3: --batch-spec N (MTP drafts in batch windows, a drafter per slot) ### 📊 Changes **24 files changed** (+3195 additions, -133 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+3 -0) ➕ `docs/BATCHING.md` (+148 -0) 📝 `docs/DETAILS.md` (+23 -3) 📝 `docs/MULTI_GPU.md` (+5 -0) 📝 `include/strata/core/conversation_cache.hpp` (+91 -3) 📝 `include/strata/core/conversation_snapshot.hpp` (+17 -0) 📝 `include/strata/core/mtp.hpp` (+15 -0) 📝 `include/strata/core/native_dense.hpp` (+3 -1) 📝 `include/strata/core/verify.hpp` (+88 -0) ➕ `serve/prometheus.py` (+153 -0) 📝 `serve/server.py` (+295 -9) ➕ `serve/test_prometheus.py` (+181 -0) 📝 `src/core/conversation_cache_test.cpp` (+92 -0) 📝 `src/core/conversation_snapshot_test.cpp` (+41 -0) ➕ `src/core/conversation_split_failure_test.cpp` (+46 -0) 📝 `src/core/conversation_state.cpp` (+45 -18) 📝 `src/core/mtp.cpp` (+75 -10) 📝 `src/core/native_dense.cpp` (+8 -2) 📝 `src/core/verify.cpp` (+559 -52) 📝 `src/program/generate.cpp` (+714 -35) _...and 4 more files_ </details> ### 📄 Description ## Dependency and review scope **Draft: blocked on #559. Do not merge before #559.** This branch is based on #559 head `f65301b3bfc621229c7d5ddb1e268f652be43a59`. Because GitHub can only target an existing branch in this repository, the current comparison against `main` also includes #559's unmerged changes. The contribution from this PR is the final single commit only; after #559 lands this branch must be rebased and the diff rechecked before marking ready. Review the isolated increment here: [incremental diff](https://github.com/zengyishou/Strata/compare/f65301b3bfc621229c7d5ddb1e268f652be43a59...fix/checkpoint-split-exception-safety). The same increment is also proposed directly to #559's author in [the focused companion PR](https://github.com/blange48/Strata/pull/1). These are alternative review routes for the same change, not patches to apply twice. ## Summary Follow-up to Niko1221/Strata#559, prepared on its `multi-sequence-batching` branch. The checkpoint split currently moves running state before copying identity metadata. If a later allocation throws, the input checkpoints are partially moved and cannot be restored safely. Reserve output storage and prepare identity copies before moving any state. Catch allocation failure at the parking call site and skip parking while retaining the live checkpoints. Add a deterministic allocation-failure regression and register it with the standalone conversation tests. This does not repeat the branch's existing KV reuse, draft ownership, or all-stage compatibility changes. ## Validation - Standalone `conversation_cache_test`: 4,191 checks passed. - Allocation injection: seven failure points preserve the input; successful split can merge back without allocation. - `git diff --check` passes. Tests use synthetic checkpoints and require neither model data nor a GPU. This PR makes no throughput claim. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:15 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2807
No description provided.