Skip to content

ggml-backend : copy user inputs before cross-device inputs in compute_splits - #28874

Draft
douyamv wants to merge 1 commit into
ggml-org:masterfrom
douyamv:pr/sched-user-inputs-first
Draft

ggml-backend : copy user inputs before cross-device inputs in compute_splits#28874
douyamv wants to merge 1 commit into
ggml-org:masterfrom
douyamv:pr/sched-user-inputs-first

Conversation

@douyamv

@douyamv douyamv commented Sep 14, 2026

Copy link
Copy Markdown

In ggml_backend_sched_compute_splits, inputs of a split are copied in graph order. Without pipeline parallelism
(n_copies == 1, which is the case whenever --override-tensor is used since has_tensor_overrides() disables
it) the user-input path calls ggml_backend_synchronize(split_backend). If a cross-device input (the previous
split's output) was already processed for the same split, that stream carries a wait event on the previous device,
so the synchronize blocks the host until the previous GPU has finished its entire graph — at every split boundary
of every decode step. The CUPTI trace of a 3-GPU layer split showed the host stuck in cudaStreamSynchronize for
the full duration of each device's graph before it could enqueue the next one.

Copying the user inputs first (their stream only holds finished work at that point) and the cross-device inputs
afterwards removes the stall with no extra memory and no change in results.

🤖 Generated with Claude Code

…_splits

With n_copies == 1 (no pipeline parallelism, e.g. whenever tensor overrides are used) the user-input copy
synchronizes the whole stream of the split backend. If a cross-device input (the output of the previous split)
was processed first, that stream already carries a wait event on the previous device, so the host blocks until
the previous GPU has finished its entire graph -- at every split boundary of every decode step.

Processing the user inputs first keeps the sync trivial (the stream only holds finished work) and lets the
host enqueue the next split immediately. No extra memory, same results.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot added the ggml changes relating to the ggml tensor library for machine learning label Sep 14, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown

Hi @douyamv, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

  • Multiple open PRs from a new contributor: We limit new contributors (those without a previously merged PR) to 1 open PR at a time. You currently have 4 open PRs.

  • AI-generated content: While code is allowed to be generated by AI, please write the PR description and commit messages on your own without the help of AI.


Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@ggml-gh-bot ggml-gh-bot Bot added the draft PR will be changed to draft by github-actions bot label Sep 14, 2026
@github-actions
github-actions Bot marked this pull request as draft September 14, 2026 01:34
@github-actions github-actions Bot removed the draft PR will be changed to draft by github-actions bot label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant