Skip to content

Add flashdreams.accelerated support for Wan recipe and LingBot integration - #541

Open
fangjunzhou-nv wants to merge 3 commits into
NVIDIA:mainfrom
fangjunzhou-nv:dev/fangjun/optimized-wan-lingbot
Open

Add flashdreams.accelerated support for Wan recipe and LingBot integration#541
fangjunzhou-nv wants to merge 3 commits into
NVIDIA:mainfrom
fangjunzhou-nv:dev/fangjun/optimized-wan-lingbot

Conversation

@fangjunzhou-nv

Copy link
Copy Markdown
Collaborator

This PR brings flashdreams.accelerated OptimizedMultiHeadAttention to Wan family attention and use it in LingBot.

This PR should also serve as an example of how to use flashdreams.accelerated in a new integration.

Please note that the v2 runtime currently doesn't allow you to change the runner config. So you have to manually hard code it in integrations_v2/cam2v_lingbot/cam2v_lingbot/app.py like this:

image

@copy-pr-bot

copy-pr-bot Bot commented Aug 29, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds accelerated self- and cross-attention adapters for Wan, wires hardware-tuned attention presets into LingBot, and introduces benchmark and plotting utilities.

  • Adds checkpoint-compatible optimized Wan attention modules with rolling and static KV-cache support.
  • Exposes optimized attention selection through Wan and LingBot network configurations.
  • Registers RTX PRO 6000 and GB300 LingBot runner presets.
  • Adds module, network, and pipeline benchmarks plus plotting launchers.

Confidence Score: 4/5

The optimized presets need a distributed-launch guard or context-parallel-compatible implementation before merging because multi-process LingBot startup currently fails.

Both newly registered hardware presets select optimized self-attention, while the existing transformer initialization always forwards the distributed WORLD group for world sizes above one and the optimized implementation immediately rejects it.

Files Needing Attention: integrations/lingbot/lingbot/config.py; flashdreams/flashdreams/recipes/wan/transformer/impl/modules.py

Important Files Changed

Filename Overview
flashdreams/flashdreams/recipes/wan/transformer/impl/modules.py Adds optimized Wan self- and cross-attention adapters; cache and checkpoint layouts align, but optimized self-attention explicitly rejects context parallelism.
flashdreams/flashdreams/recipes/wan/transformer/impl/network.py Propagates backend and implementation policies into every block while retaining the existing network-level context-parallel setup.
integrations/lingbot/lingbot/config.py Registers two optimized presets that are reachable through public runners but fail under multi-process context-parallel launches.
integrations/lingbot/lingbot/transformer/impl/network.py Propagates the selected attention backends and policies into LingBot camera-control blocks.
integrations/lingbot/benchmarks/test_modules.py Adds representative and exhaustive module benchmarks with valid rolling-cache steady-state handling.
integrations/lingbot/benchmarks/test_network.py Adds compiled network benchmarks whose explicit cache lifecycle matches the production graph-captured path.
scripts/benchmark/lingbot/_plot.py Adds plotting support for representative and exhaustive benchmark artifacts with matching parameter-ID parsing.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[LingBot runner preset] --> B[Pipeline setup]
  B --> C[Wan21Transformer]
  C --> D[WanDiTNetwork]
  D --> E{Attention backend}
  E -->|Torch| F[Torch attention]
  E -->|Optimized| G[Optimized Wan attention]
  C --> H[Distributed WORLD group]
  H --> G
  G --> I[Rejects context parallelism]
Loading

Reviews (1): Last reviewed commit: "Added tunned runner config for LingBot o..." | Re-trigger Greptile

diffusion_model=dict(
transformer=dict(
network=dict(
self_attention_backend=AttentionBackend.OPTIMIZED,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Distributed optimized startup fails

If either new optimized preset runs with a distributed world size greater than one, Wan21Transformer forwards the WORLD context-parallel group to optimized self-attention, which rejects every non-None group and raises NotImplementedError before generation starts. Add an explicit single-rank constraint or use a context-parallel-compatible attention implementation.

Knowledge Base Used:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently flashdreams.accelerated doesn't support context parallel and this is a KNOWN ISSUE. Please be aware this will be out side the scope of LingBot integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant