-
Notifications
You must be signed in to change notification settings - Fork 54
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
Introduce TritonStructured dialect and triton-to-structured pass #82
Introduce TritonStructured dialect and triton-to-structured pass #82
Conversation
Thank you @haishanzzzz, I'll start taking a look :) |
@microsoft-github-policy-service agree company="Meta" |
@haishanzzzz please , can you tell me more about this:
|
This is technically not related to this PR, but if I just do
Is this what you see too? |
include/triton-shared/Dialect/TritonStructured/IR/TritonStructuredDialect.td
Show resolved
Hide resolved
include/triton-shared/Dialect/TritonStructured/IR/TritonStructuredDialect.td
Outdated
Show resolved
Hide resolved
@haishanzzzz I reviewed the changes and left some comments, overall, I think the approach is good and makes the code much simpler. Love it. |
@haishanzzzz Would you mind updating the description with the decision around keeping |
Updated the description to include more info on relying on |
@nhat-nguyen @manbearian Please let me know if there are other things I can do before closing this PR. |
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.
@haishanzzzz This looks good to me. Thank you for addressing all the comments. You just need to update this with the main branch, once done we will be able to land this.
* Introduce TritonStructured dialect * Updated mask analysis * Update OpFoldResultUtils * triton-to-structured pass * LIT tests * Address review comments * Revert header name change * Remove copied version of mask analysis
This PR introduces TritonStructured dialect and
triton-to-structured
pass. Please see #81 for background.This PR is broken into 5 commits:
tts.make_tptr
,tts.load
, andtts.store
triton-to-structured
passA few notes:
triton-to-structured
does not useDialectConversion
but rather manually walks the IR to perform rewriting. The reason is this pass does not try to legalize Triton operations (in fact it allows them to live after the pass) but rather opportunistically rewrite certain ops if the analysis succeeds. Legality marking inDialectConversion
does not provide a way to set certain instances of an op as legal, which makes it a poor fit for our purpose.triton-to-linalg
,triton-to-structured
is more robust when encountering IRs that it cannot analyze. Specifically, itemitRemark
when analysis fails,emitWarning
when it may (although very unlikely) produce wrong results, and only fail when a logic error is detected. This graceful failure can be demonstrated by manually rerunningwraparound_unsupported_add_offset.mlir
.triton-to-linalg
. Unrelated tests are removed and output is manually examined to verify correctness (except for those ones generated for Triton tutorials).tt.make_tptr
will only be used to handle tensor of pointers.tt.addptr
will be left in the output of the pass. They should be converted to memref operations instructured-to-memref
.A main follow up to this PR is to get consensus on how we'd like to handle block pointers in this pass.
There are a few other misc. items on the wishlist for the new code:
tt.reduce
make--remove-dead-values
pass fail