Repository navigation
Add CMake guards to allow building just IREE's runtime - #4279
Conversation
… building them directly, rather than in the files that use them
ScottTodd
left a comment
There was a problem hiding this comment.
lgtm once Bazel builds are green again, see comment
|
|
||
| iree_cmake_extra_content( | ||
| content = """ | ||
| if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS}) |
There was a problem hiding this comment.
Drop the indent. It makes the indenting in the cmake file weird. I suggested textwrap.dedent to Scott when this was introduced for this reason
There was a problem hiding this comment.
Uh not sure how that will work with the newlines. If it works, then great :-) I was thinking like https://github.com/google/iree/blob/4ca12072652be6785075e8e6e48052347f9de784/iree/hal/vulkan/BUILD#L26-L30 The main thing is just not having the if be indented weird. in the CMake file.
There was a problem hiding this comment.
Wait I just read this again and now I see that GitHub just makes everything look indented 2 spaces... I have it backwards
The thing that is weird is that the stuff inside the if block in the cmake file isn't indented, which makes it hard to track. I don't see an easy way to fix that, so just ignore me.
There was a problem hiding this comment.
One way around this is to make this a guard statement instead and put all the compiler stuff at the bottom. Then this would be
| if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS}) | |
| if(NOT ${IREE_BUILD_COMPILER}) | |
| return() | |
| endif() |
There was a problem hiding this comment.
I switched to this for all files except iree/vm/BUILD, where it was a bit more complicated
|
Really great to finally see this dependency broken. Thanks Jenni! |
| # ], | ||
| # ) | ||
|
|
||
| iree_cmake_extra_content( |
There was a problem hiding this comment.
(not here, but in the future) would be nice to have explicit helpers for this - like iree_cmake_if("${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS}") / iree_cmake_endif()
| PUBLIC | ||
| ) | ||
|
|
||
| if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS}) |
There was a problem hiding this comment.
IREE_BUILD_TESTS is redundant here. All tests are already gated on that
|
|
||
| iree_cmake_extra_content( | ||
| content = """ | ||
| if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS}) |
There was a problem hiding this comment.
Instead of IREE_BUILD_TESTS, you can add testonly = True to the testonly rule. Then it will only get built if tests are enabled because of https://github.com/google/iree/blob/4ca12072652be6785075e8e6e48052347f9de784/build_tools/cmake/iree_bytecode_module.cmake#L46-L48
There was a problem hiding this comment.
I believe testonly = True isn't currently supported for iree_bytecode_module in bazel_to_cmake, so can I leave the check for IREE_BUILD_TESTS for now and update this and bazel_to_cmake in a followup PR?
There was a problem hiding this comment.
Ah you're right. SG, thanks :-)
|
|
||
| iree_cmake_extra_content( | ||
| content = """ | ||
| if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS}) |
There was a problem hiding this comment.
One way around this is to make this a guard statement instead and put all the compiler stuff at the bottom. Then this would be
| if(${IREE_BUILD_COMPILER} AND ${IREE_BUILD_TESTS}) | |
| if(NOT ${IREE_BUILD_COMPILER}) | |
| return() | |
| endif() |
|
Want to go ahead and merge this? The clang-format issue is not you (fixed in #4302), but not worth rebasing/merging to pick that up. As someone currently testing the cmake runtime build and having to build all of LLVM for no reason, would love to see this go in :-D |
) Follow-up to #4279, aiming to fix [failing benchmarks](https://buildkite.com/iree/iree-android-benchmark/builds/1177) and re-enable skipped tests: [before](https://buildkite.com/iree/iree-android-arm64-v8a/builds/3351), [after](https://buildkite.com/iree/iree-android-arm64-v8a/builds/3352).

The runtime can be built by setting IREE_BUILD_COMPILER=OFF and IREE_ENABLE_MLIR=OFF. Fixes #4155