This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] add out of tree version of mlir-opt
AbandonedPublic

Authored by stephenneuendorffer on Feb 19 2020, 1:28 PM.

Details

Reviewers
vchuravy
Summary

This is primarily for testing libMLIR.so

Diff Detail

Event Timeline

stephenneuendorffer edited the summary of this revision. (Show Details)

This is good to have as a test, but I assume that eventually we would want to have the equivalent of LLVM_LINK_LLVM_DYLIB.

This is good to have as a test, but I assume that eventually we would want to have the equivalent of LLVM_LINK_LLVM_DYLIB.

I've gone back and forth. I think it's weird for the 'regular' mlir-opt to include the test dialect. I was thinking that the test dialect should run with a test-mlir-opt
which includes the test dialect in addition to all the normal dialects. (or maybe *only* the test dialect?)

marbre marked an inline comment as done.Mar 26 2020, 8:02 AM
marbre added a subscriber: marbre.
This comment was removed by marbre.

Out of curiosity, no need to call define and registerTestPasses()? Further, calling registerAllDialects() and registerAllPasses() can be skipped? Is that due linking against libMLIR.so?

Out of curiosity, no need to call define and registerTestPasses()? Further, calling registerAllDialects() and registerAllPasses() can be skipped? Is that due linking against libMLIR.so?

No, this is just a little old. Currently, calling registerAllDialects() and registerAllPasses() is required if you want any of the standard stuff. The .cpp code was just a copy of what's in tools/mlir-opt. The critical part of this is the CMakeLists.txt, which was intended as a test for linking against libMLIR.so. If you actually want to build an external project see: https://reviews.llvm.org/D76047

No, this is just a little old. Currently, calling registerAllDialects() and registerAllPasses() is required if you want any of the standard stuff. The .cpp code was just a copy of what's in tools/mlir-opt. The critical part of this is the CMakeLists.txt, which was intended as a test for linking against libMLIR.so. If you actually want to build an external project see: https://reviews.llvm.org/D76047

Thanks for clarifying. I was just surprised and thought I might have missed something. I actually forked the mlir-opt for IREE.

There's now an example of how to build your own opt in Examples/standalone.