feat: support for cross-device row split#1735
Merged
Merged
Conversation
A --backend module assignment can now list several devices separated by '&'. The module's transformer blocks are partitioned into contiguous ranges sized proportionally to each device's free memory (minus a fixed compute headroom) and registered with the ModelManager with per-tensor compute backends; the existing allocation/staging/LoRA/residency machinery handles the weights unchanged. The module's graphs execute on a ggml_backend_sched spanning the devices, pinning each node to the device of the most recently consumed weight (view ops are never pinned) and splitting each graph exactly once. Supported for the diffusion and te modules; for te the dominant encoder (t5xxl or the LLM) splits while small sub-runners stay on the main device. Graph-cut segmentation and --stream-layers are disabled for split modules. Adds --list-devices to print the ggml device names accepted by the backend specs. Manual placement only; row/tensor split and auto-fit are follow-ups. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ode row) --split-mode selects how a module assigned multiple runtime devices distributes its weights: layer (default) or row. In row mode the module keeps executing on its main device while its transformer-block matmul weights are allocated in the backend's row-split buffer type (resolved through the "ggml_backend_split_buffer_type" proc, CUDA only for now), which slices each weight's rows across the devices in proportion to free memory and runs the matmuls multi-GPU internally. The ModelManager owns the split buffer types (set_split_buffer_type): params_buffer_type_for returns the split type for eligible tensors when params live on the compute backend, and the staging path groups by (backend, buffer type) and allocates with ggml_backend_alloc_ctx_tensors_from_buft so cpu/disk params residency stages straight into split buffers. Eligibility is limited to contiguous 2D weights of at least 256x256 inside transformer blocks: anything else is consumed by non-matmul ops or sliced into views, which split buffers do not support. Direct LoRA application skips row-split tensors; the automatic LoRA mode selects at_runtime when row split is active. Falls back to a layer split when the backend has no split buffer type or the devices span registries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 task
Owner
|
Thank you for your contribution. |
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
Part 2 of the changes split in #1470 containing the row-split allocation (slower, but better at conserving memory), requires split buffer support.
Requires #1734
Related Issue / Discussion
#1470
Additional Information