Repository navigation
[Perf][qwen-image-edit] Skip attention-mask to avoid varlen path - #4293
Conversation
Signed-off-by: kTorp <Kristoffer.Torp@amd.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
hsliuustc0106
left a comment
There was a problem hiding this comment.
Follows the same pattern as PR #3763, 14-15% latency improvement for qwen-image-edit.
|
can you provide a perf comparison table for different models with different input sizes |
|
Could you also provide quantitative metrics for the image similarities? Like SSIM, PSNR, pixel similarity. Thanks |
|
Thank you. At Could you paste the DEBUG log lines from |
|
Hi, thanks for the reviews and follow-ups 😄 Addressing your comments @NumberWan for However, your comment did make me realize an oversight on my part and that is that there's no padding for @fhfuih I collected your suggested metrics using @hsliuustc0106 do you mean for other models than qwen? |
|
Thanks for the follow up with data. Any idea/guesses why it is not identical (SSIM>=0.99 or 1, and PSNR ~ inf)? 🤔 Because if this branch is redundant and the images are meant to be the same, we should be able to observe higher values. EDIT: seems like it is mentioned here #3763 (comment) And I can also add some more perf test data on my side: With 4 GPU H200 and 1789*1789 resolution (picked a random number not divisible by 4):
In your |
|
I got numbers for Flux2 comparing 1328x1328 before and after skipping varlen-mask 1328x1328: So there's a pretty good boost in the padded case while the 2048x204 remains unchanged as expected Outputs: |
|
@jjuvonen-amd PTAL |
|
@kTorp, thank you for adding this for Qwen and Flux. Were you planning on enabling and testing it also with HunyuanVideo 1.5 and GLM Image? Would it make sense to include a one-time warning message when logger.warning_once(
"SP auto-padding applied %d token(s) (seq_len=%d, ulysses_degree=%d). "
"Padding tokens are not masked from attention (mask_sp_padding=False), "
"which avoids the varlen attention path but may produce minor numerical differences. "
"Set parallel_config.mask_sp_padding=True to restore strict masking.",
ctx.sp_padding_size,
ctx.sp_original_seq_len,
parallel_config.sequence_parallel_size,
) |
|
@jjuvonen-amd thanks for the original PR and for feedback, I'll add in the logger warnings as done for Wan2.2. Yes, I'll enable and test it for HunyuanVideo1.5 and GLM image as well. Is it alright if I do so in a separate PR @hsliuustc0106, so that it doesn't clutter this one? |
Signed-off-by: kTorp <Kristoffer.Torp@amd.com>
…m-project#4293) Signed-off-by: kTorp <Kristoffer.Torp@amd.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com> Signed-off-by: syd520zy <529477025@qq.com>
…m-project#4293) Signed-off-by: kTorp <Kristoffer.Torp@amd.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com> Signed-off-by: syd520zy <529477025@qq.com>
…m-project#4293) Signed-off-by: kTorp <Kristoffer.Torp@amd.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
|
@hsliuustc0106 sorry for the delay, I've now had time to run and test the remaining models and opened this #4645 Flux2 and HunyuanVideo1.5 shows a good boost for padded sequence lengths similarly to the previous models. Unfortunately I had a lot of troubles gettings results for GLMImage. I got this setup to work for where gave nice results
but as soon as I tried changing to a different resolution to trigger the automatic-padding I could only produce these strange tilings: I'm probably just running the model erroneously 😅 any feedback / instructions would be welcome. In the meanwhile I've left it out of the PR so it's not a blocker. |
…m-project#4293) Signed-off-by: kTorp <Kristoffer.Torp@amd.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>






PLEASE FILL IN THE PR DESCRIPTION HERE ENSURING ALL CHECKLIST ITEMS (AT THE BOTTOM) HAVE BEEN CONSIDERED.
Purpose
This PR builds on top of [Perf][Wan2.2] Skip attention mask for zero-padded SP sequences to avoid varlen path and similarly avoids the varlen path for a 14-15 % latency improvement for qwen-image-edit.
NOTE: this should be merged after #3763 since it depends on the
mask_sp_paddingboolean invllm_omni/diffusion/data.pyintroduced in that PR.Test Plan
Test Result
Commands used
Qwen-Image-Edit
Qwen-Image
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model. Please runmkdocs serveto sync the documentation editions to./docs.BEFORE SUBMITTING, PLEASE READ https://github.com/vllm-project/vllm-omni/blob/main/CONTRIBUTING.md (anything written below this line will be removed by GitHub Actions)