Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the use_fused_attention filtering #81

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions transformer_engine/pytorch/attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -4897,9 +4897,6 @@ def forward(
use_unfused_attention = True

if IS_HIP_EXTENSION:
#TODO: rocm does not support fp8 fused attn
if self.fp8:
use_fused_attention = False
#TODO: add back once rocm flash-attn is available
use_flash_attention = False

Expand Down Expand Up @@ -4976,7 +4973,12 @@ def forward(
"Disabling UnfusedDotProductAttention as it does not support FP8 execution."
)
use_unfused_attention = False

if IS_HIP_EXTENSION and use_fused_attention and self.fp8 and self.fp8_meta["recipe"].fp8_dpa:
self.logger.debug(
"Disabling ROCm fused attention as it does not support FP8 execution."
)
use_fused_attention = False

# Filter: Device and dimensions.
# FAv2 supports head_dim <= 256, and for >192 requires sm80/sm90
# FAv2 requires head_dim % 8 == 0
Expand Down