-
Notifications
You must be signed in to change notification settings - Fork 29
Fix Variable Sequence Length Support for Flash Attention Decode #362
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
base: sycl-develop
Are you sure you want to change the base?
Fix Variable Sequence Length Support for Flash Attention Decode #362
Conversation
examples/sycl/06_pvc_flash_attention/pvc_flash_decode_runner.hpp
Outdated
Show resolved
Hide resolved
test/unit/flash_attention/flash_attention_decode/flash_decode_testbed_3x.hpp
Outdated
Show resolved
Hide resolved
applications/flash_attention_v2/collective/xe_flash_attn_decode_epilogue.hpp
Outdated
Show resolved
Hide resolved
07bc319
to
b5ff4b0
Compare
if constexpr (!is_var_len) { | ||
return params; | ||
} else { | ||
auto [batch, num_heads_q, num_heads_kv, seq_len_qo, seq_len_kv, seq_len_kv_cache, head_size_qk, head_size_vo] = problem_shape; | ||
auto [batch, num_heads_q, num_heads_kv, seq_len_qo, seq_len_kv, seq_len_kv_cache, head_size_qk, head_size_vo] = logical_problem_shape; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto [batch, num_heads_q, num_heads_kv, seq_len_qo, seq_len_kv, seq_len_kv_cache, head_size_qk, head_size_vo] = logical_problem_shape; | |
auto [num_heads_q, num_heads_kv, seq_len_qo, seq_len_kv, seq_len_kv_cache, head_size_qk, head_size_vo] = select<1, 2, 3, 4, 5, 6, 7>logical_problem_shape; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logical problem shape and problem shape holding a lot of duplicate inputs unnecessarily which takes up register space. The logical problem shape only need to hold shape<int, int, int>
for seq_len_qo, seq_len_kv, seq_len_kv_cache
the remaining is already provided in the problem shape
This PR fixes the variable sequence length support for Flash Attention Decode. It also fixes the causal masking on device code and matches the verification with the one for prefill along with the flops and gbps calculation.