Skip to content
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

g2s K tensor when handling padding in the seq_k, clear it rather than keeping the default SMEM values. #1395

Open
NVIDIA-JerryChen opened this issue Dec 18, 2024 · 0 comments

Comments

@NVIDIA-JerryChen
Copy link

https://github.com/Dao-AILab/flash-attention/blob/main/csrc/flash_attn/src/flash_fwd_kernel.h#L267-L269
should be modified to
flash::copy<Is_even_MN, Is_even_K, /Clear_OOB_MN=/true>(
gmem_tiled_copy_QKV, tKgK(_, _, _, n_block), tKsK, tKVcKV, tKVpKV,
binfo.actual_seqlen_k - n_block * kBlockN);

clear only V is unsafe because NAN*0 = NAN. In IEEE754 standard, NaN has propagation.
If the default value of SMEM is NAN, it will result in the output O also containing NAN values.
this issue occurred during my saturation test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant