-
Notifications
You must be signed in to change notification settings - Fork 218
[TRITON] fix sink_attn error when causal=true #1837
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -848,7 +848,7 @@ def bwd_kernel_causal( # grid = (tl.cdiv(max_seqlen_q // BLOCK_M2), batch, nhea | |
| else: | ||
| descale_q, descale_k, descale_v, descale_do = 1.0, 1.0, 1.0, 1.0 | ||
|
|
||
| MASK_BLOCK_M1: tl.constexpr = BLOCK_M1 // BLK_SLICE_FACTOR | ||
| MASK_BLOCK_M1: tl.constexpr = BLOCK_M1 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the proper way of doing this change is by setting
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| # bound the masked operation to q len so it does not have to wast cycles | ||
| len_m = min(len_m, seqlen_q) | ||
| num_steps = tl.cdiv(len_m, MASK_BLOCK_M1) | ||
|
|
@@ -1069,7 +1069,7 @@ def bwd_kernel_causal( # grid = (tl.cdiv(max_seqlen_q // BLOCK_M2), batch, nhea | |
| dsink = tl.sum(-psink * delta[:, None]) | ||
| tl.atomic_add(DSink + hqid, dsink, sem="relaxed") | ||
|
|
||
| MASK_BLOCK_N2: tl.constexpr = BLOCK_N2 // BLK_SLICE_FACTOR | ||
| MASK_BLOCK_N2: tl.constexpr = BLOCK_N2 | ||
| # start can only be 0 at minimum | ||
| start_n = max(end_n - BLOCK_M2, 0) | ||
| num_steps = tl.cdiv(end_n - start_n, MASK_BLOCK_N2) | ||
|
|
||
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.
Corrected spelling of 'casual' to 'causal' in PR title and description. The PR metadata contains 'casual=true' which should be 'causal=true'.