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

Lowering Through LLVM #26

Merged
merged 26 commits into from
Nov 1, 2023
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
48f8909
add poly_to_llvm test file
j2kun Oct 24, 2023
a54f23f
add starter poly-to-llvm pipeline
j2kun Oct 30, 2023
225952a
add convert-func-to-llvm
j2kun Oct 30, 2023
a2a2500
add arith-to-llvm
j2kun Oct 30, 2023
160df60
add elementwise-to-linalg
j2kun Oct 30, 2023
4bcf28a
add back arith-to-llvm
j2kun Oct 30, 2023
c8fa178
add tensor-to-linalg
j2kun Oct 30, 2023
484edda
add do-nothing linalg-to-loops pass
j2kun Oct 30, 2023
3f536bc
add scf-to-cf and cf-to-llvm passes
j2kun Oct 30, 2023
4f12694
update upstream MLIR commit
j2kun Oct 30, 2023
fa6d030
fix conj pattern broken by mlir update
j2kun Oct 30, 2023
d2e0a72
migrate use of constFoldBinaryOp
j2kun Oct 30, 2023
ae33086
fix conflict caused by new function overload
j2kun Oct 30, 2023
0ea7a77
move arith-to-llvm to the end of the pass
j2kun Oct 30, 2023
cf54412
add one-shot bufferization pass
j2kun Oct 30, 2023
c74ab3e
move func-to-llvm after bufferization, enabling linalg-to-loops
j2kun Oct 30, 2023
a3cee1e
memref-expand-strided-metadata and finalize-memref-to-llvm
j2kun Oct 30, 2023
a9f9456
move func-to-llvm even later
j2kun Oct 30, 2023
24ac606
add canonicalization cleanup
j2kun Oct 30, 2023
e0e6ea3
encode end-to-end compilation pipeline as a test
j2kun Oct 30, 2023
29ead0b
add a poly.eval-specific end-to-end test
j2kun Oct 31, 2023
bc47670
ensure llc uses the same PositionIndependentExecutable option as clang
j2kun Oct 31, 2023
8422826
fix the off-by-one error in the lowering of eval
j2kun Oct 31, 2023
7660ef0
udpate cmake build to use same LLVM commit
j2kun Oct 31, 2023
d39dcdb
update subproject commit
j2kun Oct 31, 2023
1902439
add project_src_dir so tests work with both bazel and cmake
j2kun Oct 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tools/tutorial-opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

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).

Copy link
Owner Author

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.

manager.addPass(mlir::createSCCPPass());
manager.addPass(mlir::createCSEPass());
manager.addPass(mlir::createSymbolDCEPass());
}

int main(int argc, char **argv) {
Expand Down