Repository navigation
Conversation
Contributor
Merge Protections🔴 1 of 1 protections blocking · waiting on 👀 reviews and 🤖 CI
🔴 PR merge requirementsWaiting for
This rule is failing.
|
Contributor
Author
|
The benchmark script. |
Contributor
|
This PR has merge conflicts with the base branch. Please rebase: git fetch origin main
git rebase origin/main
# Resolve any conflicts, then:
git push --force-with-lease |
This was referenced Sep 7, 2026
klhhhhh
force-pushed
the
flashinfer-backend
branch
from
October 2, 2026 06:35
9b56828 to
85f29c5
Compare
klhhhhh
force-pushed
the
flashinfer-backend
branch
from
October 10, 2026 05:41
85f29c5 to
6b8afb6
Compare
Collaborator
Contributor
[Medium impact] The PR reaches explicitly selected attention in the standard Wan CUDA inference path. Fix the missing imports in Findings
Fix with agent prompt### Issue 1
fastvideo/tests/attention/test_flashinfer_scope.py:12
`test_flashinfer_scope.py` imports `DreamXWorldArchConfig` from a module that does not exist in this repository. Pytest stops with `ModuleNotFoundError` while collecting this file, so none of its backend-scope tests can run.
Remove the missing-family import and its test cases, or use an existing model family. The later import of `DreamXWorldTransformer3DModel` needs the same correction.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|
klhhhhh
added a commit
to klhhhhh/FastVideo
that referenced
this pull request
Oct 20, 2026
Contributor
Author
|
@aryan5v already resolve |
Contributor
Author
klhhhhh
added a commit
to klhhhhh/FastVideo
that referenced
this pull request
Oct 20, 2026
klhhhhh
force-pushed
the
flashinfer-backend
branch
from
October 20, 2026 11:54
9b3d724 to
102867a
Compare
This comment has been minimized.
This comment has been minimized.
klhhhhh
force-pushed
the
flashinfer-backend
branch
from
October 27, 2026 07:27
2bb1880 to
a99a2ca
Compare
klhhhhh
force-pushed
the
flashinfer-backend
branch
from
October 30, 2026 05:04
a99a2ca to
5d56e3e
Compare
Contributor
Author
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.
Summary
This PR adds an opt-in FlashInfer dense-attention backend for the standard
Wan inference path.
Enable it before constructing the generator:
The implementation calls:
Backend selection remains explicit and model-scoped. This PR adds
FLASHINFERonly to Wan's declaredsupported_attention_backends; it doesnot implicitly treat every layer that supports
FLASH_ATTNasFlashInfer-compatible.
Motivation
FastVideo already depends on
flashinfer-pythonfor other kernel paths, butdoes not expose FlashInfer's dense prefill attention through the common
attention backend interface.
Wan's video DiT recomputes full-sequence Q/K/V at each denoising step, so
FlashInfer's prefill attention API is the relevant dense-attention path rather
than its autoregressive decode API.
Implementation
The new backend:
[Q, K]custom-mask contract.original output dtype, with a warning.
launches one single-request prefill kernel per batch item.
Model scope
The initial validated model scope is:
Wan-AI/Wan2.1-T2V-1.3B-DiffusersThis PR intentionally does not add FlashInfer support to every existing model
that declares
FLASH_ATTN.Other model families, causal Wan variants, encoders, VAEs, and additional
attention shapes will be validated and enabled in follow-up PRs by explicitly
adding
FLASHINFERto their ownsupported_attention_backendsdeclarations.The FlashInfer cuDNN batched dense-attention path
(
cudnn_batch_prefill_with_kv_cache) is also out of scope for this PR and willbe evaluated separately.
Failure behavior
Selection follows FastVideo's existing model-level backend contract:
FLASHINFERsupport.flashinfer-python, pre-sm80 hardware, and unsupported headdimensions fail with explicit errors after a layer has selected FlashInfer.
inference-only error.
Tests
This PR adds coverage for:
Backend behavior
[B, H, Q, K]masks.Selector behavior
FLASHINFERfall back normally.FLASHINFERresolve to the new backend.CUDA platform resolution
flashinfer-python.Real CUDA parity
The GPU test compares the real FlashInfer CUDA kernel against Torch SDPA for:
Example:
Preliminary end-to-end result
Hardware and workload:
Wan-AI/Wan2.1-T2V-1.3B-DiffusersMeasured full-pipeline wall times:
FLASH_ATTNThis produced:
All three measured FlashInfer runs were faster than all three measured
FlashAttention runs in this experiment. The FlashInfer measurements also had
lower run-to-run variance:
This result should be treated as preliminary rather than a final kernel-level
performance claim:
favored the second benchmark arm.
scheduling, and other work outside attention.
backend="auto"; the final internal kernel was not pinned toFA2 or FA3.
A follow-up benchmark will reverse the backend order, disable output saving,
increase the number of measured runs, and profile the attention kernels
separately.
Limitations
Follow-ups
Separate PRs will cover: