Repository navigation
[Fix] diffusion: Fix VMoBA chunk selection bugs - #44286
Merged
Merged
Conversation
OnePunchMonk
requested review from
AgainstEntropy,
BBuf,
HaiShaw,
kevin-mii,
mickqian,
niehen6174,
ping1jing2 and
yichiche
as code owners
October 14, 2026 12:31
Contributor
Author
|
hi @mickqian , please provide a first pass review for this pr once you have some time. thank you! |
BBuf
approved these changes
Oct 18, 2026
BBuf
left a comment
Collaborator
There was a problem hiding this comment.
LGTM; the 16 selector tests pass locally. Please rebase onto main and add a GPU parity check for mixed sparse selection and the self-chunk-only fallback.
- head_global topk now applies valid_gate_mask (no cross-batch attention) - fallback cutoff is C-1 (was bool True) in query_head and block - overall threshold no longer crashes when only self chunks exist - empty selection attends to the self chunk, not the whole sequence - threshold mode selects no extra chunk when the self chunk meets it - drop empty sequences; calc_chunks rejects them; remove lru_cache - add CPU regression tests
OnePunchMonk
force-pushed
the
fix/vmoba-selection-bugs
branch
from
October 18, 2026 12:02
007b5a4 to
042efda
Compare
BBuf
reviewed
Oct 18, 2026
| @@ -0,0 +1,264 @@ | |||
| # SPDX-License-Identifier: Apache-2.0 | |||
Collaborator
There was a problem hiding this comment.
The test file is too long, can you do a cleanup?
Contributor
Author
There was a problem hiding this comment.
have split it into two
BBuf
added a commit
to BBuf/sglang
that referenced
this pull request
Nov 4, 2026
…y say - VMoBA: the runtime imported kernel.attn.vmoba_attn.vmoba, a module that does not exist, so the chunk-selection fix of sgl-project#44286 never ran. Import the in-tree copy, require flash-attn 2 at backend resolution, drop its stale setup.py/README/speed script, and move its tests into the unit suite (the CUDA ones skip without flash-attn 2). - Add --enable-attention-backend-autotune for the documented field; fix ring_sp_performance.mdx to the real --kv-gather-degree flag. - Drop --mask-strategy-file-path (it set an unread field); the sliding-tile error now names --attention-backend-config mask_strategy_file_path. - HiDream-O1 rejects --flow-shift/--scheduler-class-override like its other ignored overrides; HunyuanImage-3 keeps a user --flow-shift. - /v1/images/edits returns 400 for a mask instead of ignoring it. - Drop the per-role requests_timed_out counter nothing increments. - PortArgs keeps only master_port: the three IPC names were never read and each construction leaked three temp files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
5 tasks done
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.
Summary
Fixes several selection bugs in
vmoba_attn/vmoba/vmoba.py, each reproduced on main first.topk+head_globalnever appliedvalid_gate_mask, so topk could pick -inf entries from other sequences in the batch.full_like(any_cond, C-1), which is bool, so the cutoff became 1 (query_head,block). Nowtorch.full(..., dtype=torch.long).threshold+overallraisedIndexError(argmax on empty tensor) when every sequence fits in one chunk. Now returns the self-chunk mask early.cu_chunk).calc_chunksraises on them.lru_cacheoncalc_chunks(tensor-identity key, stale on in-place updates). Fixed the topk/threshold error messages.Not included: the
kernel.attn.vmoba_attnimport path (needs a packaging decision) and host-sync cleanup.Tests
New
tests/test_vmoba_selection.py, CPU only, fakes only the flash-attn kernel. 13 of 16 fail on main, 16 pass with this change.blackclean. Independent review found no blocking issues.Limitations
No GPU end-to-end run, so flash-attn kernel integration is untested.
CI States
Latest PR Test (Base): ✅ Run #39151568172
Latest PR Test (Extra): ❌ Run #39151568018
Latest PR Test (AMD ROCm 10): ❌ Run #39151568205