-
Notifications
You must be signed in to change notification settings - Fork 76
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
Lowering Through LLVM #26
Conversation
40d7c65
to
f2c74c6
Compare
f2c74c6
to
a54f23f
Compare
0df8dd9
to
8422826
Compare
577dbd9
to
7660ef0
Compare
@@ -46,6 +46,12 @@ void polyToLLVMPipelineBuilder(mlir::OpPassManager &manager) { | |||
manager.addPass(mlir::createConvertFuncToLLVMPass()); | |||
manager.addPass(mlir::createFinalizeMemRefToLLVMConversionPass()); | |||
manager.addPass(mlir::createReconcileUnrealizedCastsPass()); | |||
|
|||
// Cleanup | |||
manager.addPass(mlir::createCanonicalizerPass()); |
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.
Is there a particular reason for adding mlir::createCanonicalizerPass()
two times? There's one on the top which I think was for the passes we had created and there's this one which to my understanding should be dealing with the canonicalization of the other upstream passes we added to this pipeline.
I tried to remove the first one and just keep this last one here and the binary still works correctly (just that there is some difference in the instructions being generated in the end).
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.
In general canonicalization must not change the behavior of the program (or else it would be buggy). It will only make things more efficient. Canonicalization patterns apply to particular ops in particular dialects, and higher-level canonicalization patterns tend to remove more unnecessary work than applying lower-level canonicalization patterns, since they capture a larger breadth of the overall program. Running canonicalization after every pass would be even better. But the reason we don't is because we expect it to do nothing, and it adds to the total runtime.
I wanted to add for anyone having the same problem I had while following the tutorial on your website (brilliant job by the way) that in the current version of MLIR, you may have to add the
Pass to the lowering pipeline in order to eliminate all of the bufferization operations. I'm not 100% clear as to why, but it is an issue that I had when lowering my tensors. Thank you for the amazing tutorial! |
No description provided.