[diffusion] fix Z-Image SP sharding for portrait and padded resolutions#21042
Merged
BBuf merged 6 commits intosgl-project:mainfrom Mar 24, 2026
Merged
[diffusion] fix Z-Image SP sharding for portrait and padded resolutions#21042BBuf merged 6 commits intosgl-project:mainfrom
BBuf merged 6 commits intosgl-project:mainfrom
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
BBuf
reviewed
Mar 22, 2026
BBuf
reviewed
Mar 22, 2026
BBuf
reviewed
Mar 22, 2026
Collaborator
|
This PR fixes the portrait / padded-resolution / W-shard path, but I don't see a regression test that actually exercises that path. The current 2-GPU Z-Image test still uses the default square case, so it likely never hits the new branch. Could we add one portrait or padded-resolution SP test here? |
Collaborator
|
please wait for #20679 |
BBuf
approved these changes
Mar 23, 2026
Collaborator
Author
|
/tag-and-rerun-ci |
Collaborator
Author
|
/rerun-failed-ci |
adityavaid
pushed a commit
to adityavaid/sglang
that referenced
this pull request
Mar 24, 2026
…ns (sgl-project#21042) Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
adityavaid
pushed a commit
to adityavaid/sglang
that referenced
this pull request
Mar 24, 2026
…ns (sgl-project#21042) Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
0-693
pushed a commit
to 0-693/sglang
that referenced
this pull request
Mar 25, 2026
…ns (sgl-project#21042) Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
johnnycxm
pushed a commit
to johnnycxm/sglang
that referenced
this pull request
Mar 25, 2026
…ns (sgl-project#21042) Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
johnnycxm
pushed a commit
to johnnycxm/sglang
that referenced
this pull request
Mar 25, 2026
…ns (sgl-project#21042) Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
5 tasks
JustinTong0323
pushed a commit
to JustinTong0323/sglang
that referenced
this pull request
Apr 7, 2026
…ns (sgl-project#21042) Co-authored-by: Xiaoyu Zhang <35585791+BBuf@users.noreply.github.com>
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.
Motivation
Fix Z-Image-Turbo sequence-parallel sharding for portrait and padded resolutions when Ulysses/SP is enabled. Fixes #21021Z-Image currently works for some resolutions such as 1024x1024 and 1280x720, but produces corrupted results for others such as 720x1280 and 720x720 when sharding is enabled. This PR fixes the Z-Image-specific SP path so it preserves native image geometry during denoising.
Z-Image patchifies latents in native F/H/W order, but the current Z-Image SP path mutates the image geometry before
denoising:
Modifications
concatenation.
Accuracy Tests
I tested with 2 commands:
sglang generate --model-path Tongyi-MAI/Z-Image-Turbo --seed 42 --prompt "A crowded beach" --height 720 --width 720 --num-inference-steps 9 --ulysses-degree 2 --num-gpus 2 --guidance-scale 4.0sglang generate --model-path Tongyi-MAI/Z-Image-Turbo --seed 42 --prompt "A crowded beach" --height 720 --width 1280 --num-inference-steps 9 --ulysses-degree 2 --num-gpus 2 --guidance-scale 4.0Before PR:

After PR:


Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci