Skip to content

fix: layer split across cuda - #2262

Merged
leejet merged 1 commit into
leejet:masterfrom
cumal:fix/layer-split-shared-node
Nov 2, 2026
Merged

leejet merged 1 commit into
leejet:masterfrom
cumal:fix/layer-split-shared-node

Conversation

@cumal

@cumal cumal commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Allow split backend over multiple cuda gpus

Related Issue / Discussion

#2225

Additional Information

Checklist

Summary by CodeRabbit

  • Bug Fixes
    • Improved graph partitioning so each valid node keeps its first assignment rather than being reassigned by later segments. This also avoids assigning nodes that are missing or invalid, helping produce more consistent partitioning results.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63aecaf4-7d6b-457b-a143-aa47dc7dce5b
Commits

Reviewing files that changed from the base of the PR and between 290148d and 5b4f4a3.

Files selected for processing: 1
  • src/core/layer_split_partition.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

Graph partitioning now skips node assignments when an index is out of range or the node is null. It also preserves an existing assignment instead of replacing it with the current segment’s backend.

Changes: Graph partition assignment

Layer / File(s) Summary
Guard node assignments
src/core/layer_split_partition.cpp
A shared helper skips invalid indices and null nodes. It assigns the current segment’s backend only when the node has no existing assignment.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • leejet/stable-diffusion.cpp#2225 — The issue describes illegal CUDA memory access during multi-CUDA layer splitting, which is related to the partition assignment behavior changed here.

Suggested reviewers: leejet

Merge Risk: Low · up to 5b4f4

Some valid multi-CUDA graphs may incur extra cross-device transfers and work, but execution remains correct and the impact is limited to shared-producer graph shapes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: fixing layer splitting across CUDA. It is concise and related to the changeset.
Description check Passed The description includes the required Summary, Related Issue / Discussion, Additional Information, and Checklist sections. It explains the goal, links the related issue, and confirms the contribution …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required Summary, Related Issue / Discussion, Additional Information, and Checklist sections. It explains the goal, links the related issue, and confirms the contribution guidelines checklist.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@leejet
leejet merged commit 250ea6e into leejet:master Nov 2, 2026
2 checks passed
@leejet

leejet commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants