[PyT] Disable FA3 for training when head_dim_qk != head_dim_v - #3490
Open
yuweih205 wants to merge 2 commits into
Open
[PyT] Disable FA3 for training when head_dim_qk != head_dim_v#3490yuweih205 wants to merge 2 commits into
yuweih205 wants to merge 2 commits into
Conversation
Contributor
|
Signed-off-by: hyw <109567717+yuweih205@users.noreply.github.com>
Signed-off-by: HuangYuwei <yuweih205@gmail.com>
yuweih205
force-pushed
the
fa3-mismatched-dims-training
branch
from
September 10, 2026 08:08
7bd16d8 to
d471a85
Compare
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.
Description
Fixes #3481
_is_fa3_supported()matches FA3's forward support matrix, so mismatched-head-dim configs (e.g.head_dim_qk=192 / head_dim_v=128) pass backend selection in training mode — but FA3 has no backward for mismatched head dims (Dao-AILab/flash-attention#1487), so the forward succeeds and the backward crashes with an opaqueRuntimeError: out must have shape ...fromflash_attn_3_cuda.bwd.Add a selection-time filter disabling FA3 for training when
head_dim_qk != head_dim_v, following the existing filter style.Verified on H200 (TE 2.10, torch 2.9.1+cu130, flash_attn_3 3.0.0b1), with
NVTE_FUSED_ATTN=0to force the FA3 path:_is_fa3_supported): previously crashed in backward; with the fix, selection falls back to a viable backend and forward+backward complete(192, 128)and(64, 512)in both training and inference (4 cases total), asserting training fallback while retaining FA3 for inferenceType of change
Checklist: