[TLX] Update TLX tutorials to support causal for fwd#692
Closed
njriasan wants to merge 4 commits into
Closed
Conversation
njriasan
commented
Nov 24, 2025
| import triton | ||
| import triton.language as tl | ||
| import triton.language.extra.tlx as tlx | ||
| from triton.tools.tensor_descriptor import TensorDescriptor |
Contributor
Author
There was a problem hiding this comment.
A lot of this is automatic formatting from pre-commit + vscode. Personally I think we should keep it so this doesn't recur when we update this again for H-DIM 64.
| p = p.to(ref_dtype) | ||
| # p = torch.exp(p) | ||
| ref_out = torch.matmul(p, v).half() | ||
| ref_out = torch.nn.functional.scaled_dot_product_attention(q, k, v, scale=sm_scale, is_causal=causal) |
Contributor
Author
There was a problem hiding this comment.
Borrowed this from the gluon implementation. Seems to be more robust.
Contributor
htyu
approved these changes
Nov 24, 2025
Contributor
htyu
left a comment
There was a problem hiding this comment.
Looks great, thanks for working on this!
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the implementations to all have a causal variant.