Repository navigation
[Kernel] Remove fa3-fwd dependency - #7735
Conversation
|
Author self-review:
|
|
This PR appears to belong to: docs/design/module/diffusion/index.md. Module owners: @princepride @david6666666 @Isotr0py Routing: @princepride via module of the changed files, semantic router, CODEOWNERS; @david6666666 via module of the changed files, semantic router; @Isotr0py via module of the changed files, semantic router @dougbtv, please review your own changes and leave a short self-review comment describing what you checked. PRs without author self-review may not be assigned a reviewer. Please take a look when you have a chance. If you would like an automated review, mention @vllm-omni-review-bot in a comment. |
5ed7f66 to
601a32a
Compare
|
Rebased onto current I also exercised the previous exact head (
Result: 2 passed. The image build/publish completed successfully, and the test run produced JUnit results successfully.
This proves that the source image builds without the removed requirement and that the new adapter-layout and backend-selection contracts execute successfully in the packaged dependency environment. These two tests are CPU/monkeypatch contract tests; they do not yet claim real CUDA-kernel or distributed-ring execution. I am treating real FA2/FA3 dispatcher execution plus ring/LSE numerical correctness as the remaining mechanical validation, not performance benchmarking. |
|
Mechanical CUDA validation is complete on the current PR head We built a CUDA image directly from this PR's source and ran the focused attention tests below against that image. Single-GPU validationThe same focused suite passed on both A100 (SM80 / FA2) and H100 (SM90 / FA3):
Results:
This exercises the real vLLM FlashAttention dispatcher and checks the new dense-to-varlen adapter's output and LSE against the PyTorch reference, alongside the existing CUDA attention parity cases. Distributed ring validationOn 2× H100 with NCCL, The first version of this new test had a test-only layout mistake: its reference was transposed to Dependency-removal checkIn every test environment we also verified that:
So the scoped mechanical removal is covered: the old package is absent, real FA2 and FA3 dispatch work, dense output/LSE parity passes, and two-GPU ring output/LSE parity passes. For Test Approve, the hardware-specific cases to watch are the CUDA adapter/parity tests on A100 and H100, plus |
Omni ReviewBot: no human activity for 7 days@dougbtv this pull request has had no human commit, comment or review since 2026-09-21. Please confirm the current plan and next step. The author or a maintainer decides whether to change the PR state. To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline. |
|
I reviewed head a713779 against base 62b1514. The dense vLLM FlashAttention adapter and ring-attention LSE accumulation passed my targeted checks: the dense output/LSE comparison passed on one GPU, and the two-GPU ring output comparison passed. I also ran a fixed-head A/B/A Qwen-Image request on two NVIDIA L20X GPUs (1024×1024, 8 steps, ring degree 2). The median was 1.578 s on this head versus 1.365 s and 1.397 s for the two base runs. This workload therefore did not show a request-level speedup; the head was about 14% slower than the mean of the two base medians. These measurements are specific to this device and workload and do not invalidate the reported A100/H100 results. Please keep the performance claim scoped to the workloads where it was measured. GitHub currently reports this PR as CONFLICTING; please update the branch before merge so the final diff and required checks apply to the mergeable version. |
Signed-off-by: Doug Smith <dosmith@redhat.com>
Signed-off-by: Doug Smith <dosmith@redhat.com>
Signed-off-by: Doug Smith <dosmith@redhat.com>
a713779 to
b1c608d
Compare
|
Thanks for the focused validation and the device/workload-specific result. I have rebased the PR onto current |
|
Reviewed |
Omni ReviewBot routing recordAssigned Strict on zcode (GLM-5.3-Flash) under experiment |
Omni ReviewBot attempt recordReview attempt ended as failed (step 'review' (agent.review_diff): unhandled error: RuntimeError: zcode exited 1 without a result event: statusCode: undefined } Error: Turn execution failed (traceId: 5a1071e7-0d2e-4533-9cbb-fe1102492902) — check |
Omni ReviewBot attempt recordReview attempt ended as failed (step 'review' (agent.review_diff): unhandled error: RuntimeError: zcode exited 1 without a result event: statusCode: undefined } Error: Turn execution failed (traceId: 9cbe961d-11d6-4d98-ad50-598b571ec307) — check |
Omni ReviewBot attempt recordReview attempt ended as failed (step 'review' (agent.review_diff): unhandled error: RuntimeError: zcode exited 1 without a result event: statusCode: undefined } Error: Turn execution failed (traceId: bd886b8a-b34f-45fa-9a87-cab3f9342fed) — check |
vllm-omni-review-bot
left a comment
There was a problem hiding this comment.
Omni ReviewBot review
2 actionable finding(s).
CI at
b1c608df5616(2026-10-10T08:03:51.510085+00:00): verification incomplete; required-check status is unknown. Observed Buildkite:buildkite/vllm-omni(passed),buildkite/vllm-omni-amd-ci(failed),buildkite/vllm-omni-npu-ci(failed), and 1 more.
Note: The assigned review arm
strict/zcode/GLM-5.3-Flashcould not complete this review, so it was produced by the fallback armdirect/cursor/auto. It is excluded from the routing experiment.
Full review analysis
PR description
This change removes the separate fa3-fwd CUDA requirement and uses the FlashAttention dispatcher already shipped in vLLM. CUDA discovery now binds vLLM's varlen kernel before source-built FA3 or standalone FA2, while optional FA4, AITER, and SDPA stay as platform fallbacks. Ring attention prefers that path: each dense block is packed into varlen sequences, return_softmax_lse=True is set, and the log-sum-exp is restored to (batch, heads, sequence) before the existing ring accumulation.
Change flow
flowchart LR
A["[REMOVED] fa3-fwd CUDA pin"]:::removed --> B["[CHANGED] CUDA FA discovery"]:::changed
B --> C["[NEW] dense-to-varlen LSE adapter"]:::new
C --> D["[CHANGED] ring prefers VLLM_FA"]:::changed
D --> E["[EXISTING] ring (B, H, S) accumulation"]:::existing
classDef existing fill:#e5e7eb,stroke:#6b7280,color:#111827
classDef changed fill:#fef3c7,stroke:#d97706,color:#451a03,stroke-width:2px
classDef new fill:#dcfce7,stroke:#16a34a,color:#052e16,stroke-width:2px
classDef removed fill:#fee2e2,stroke:#dc2626,color:#450a0a,stroke-width:2px
See inline comments below.
🤖 This review was generated by InferMatrix Copilot, an open-source repo-maintenance agent for PR review, CI debugging and issue triage. Try it on your own repo, and ⭐ star it if it helped!
| from fa3_fwd_interface import flash_attn_func as _fa_func | ||
| from fa3_fwd_interface import flash_attn_varlen_func as _fa_varlen | ||
| # Candidate 2: vLLM's maintained FA2/FA3/FA4 dispatcher. | ||
| if flash_attn_varlen_func is None: |
There was a problem hiding this comment.
[P2] Default CUDA dense attention drops fa_deterministic
Evidence and suggested fix
On a normal CUDA build, discovery now imports vllm.vllm_flash_attn.flash_attn_varlen_func and stops. It never assigns flash_attn_func, and the later source-FA3/FA2 candidates run only when that varlen symbol is still missing. FlashAttentionImpl.forward_cuda passes deterministic=True only when flash_attn_func is set; otherwise unmasked dense attention falls through to _forward_varlen_dense, which omits deterministic and emits fa_deterministic=True is ignored on the dense-varlen-fallback path. Previously the pinned fa3-fwd package filled flash_attn_func, so this opt-in reached the dense kernel. The new vllm_flash_attn_varlen_with_lse helper already forwards deterministic, but the ordinary backend does not call it. Forward self.fa_deterministic on the dense varlen call, or bind a dense wrapper that still honors the flag.
| fa._choose_vllm_flash_attn_version(9, "4", frozenset((2, 3))) | ||
|
|
||
|
|
||
| def test_vllm_dense_adapter_builds_varlen_metadata_and_restores_lse(monkeypatch): |
There was a problem hiding this comment.
[P2] L1 layout test is not selected by the CPU diffusion job
Evidence and suggested fix
test_vllm_dense_adapter_builds_varlen_metadata_and_restores_lse has no cpu marker, unlike the version-selection tests above it. The ready-pipeline step Simple · Diffusion Test runs pytest -sv tests/diffusion -m 'core_model and cpu', so this layout contract is not collected there. The single-GPU numerical test is marked for one CUDA card and can be selected by Diffusion · FlashAttention Test (tests/diffusion/attention/ -m 'core_model and cuda and L4 and cards_1'). The two-GPU ring test requests num_cards=2; that same attention step requires cards_1, and the materialized cards_2 steps name test_ulysses_uaa.py, test_attention_sp.py, or tests/diffusion/distributed/ rather than test_ring_vllm_flash_attn.py. tests/helpers/mark.py is not in this checkout, so the exact generated markers cannot be confirmed. Mark the CPU test cpu, and point a two-card attention step at the ring parity test.
…-fwd removal vllm-project#7735 moved vLLM's bundled dispatcher ahead of the standalone FA packages in fa.py. On Hopper the dispatcher now resolves flash_attn_varlen_func with its default fa_version=2, silently downgrading every dense diffusion attention from FA3 to FA2. FA2 runs 1.74x slower at MiniMax-H3's attention shapes (46.1s vs 33.6s e2e on the t2v benchmark) and shifts numerics enough to drop the marginal I2VA accuracy test below its 34.0 dB PSNR threshold (33.937, identical to the nightly failure). Track vLLM-dispatcher resolutions and reuse the ring-path version chooser (resolve_vllm_flash_attn_version) to request FA3 on SM90 / FA4 on Blackwell at the three FlashAttentionImpl call sites. Standalone FA2/FA3/FA4 resolutions keep their own behavior. Fixes the perf regression in vllm-project#9090 and the accuracy failure in vllm-project#9085. Validated on H200 (4x SM90, vLLM 0.31.0): I2VA PSNR 33.936976 -> 35.663804 (threshold 34.0); t2v e2e 46122 -> 33642 ms (-27.1%); test_flash_attn.py 55 passed (3 new contract tests). Signed-off-by: GUOGUO <xwdong1998@163.com>
Purpose
Remove the
fa3-fwdpackage dependency and use the FlashAttention implementation already maintained and shipped by vLLM.This is the full-removal alternative to #7671, following the direction explored in #3340. If this approach lands, the packaging-only fallback in #7671 is unnecessary.
vLLM-Omni needed the separate package because its ring-attention path requires each block's log-sum-exp (LSE) for numerically stable accumulation and called
fa3_fwd_interface._flash_attn_forwarddirectly. Core vLLM does not need that package: its maintainedvllm.vllm_flash_attndispatcher already ships compatible FA2/FA3/FA4 kernels and can return LSE from its public varlen wrapper.Changes
fa3-fwd==0.0.3from the CUDA requirements;fa3_fwd_interfacediscovery and architecture-version handling;vllm.vllm_flash_attnfor ordinary CUDA FlashAttention dispatch;(B, H, S)LSE contract;The adapter flattens each dense batch into packed sequences, constructs cumulative sequence lengths, calls vLLM with
return_softmax_lse=True, and restores both output and LSE layouts before ring accumulation.Test Plan
vLLM Version:
v0.29.0(the CUDA image base)vLLM-Omni base commit:
eb1abbadf832c625a9560cb6e0142d2cec4998cegit diff --check.Test Result
torch.cudachecks.git diff --checkpassed.AI assistance: Codex helped trace the dependency and ring-LSE contracts, implement the vLLM-backed adapter and selection path, add focused tests, run static validation, and draft this description. I reviewed the resulting change and evidence.