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
bdcae547
Commit
bdcae547
authored
Jan 22, 2024
by
Tri Dao
Browse files
[LayerNorm] Don't exit early in the backward pass (fix #781)
parent
36bc29ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
2 deletions
+1
-2
flash_attn/ops/triton/layer_norm.py
flash_attn/ops/triton/layer_norm.py
+1
-2
No files found.
flash_attn/ops/triton/layer_norm.py
View file @
bdcae547
...
@@ -452,8 +452,7 @@ def _layer_norm_bwd_kernel(
...
@@ -452,8 +452,7 @@ def _layer_norm_bwd_kernel(
# Map the program id to the elements of X, DX, and DY it should compute.
# Map the program id to the elements of X, DX, and DY it should compute.
row_block_id
=
tl
.
program_id
(
0
)
row_block_id
=
tl
.
program_id
(
0
)
row_start
=
row_block_id
*
rows_per_program
row_start
=
row_block_id
*
rows_per_program
if
row_start
>=
M
:
# Do not early exit if row_start >= M, because we need to write DW and DB
return
cols
=
tl
.
arange
(
0
,
BLOCK_N
)
cols
=
tl
.
arange
(
0
,
BLOCK_N
)
mask
=
cols
<
N
mask
=
cols
<
N
X
+=
row_start
*
stride_x_row
X
+=
row_start
*
stride_x_row
...
...
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