Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
flash-attention
Commits
31920dda
Commit
31920dda
authored
Aug 29, 2023
by
Tri Dao
Browse files
Fix typo with lse_max == -INFINITY
parent
8a326bbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
csrc/flash_attn/src/flash_fwd_kernel.h
csrc/flash_attn/src/flash_fwd_kernel.h
+1
-1
No files found.
csrc/flash_attn/src/flash_fwd_kernel.h
View file @
31920dda
...
...
@@ -1118,7 +1118,7 @@ inline __device__ void combine_attn_seqk_parallel(const Params ¶ms) {
for
(
int
l
=
1
;
l
<
kNLsePerThread
;
++
l
)
{
lse_max
=
max
(
lse_max
,
lse_accum
(
l
));
}
MaxOp
<
float
>
max_op
;
lse_max
=
Allreduce
<
kRowsPerLoadTranspose
>::
run
(
lse_max
,
max_op
);
lse_max
=
=
lse_max
==
-
INFINITY
?
0.0
f
:
lse_max
;
// In case all local LSEs are -inf
lse_max
=
lse_max
==
-
INFINITY
?
0.0
f
:
lse_max
;
// In case all local LSEs are -inf
float
lse_sum
=
expf
(
lse_accum
(
0
)
-
lse_max
);
#pragma unroll
for
(
int
l
=
1
;
l
<
kNLsePerThread
;
++
l
)
{
lse_sum
+=
expf
(
lse_accum
(
l
)
-
lse_max
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment