The calculation of scores_max in the flash_attn example #948
Unanswered
chenghuaWang
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the FA2 algorithm, there is a step that updates$max_{new}$ , which requires taking the element-wise maximum between the current block's max and the previous $max_{new}$ .
However, in the code at
tilelang/examples/flash_attention/example_gqa_fwd_bshd.py
Line 116 in 7fb0677
It seems that the operation
scores_max = max(scores_max_prev, scores_max)
is not actually performed due toT.fill
. Could you clarify where my understanding might be incorrect?Additionally, would
T.fill(scores_max, -T.infinity(accum_dtype))
be equivalent to settingclear=True
inT.reduce_max
?Beta Was this translation helpful? Give feedback.
All reactions