refactor(server): share target layer-split runtime helpers#306
Open
weicj wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors the target layer-split server path so new model adapters do not need to keep copying the same runtime shell. The existing Qwen35, Gemma4, and Laguna adapters all repeat shard/range/snapshot-backend setup and the autoregressive decode/sampling loop; this moves those shared pieces into
server/src/common/layer_split_runtime.*while keeping model-specific loading, graph execution, cache layout, snapshot payloads, and EOS rules inside each adapter.Changes
server/src/common/layer_split_runtime.h/.cpp.init_layer_split_runtime()centralizes target path validation, GGUF layer-count inspection, layer range calculation, shard metadata initialization, peer-access setup, and snapshot backend initialization.run_layer_split_ar_decode()centralizes the AR decode loop, CPU sampling handoff, token emission, cancellation handling, and EOS termination.server/CMakeLists.txt.Notes
common, while architecture-specific execution remains under each model directory.