Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion flash_attn/cute/flash_bwd_sm100.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,12 @@ def __call__(
assert self.dv_dtype.width == 32, "Must accumulate dV in float precision for GQA"

# Assume all strides are divisible by 128 bits except the last stride
# Skip assume for Python ints (e.g., stride=0 from GQA expand)
new_stride = lambda t: (
*(cute.assume(s, divby=128 // t.element_type.width) for s in t.stride[:-1]),
*(
s if isinstance(s, int) else cute.assume(s, divby=128 // t.element_type.width)
for s in t.stride[:-1]
),
t.stride[-1],
)
(
Expand Down
3 changes: 2 additions & 1 deletion flash_attn/cute/flash_fwd_sm100.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ def __call__(
self.v_dtype = mV.element_type
self.o_dtype = mO.element_type
# Assume all strides are divisible by 128 bits except the last stride
# Skip assume for Python ints (e.g., stride=0 from GQA expand)
new_stride = lambda t: (
*(cute.assume(s, divby=128 // t.element_type.width) for s in t.stride[:-1]),
*(s if isinstance(s, int) else cute.assume(s, divby=128 // t.element_type.width) for s in t.stride[:-1]),
t.stride[-1],
)
mQ, mK, mV, mO = [
Expand Down