-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[Bugfix] [diffusion] Fix cache-dit with sp-degree only #19965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BBuf
merged 10 commits into
sgl-project:main
from
OrangeRedeng:sequence_parallelism_with_cache_fix
Mar 18, 2026
Merged
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6e9e773
Update cache_dit_integration.py
OrangeRedeng 18da174
Fix lint issue
OrangeRedeng 9c83b81
Merge branch 'main' into sequence_parallelism_with_cache_fix
OrangeRedeng 2f85c55
Merge branch 'main' into sequence_parallelism_with_cache_fix
OrangeRedeng 78f1940
Switch to built-in functions
OrangeRedeng 6f0d25a
Update cache_dit_integration.py
OrangeRedeng fab79fd
Update cache_dit_integration.py
OrangeRedeng 11f2904
Merge branch 'main' into sequence_parallelism_with_cache_fix
mickqian bc8049b
Merge branch 'main' into sequence_parallelism_with_cache_fix
OrangeRedeng 0dc8ed3
Merge branch 'main' into sequence_parallelism_with_cache_fix
ping1jing2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |||||||||||
| import torch | ||||||||||||
| import torch.distributed as dist | ||||||||||||
|
|
||||||||||||
| from sglang.multimodal_gen.runtime.distributed.parallel_state import get_sp_group | ||||||||||||
| from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger | ||||||||||||
|
|
||||||||||||
| logger = init_logger(__name__) | ||||||||||||
|
|
@@ -107,15 +108,15 @@ def _build_parallelism_config( | |||||||||||
| ulysses_size = None | ||||||||||||
| ring_size = None | ||||||||||||
| if sp_group is not None: | ||||||||||||
| ulysses_size = getattr(sp_group, "ulysses_world_size", None) | ||||||||||||
| ring_size = getattr(sp_group, "ring_world_size", None) | ||||||||||||
| ulysses_size = get_sp_group().ulysses_world_size | ||||||||||||
| ring_size = get_sp_group().ring_world_size | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve readability and avoid calling
Suggested change
|
||||||||||||
|
|
||||||||||||
| tp_size = None | ||||||||||||
| if tp_group is not None: | ||||||||||||
| tp_size = dist.get_world_size(tp_group) | ||||||||||||
|
|
||||||||||||
| return ParallelismConfig( | ||||||||||||
| backend=ParallelismBackend.NATIVE_PYTORCH, | ||||||||||||
| backend=ParallelismBackend.AUTO, | ||||||||||||
| ulysses_size=ulysses_size, | ||||||||||||
| ring_size=ring_size, | ||||||||||||
| tp_size=tp_size, | ||||||||||||
|
|
||||||||||||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just use sp_group? It's no longer None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? I test it now and it still doesn't work on the latest version of slang from the main
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which PR fix this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my case (and #19955) the sp_group has no attributes "ulysses_world_size" and "ring_world_size"
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wired, @BBuf could you please also take a look? thanks~
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OrangeRedeng Hi~ I think you are right, the
sp/tp_groupinside_build_parallelism_configare assumed to betorch.distributed.ProcessGroup, but ProcessGroup has no attributes "ulysses_world_size" and "ring_world_size". The bug #19955 you has encountered maybe cause by errored sp/tp_group assigning logics at:sglang/python/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising.py
Lines 205 to 206 in 484f53c
Maybe we should change these code snippets to:
By the way, we should also fix the signature of
_build_parallelism_configto avoid misleading developers with the wrong usage. From the old one:sglang/python/sglang/multimodal_gen/runtime/cache/cache_dit_integration.py
Lines 100 to 103 in 484f53c
to the correctly signature:
@OrangeRedeng Could you please take a try?
Also cc @mickqian