Skip to content

Enable building iree-tblgen via CMake - #185

Closed
marbre wants to merge 3 commits into
iree-org:masterfrom
marbre:cmake-tblgen
Closed

marbre wants to merge 3 commits into
iree-org:masterfrom
marbre:cmake-tblgen

Conversation

@marbre

@marbre marbre commented Dec 12, 2019

Copy link
Copy Markdown
Member

This closes #182.

Comment thread iree/tools/CMakeLists.txt
iree-tblgen
SRCS
"${IREE_ROOT_DIR}/third_party/mlir/tools/mlir-tblgen/mlir-tblgen.cpp"
"${IREE_ROOT_DIR}/iree/compiler/Dialect/VM/Tools/VMOpEncoderGen.cpp"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this depend on iree::compiler::Dialect::VM::Tools instead of pulling in these SRCS and DEPS directly?

It should end up looking close to the Bazel BUILD file: https://github.com/google/iree/blob/baa78198aea49c0fbd0c37ae6fb8514deb9bd37f/iree/tools/BUILD#L105-L116

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially linked against iree::compiler::Dialect::VM::Tools, but somehow that wasn't sufficient to enable the necessary command line arguments like -gen-iree-vm-op-encoder-defs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, as iree::compiler::Dialect::VM::Tools is marked ALWAYSLINK, my fix for #190 should work (the additional arguments will appear). If this is needed until my work there is ready and merged, we could merge this as-is and I can make the switch as part of my change.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

set(LLVM_INCLUDE_BENCHMARKS OFF)
set(LLVM_APPEND_VC_REV OFF)
set(LLVM_ENABLE_IDE ON)
set(LLVM_ENABLE_RTTI ON)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line I'm not sure about (and wanted @stellaraccident 's feedback on), since the Google style guide in general disallows RTTI: https://google.github.io/styleguide/cppguide.html#Run-Time_Type_Information__RTTI_ . If we need it within LLVM (which the issue comments pointed out) then I guess it's fine?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with it for now -- that part of the style guide must bow to pragmatism, especially with respect to third party integrations.

With that said, it isn't clear to me why this is needed (based on the errors, I believe that it is, but I think it needs more root cause analysis). Can you please create an issue specifically for debugging this so we don't lose track? It will be substantially easier to root-cause once the build system is generally working, so we should proceed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #202 to follow up.

@ScottTodd
ScottTodd self-requested a review December 17, 2019 21:18
copybara-service Bot pushed a commit that referenced this pull request Dec 17, 2019
With #184, #185, #186 and #187 merged, this enables the build toolchain to compile the examples. Together with the other PRs this nearly enables the compilation of the examples :)

Closes #188

COPYBARA_INTEGRATE_REVIEW=#188 from marbre:cmake-samples 0849a63
PiperOrigin-RevId: 286052836
@marbre
marbre deleted the cmake-tblgen branch December 18, 2019 08:45
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.

Linkage failure when building iree-tblgen with CMake

4 participants