mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #716] [CLOSED] conversation parking with --layer-split #2783
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#2783
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/716
Author: @evaanp
Created: 10/4/2026
Status: ❌ Closed
Base:
main← Head:pr/parking-layer-split📝 Commits (10+)
7efb9abconversation cache: a checkpoint records the carve its payload was saved from712343bconversation snapshot: the entry points take the stages, stage 0 firstbb89148conversation snapshot: capture, validate and restore across a layer split7a55d53serve: conversation parking no longer refuses --layer-splitd144797conversation validation test: a two-stage split fixture, host-sidec5a5bbaconversation snapshot test: single-stage call sites take a stage vector50431c8conversation snapshot: drain each stage on its own device before reading or writing it2f344beconversation validation test: a split's copies must follow a drain on their own device7df55bcserve: parking names stage 0's device instead of leaving it -1e7a3da7Copy the layer carve into split mid-prompt checkpoints; parity tool runs the server's engine arguments📊 Changes
9 files changed (+356 additions, -113 deletions)
View changed files
📝
CMakeLists.txt(+4 -1)📝
docs/DETAILS.md(+5 -3)📝
include/strata/core/conversation_cache.hpp(+7 -4)📝
include/strata/core/conversation_snapshot.hpp(+18 -6)📝
src/core/conversation_snapshot_test.cpp(+12 -11)📝
src/core/conversation_state.cpp(+134 -59)📝
src/core/conversation_validation_test.cpp(+158 -18)📝
src/program/generate.cpp(+15 -9)📝
tools/conversation_cache_parity.py(+3 -2)📄 Description
What
Conversation parking (
--conversation-cache-mib, #57) refused to start with--layer-split: "conversation parkingdoes not yet support --layer-split". On two cards every switch between an agent and its sub-agent or side call
then read the whole prompt again. This lets the two work together.
draft-layer K/V on the stage that carries it. Host K/V stays flat, in stage order with the drafter last, so the
cache's reuse of retained pages works as before; only running state is per stage, the way
ConversationCheckpoint::stage_partsalready stored it.ConversationCheckpointrecordslayer_lo/layer_hi: two same-sized carves withdifferent QSA ordinals cannot be told apart by sizes alone, so a part can never be restored into a stage that runs
other layers.
conversation_snapshot_validatechecks every part against its own stagebefore anything is restored, as the single-GPU path already did.
OnDevicescope and copythere. (
cudaDeviceSynchronizedrains only the current device, so a single sync on stage 0's card would have reada later stage's state while its kernels might still be writing it.) Stage 0 is named as device 0 instead of -1.
--prompt-cache-every) now copy the carve too; without it every park ofa conversation longer than 16K tokens was refused as "a checkpoint from another session layer carve".
tools/conversation_cache_parity.pybuilds the engine arguments the way the server does, so on several GPUs ittests the layer split instead of one card.
Tests
conversation_validation_testgains a two-stage split fixture (host only): parts, carves, mismatched stage countsand carves, and two checks that a later stage is written, and read during capture, only after its own device was
drained. 1008 checks host-only;
conversation_transfer_test1608. That test now also wrapscudaGetDeviceandcudaSetDevice(it defined the wrappers, but the link did not use them, so on a machine without a GPU the devicenever changed and the fixture failed on its own harness); with them it passes, and it fails again with the
per-stage
OnDevicescopes removed. Built in the CUDA 13.0 image (-DSTRATA_BUILD_CONVERSATION_TESTS=ON).conversation_cache_test(4175 checks) unchanged;conversation_snapshot_testcall sites take a stage vector.tools/conversation_cache_parity.py --scenario reusewith the layer split: A/B/A, greedy, tokens andmain-model state byte-exact against a run without parking (see Measured).
Measured
IQ3_S on an RTX 5060 Ti 16 GB + RTX 2000 Ada 16 GB (
layer_split 30), Ryzen 7 9700X, 64 GB RAM. Measured on ourown branch: v0.1.38 merged with this code plus unrelated patches of ours (the parking code is the same as here),
--conversation-cache-mib 1024.--scenario reuse: PASS, byte-exact. A ~2K-token conversation is a 254 MiB snapshotacross both stages, parked in ~55 ms and restored in ~18 ms (from its live end) to ~20 ms (from a checkpoint). The
same A/B/A also passed on IQ2_XS with the earlier 0.1.34-based version of this code.
Developed with an AI coding assistant; all numbers measured on the machine above (Linux, CUDA 13).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.