Skip to content

WIP: TritonBench for FA4 #296

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
20 changes: 20 additions & 0 deletions tritonbench/operators/blackwell_attentions/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@
except (ImportError, IOError, AttributeError):
HAS_FLASH_V2 = False

# [Optional] CuTe
try:
import flash_attn.cute.interface as facute
HAS_FLASH_CUTE = True
except (ImportError, IOError, AttributeError):
HAS_FLASH_CUTE = False

# [Optional] xformers backend
try:
import xformers # @manual=//fair/xformers:xformers
Expand Down Expand Up @@ -266,6 +273,19 @@ def sdpa_flash_attention(q, k, v):
v,
)

@register_benchmark(enabled=(IS_B200 and HAS_FLASH_CUTE), label=f"cutedsl-blackwell", fwd_only=True)
def cutedsl_blackwell(
self,
q: torch.Tensor,
k: torch.Tensor,
v: torch.Tensor) -> Callable:

# [B, H, S, D] -> [B, S, H, D]
q = q.transpose(1, 2).contiguous()
k = k.transpose(1, 2).contiguous()
v = v.transpose(1, 2).contiguous()
return lambda: facute.flash_attn_func(q, k, v, self.sm_scale, self.causal)

@register_benchmark()
def flex_attention(self, q, k, v):
from torch.nn.attention.flex_attention import create_block_mask, flex_attention
Expand Down
Loading