Repository navigation
[Refactor] diffusion/bcg: Share graph-pool output management - #46709
Merged
Merged
Conversation
mickqian
requested review from
AgainstEntropy,
BBuf,
Fridge003,
HaiShaw,
Ying1123,
hnyls2002,
ispobock,
kevin-mii,
merrymercy,
niehen6174,
ping1jing2,
wisclmy0611 and
yichiche
as code owners
October 27, 2026 02:09
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
mickqian
requested review from
JustinTong0323,
sogalin and
zijiexia
as code owners
October 27, 2026 02:09
Collaborator
Author
|
/tag-and-rerun-ci |
This was referenced Oct 27, 2026
niehen6174
added a commit
to niehen6174/sglang
that referenced
this pull request
Nov 5, 2026
Reviewed the six upstream minimax_h3.py changes since the last pin (sgl-project#46047, sgl-project#46709, sgl-project#47567, sgl-project#47569, sgl-project#47566 and the BCG output buffers). None touches what h3_comfyui_v1 relies on in its single-GPU eager torch_sdpa profile: DiTBlock.forward is unchanged, _attend still calls fused_inplace_qknorm_rope on the _use_fused_qknorm_rope branch with the same arguments (the new pipelined branch needs Ulysses, which the profile rejects), and _embed still returns (embeddings, t_emb) in eager mode.
Yuxingwang-intel
pushed a commit
to Yuxingwang-intel/sglang
that referenced
this pull request
Nov 6, 2026
…ject#46709) Co-authored-by: Mick Qian <mickqian@users.noreply.github.com>
This branch was successfully deployed
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
Follow-up to #46659 and #46660. The graph-pool allocation and replay copy logic is repeated across attention wrappers and model-specific breaks. These should share output management without forcing different attention implementations through the same compute path.
Modifications
output_factorytoeager_on_graph: allocate outputs before ending the captured segment, retain weak references, and validate layouts before replay writeback.pass_output=True, preserving H3 embedding's buffer reuse without copying those tensors into themselves.Production code: 115 lines added, 97 removed across five files. Attention algorithms and backend selection are unchanged.
Accuracy Tests
Validated on one H200 with PyTorch 2.14.1+cu130 / CUDA 13.0 at
66de1dcb7a5e7ec9781f66dd751cffbd085182f5:rtol=0, atol=0.git diff --checkpassed.Full-checkpoint generation, multi-GPU TP/SP, and AMD/XPU have not been validated in this follow-up.
Speed Tests and Profiling
Bounded Qwen prefix-attention microbenchmark, not full-model E2E: one H200, BF16, batch 1, 16 heads x 64, SDPA, 128 padded prefix rows, K/V length Q+384. Measures attention plus one output addition. 20 warmups, then median of 9 batches x 200 calls, synchronized on CUDA. Compared against
c43abd6d9e38a14e81bdb77c648a06353e1c10ee; execution order was new, base, new repeat.Output hashes match across commits. Incremental peak PyTorch allocation is unchanged for BCG and lower for eager in both shapes. BCG performance is effectively neutral; eager avoids an unnecessary allocation/copy. No end-to-end speedup is claimed.
Checklist
CI States
Latest PR Test (Base): ✅ Run #40632784359
Latest PR Test (Extra): ❌ Run #40632784280
Latest PR Test (AMD ROCm 10): ⏳ Run #40632784186