Skip to content

CMake support for iree::compiler::Dialect - #165

Closed
marbre wants to merge 34 commits into
iree-org:masterfrom
marbre:cmake-4
Closed

marbre wants to merge 34 commits into
iree-org:masterfrom
marbre:cmake-4

Conversation

@marbre

@marbre marbre commented Nov 29, 2019

Copy link
Copy Markdown
Member

In the Bazel configuration iree-translate depends on "//iree/compiler/Dialect/VM/Target/Bytecode". This further pulls in several other dependencies. Right now, the build fails witt

[ 96%] Building VMEnums.h.inc...
mlir-tblgen: Unknown command line argument '-gen-iree-vm-op-encoder-defs'.  Try: '../../../../../third_party/llvm-project/llvm/bin/mlir-tblgen --help'
mlir-tblgen: Did you mean '--gen-op-interface-defs'?
make[2]: *** [iree/compiler/Dialect/VM/IR/CMakeFiles/iree_compiler_Dialect_VM_IR_IR.dir/build.make:72: iree/compiler/Dialect/VM/IR/VMOpEncoder.cpp.inc] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:29821: iree/compiler/Dialect/VM/IR/CMakeFiles/iree_compiler_Dialect_VM_IR_IR.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

This is because iree-tblgen has to be run and not mlir-tblgen. Within this context I noticed the comment "Runs iree-tablegen to produce some artifacts." in iree_tablegen_library. So is there a way to exec iree-tblgen instead of mlir-tblgen which I have overlooked or is the comment wrong? If the latter is true, do we need another iree_tablegen_library function which really runs iree-tblgen or do somebody sees a simple way how to fix this?

@googlebot

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot

Copy link
Copy Markdown

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@benvanik

benvanik commented Dec 2, 2019

Copy link
Copy Markdown
Collaborator

Ah yes, it looks like we need to define IREE_TABLEGEN_EXE similar to how MLIR_TABLEGEN_EXE is defined here:
https://github.com/tensorflow/mlir/blob/master/CMakeLists.txt#L4

The LLVM cmake tablegen(XXX, ) macro then automatically looks for XXX_TABLEGEN_EXE. So we could add an argument to iree_tablegen_library that allows setting XXX ("TABLEGEN_PROJECT" or something here (instead of the hardcoded 'MLIR'):
https://github.com/google/iree/blob/master/build_tools/cmake/iree_tablegen_library.cmake#L44

@marbre

marbre commented Dec 2, 2019

Copy link
Copy Markdown
Member Author

Yes, seems that somewhere near https://github.com/google/iree/blob/0d41620fbe415d5fa3b492a804653c9dea9b8fd5/build_tools/cmake/iree_copts.cmake#L130 would be the right place. Defining an additional TABLEGEN keyword in build_tools/cmake/iree_tablegen_library.cmake set to MLIR by default and otherwise to IREE is straight forward. However, I was not yet able to build iree-tblgen. For mlir-tblgen an add_tablegen() function, provided by llvm-project, is used. However, I could not yet figure out how to use it within IREE the correct way.

@marbre

marbre commented Dec 4, 2019

Copy link
Copy Markdown
Member Author

@benvanik
Should I add

set(IREE_TABLEGEN_EXE iree-tblgen)
set(IREE_BINARY_DIR ${CMAKE_BINARY_DIR}/iree/tools)

blow https://github.com/google/iree/blob/0d41620fbe415d5fa3b492a804653c9dea9b8fd5/build_tools/cmake/iree_copts.cmake#L133
or do you see a more appropriate location?

@marbre

marbre commented Dec 5, 2019

Copy link
Copy Markdown
Member Author

Rebased onto latest master and added CMakeLists for Flow and HAL dialect.

@marbre

marbre commented Dec 10, 2019

Copy link
Copy Markdown
Member Author

@googlebot Rescan

@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot

Copy link
Copy Markdown

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

benvanik
benvanik previously approved these changes Dec 11, 2019
@marbre

marbre commented Dec 11, 2019

Copy link
Copy Markdown
Member Author

@benvanik Sorry, didn't noticed what this PR was already approved and added further commits to fix the review requests. Therefore a re-review is required.
For the future, if already reviewed and marked as "ready to pull", should I add small commits like in this case to the ongoing PR or open a new PR?

@ScottTodd

Copy link
Copy Markdown
Member

Commits to address review comments should generally be added to the ongoing PR.

We use the "ready to pull" label to attempt an automated merge after a set of internal checks and approvals. In this case, some of those (very opinionated...) internal checks failed, so we needed those small changes in order to complete the merge.

The approval in GitHub is mostly cosmetic for this project at the moment - we can merge PRs without GitHub approval and don't always give explicit approval for all commits.

@ScottTodd

Copy link
Copy Markdown
Member

By the way, if any part of that process is confusing, please feel free to point out areas where we can improve.

We should really update our CONTRIBUTING.md, possibly taking some parts from TensorFlow's (or some other projects with similar setups)

@marbre
marbre deleted the cmake-4 branch January 6, 2020 09:41
stellaraccident pushed a commit that referenced this pull request Sep 24, 2023
We're in a run of incompatible jaxlib versions due to a known stablehlo
versioning issue. Should clear after the next integrate or two.

In the meantime, rolling IREE to latest on its own.

* iree: 5b60156 Remove platform specific logic from iree_tools_tf
(#13740) (Wed May 31 09:03:05 2023 +0200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants