Skip to content

Commit

Permalink
fix loop cond for num_split=1 (PaddlePaddle#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizhiqing authored Apr 12, 2023
1 parent f0edf24 commit 5ff4bbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion csrc/flash_attn/flash_attn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ bool flash_attn_bwd(
// 1) num_splits == 1
// 2) num_splits == 0 for auto calculation, result to num_splits == 1
// we do allocation for case 2 for simplicity
if (num_splits == 1) {
if (num_splits == 1 && !loop) {
*workspace_size = 0;
} else {
*workspace_size = uint64_t(total_q) * num_heads * head_size * sizeof(float);
Expand Down

0 comments on commit 5ff4bbf

Please sign in to comment.