Repository navigation
Conversation
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Contributor
[Medium impact] The PR appears safe to merge; the previous Windows test failure is addressed. SummaryAdds optional SageAttention 2 support to shared attention and model settings, including an experimental native OmniDreams path.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Attention setting] --> B{Sage2 requested?}
B -->|No| C[Existing backend]
B -->|Yes| D{CUDA graphs enabled?}
D -->|Yes| E[Reject or use allowed framework fallback]
D -->|No| F{OmniDreams native requested?}
F -->|No| G[Shared Sage2 adapter]
F -->|Yes| H[Check model target device]
H --> I[Native Sage2 or configured framework fallback]
Reviews (7) · Last reviewed commit: "test(omnidreams): isolate Sage2 platform..." · Reviewed by Greptile |
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Collaborator
|
Thanks @Shn0930 ! we'll review |
Collaborator
|
/ok to test c9c9fca |
jarcherNV
approved these changes
Sep 23, 2026
Collaborator
There was a problem hiding this comment.
Looks good to me overall:
- SageAttention 2 remains opt-in, with cuDNN unchanged as the default.
- The fallback, CUDA graph, and target-device handling look sound.
- Coverage and performance/quality evidence are thorough.
Approved from my side. Please resolve the current merge conflicts and then we can merge this.
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
Signed-off-by: Shn0930 <21735030@zju.edu.cn>
This branch has not been 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.
Purpose
Add SageAttention 2 as an opt-in backend to FlashDreams' shared attention
abstractions so generation models can use it without implementing a
model-specific SageAttention wrapper. The existing cuDNN path remains the
default and is unchanged.
Scope
backend="sage2"support toNativeAttentionandContextParallelAttention, including optional dependency loading, input/outputvalidation, LSE handling, and ring/Ulysses dispatch. This is framework-level
support available to models built on these shared attention classes.
backend call and transposed back afterward. This avoids layout-specific CP
branches; direct NHD improved a complete steady WAN AR block by only 0.155%.
OmniDreams framework/Python DiT configurations. Cross-attention remains on
cuDNN because the measured short cross-attention shape did not benefit from
Sage2.
sage2withuse_cuda_graph=True. CUDA-graph replay producedincorrect video after capture; Sage2 remains compatible with
compile_network=Truewhen explicit CUDA graphs are disabled.framework/Python DiT path and rejects native acceleration instead of silently
ignoring the requested backend.
default behavior. Model-specific native attention stacks remain independent
from the shared framework adapter.
Example opt-in configuration:
Cosmos and Template expose the same nested
network.self_attention_backendsetting. OmniDreams additionally requires
native_dit_acceleration="disabled"to select its framework/Python DiT path.
Test Plan
Run the Sage2 attention and model-configuration CPU tests:
Run formatting, lint, and type checks on the changed attention files and
tests:
Compare cuDNN and Sage2 in fresh deterministic GPU processes using identical
checkpoints, prompts, seeds, and generation settings:
141 frames, four denoise steps per block.
Compare HND and direct-NHD layouts using two crossed H20 runs, and verify
generated-video hashes.
As supplemental shared-backend quality evidence, compare cuDNN and Sage2 on
1,048 paired OmniDreams clips. OmniDreams integration itself is not changed
by this PR.
Test Result
tests deselected.
(1.473x).
(1.245x); steady diffusion stage: 1253.44 ms -> 911.29 ms
(1.375x).
all four generated MP4 hashes matched. The PR therefore keeps the simpler
shared HND path.
unsupported configuration is now rejected before model construction.