Open
Conversation
ipanfilo
reviewed
May 2, 2025
| else: | ||
| if _flash_attn_version_required <= _flash_attn_version <= _flash_attn_max_version: | ||
| from flash_attn_2_cuda import varlen_bwd as flash_attn_cuda_bwd | ||
| if IS_HIP_EXTENSION and (os.getenv("FLASH_ATTENTION_TRITON_AMD_ENABLE", "FALSE")=="TRUE"): |
Collaborator
There was a problem hiding this comment.
It looks like flash_attn_cuda_bwd is only used on NV platform and only when explicitly requested by user. So this changes is not needed.
Collaborator
Author
There was a problem hiding this comment.
It's used in our version as well:
Collaborator
There was a problem hiding this comment.
It exists in our version but not used. All its usages are under use_FAv2_bwd condition
Collaborator
Author
There was a problem hiding this comment.
the use_FAv2_bwd is a parameter in the forward function of class FusedAttnFunc_qkvpacked, FusedAttnFunc_kvpacked and FusedAttnFunc, which user could set to true I guess? See
as an example. Then this flash_attn_cuda_bwd could be used somewhere else by customers
Collaborator
There was a problem hiding this comment.
In normal code-path use_FAv2_bwd is got from NVTE_FUSED_ATTN_USE_FAv2_BWD at
and it is always set to False for AMD devices there and later at
Indeed, users may call FusedAttnFunc* classes directly which will bypass a lot of other logic and checks so I wouldn't worry about this parameter specifically. For sanity, this feature may be explicitly disabled for ROCm but anyway keeping things as-is seems less evil than rely on independent project env variables.
Collaborator
|
@wangye805 Could you rebase? |
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
Enable triton-based flash-attn in TE
Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: