[PR #526] [CLOSED] Allow conversation parking under --layer-split (owner-routed per-stage capture/restore) #2675

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/526
Author: @chimpera
Created: 10/2/2026
Status: ❌ Closed

Base: main ← Head: pr/layer-split-parking


📝 Commits (1)

  • 6d309b9 Support layer-split whole-session parking (port of Ropewalk's stage capture)

📊 Changes

4 files changed (+155 additions, -48 deletions)

View changed files

📝 include/strata/core/conversation_cache.hpp (+2 -2)
📝 include/strata/core/conversation_snapshot.hpp (+21 -5)
📝 src/core/conversation_state.cpp (+120 -32)
📝 src/program/generate.cpp (+12 -9)

📄 Description

The problem

Today --layer-split and --conversation-cache-mib cannot be combined — the server refuses to start:

strata serve: conversation parking does not yet support --layer-split; disable parking with --conversation-cache-mib 0

(src/program/generate.cpp, the return 2 guard.) A multi-GPU split therefore cannot park conversations at all: every conversation switch re-prefills the whole session, exactly the cost parking exists to avoid.

The change

Teach the snapshot core which GPU stage owns each QSA layer:

  • conversation_snapshot.hpp: ConversationStageRef {dev, lb, le, ss} and a trailing later parameter (default {}) on bytes/capture_bytes/save/validate/restore — every single-GPU caller and test compiles unchanged.
  • conversation_state.cpp: owner_of/owner_state map a QSA layer to its stage via [lb, le); per-layer K/V saves/restores go to/from the owner's session under an OnDevice guard (the primary session's buffers for another stage's layers are allocated but never written). The live checkpoint gains one running-state part per later stage, assembled exactly as the ordinary split checkpoint path does; the draft rides the last stage. Validation requires stage_parts.size() == later.size().
  • generate.cpp: drop the --layer-split parking rejection; build the stage refs from the GpuStage table once beside the cache and pass them at the estimate/save/validate/restore sites; the STRATA_SNAPSHOT_VERIFY read-back runs on the draft's (last stage's) device.

Validation

Measured on a 2-way split (RTX 3090 ×2, --layer-split 24):

  • host tests green (1781 + 876 + 1452 checks)
  • park 1593 tok / 57 ms and 19,925 tok / 125 ms (1.01 GB)
  • restore byte-verified (STRATA_SNAPSHOT_VERIFY)
  • incremental re-park reuses 23.5 MB of retained K/V through the owner routing
  • two conversations parked simultaneously
  • exact-token parity of A1/A2/A3 answers between the restore path and a parking-off fresh run

The same change has been running in a daily-driver split deployment with the conversation cache on (parking, restore and incremental re-park exercised by live traffic). Python suite on this branch: 100 tests OK (python -m unittest serve.test_server).

🤖 Generated with Claude Code


🔄 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/526 **Author:** [@chimpera](https://github.com/chimpera) **Created:** 10/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/layer-split-parking` --- ### 📝 Commits (1) - [`6d309b9`](https://github.com/Niko1221/Strata/commit/6d309b96713f66b95adb7c2b6a713d9c91a1e467) Support layer-split whole-session parking (port of Ropewalk's stage capture) ### 📊 Changes **4 files changed** (+155 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/core/conversation_cache.hpp` (+2 -2) 📝 `include/strata/core/conversation_snapshot.hpp` (+21 -5) 📝 `src/core/conversation_state.cpp` (+120 -32) 📝 `src/program/generate.cpp` (+12 -9) </details> ### 📄 Description ## The problem Today `--layer-split` and `--conversation-cache-mib` cannot be combined — the server refuses to start: ``` strata serve: conversation parking does not yet support --layer-split; disable parking with --conversation-cache-mib 0 ``` (`src/program/generate.cpp`, the `return 2` guard.) A multi-GPU split therefore cannot park conversations at all: every conversation switch re-prefills the whole session, exactly the cost parking exists to avoid. ## The change Teach the snapshot core which GPU stage owns each QSA layer: - **`conversation_snapshot.hpp`**: `ConversationStageRef {dev, lb, le, ss}` and a trailing `later` parameter (default `{}`) on `bytes`/`capture_bytes`/`save`/`validate`/`restore` — every single-GPU caller and test compiles unchanged. - **`conversation_state.cpp`**: `owner_of`/`owner_state` map a QSA layer to its stage via `[lb, le)`; per-layer K/V saves/restores go to/from the **owner's** session under an `OnDevice` guard (the primary session's buffers for another stage's layers are allocated but never written). The live checkpoint gains one running-state part per later stage, assembled exactly as the ordinary split checkpoint path does; the draft rides the last stage. Validation requires `stage_parts.size() == later.size()`. - **`generate.cpp`**: drop the `--layer-split` parking rejection; build the stage refs from the `GpuStage` table once beside the cache and pass them at the estimate/save/validate/restore sites; the `STRATA_SNAPSHOT_VERIFY` read-back runs on the draft's (last stage's) device. ## Validation Measured on a 2-way split (RTX 3090 ×2, `--layer-split 24`): - host tests green (1781 + 876 + 1452 checks) - park 1593 tok / 57 ms and 19,925 tok / 125 ms (1.01 GB) - restore byte-verified (`STRATA_SNAPSHOT_VERIFY`) - incremental re-park reuses 23.5 MB of retained K/V through the owner routing - two conversations parked simultaneously - exact-token parity of A1/A2/A3 answers between the restore path and a parking-off fresh run The same change has been running in a daily-driver split deployment with the conversation cache on (parking, restore and incremental re-park exercised by live traffic). Python suite on this branch: 100 tests OK (`python -m unittest serve.test_server`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:18 +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#2675
No description provided.