Repository navigation
Remove custom CMake cross compilation for Android. - #4584
Conversation
Cross compilation [for Android] is not special. Compiler tools are built on the host and installed (using CMake, Bazel, via vcpkg, via pip, etc.). The runtime and target tests are built for the target, referencing host tools where needed using `IREE_HOST_BINARY_ROOT`.
2765751 to
cbf015b
Compare
antiagainst
left a comment
There was a problem hiding this comment.
Thanks Scott for taking on this! Overall looks awesome to me. I think we need to update https://google.github.io/iree/get-started/cmake-options-and-variables#cross-compilation too.
| ### Configure on Linux | ||
| ### Host configuration | ||
|
|
||
| Build and install at least the compiler tools on your host machine, or install |
There was a problem hiding this comment.
I'd just mention building on host machine for now. We don't have binary releases; we can mention that after having it.
There was a problem hiding this comment.
We do have binary releases through the Python wheels, but they don't yet contain all the relevant compiler tools.
| # Define our own binary target for the CLI, for host builds only. | ||
| # flatcc's `flatcc_cli` target renames itself to `flatcc` or `flatcc_d` | ||
| # depending on the build configuration, so we prefer to just set our own name. | ||
| if(NOT CMAKE_CROSSCOMPILING) |
There was a problem hiding this comment.
Why make this only for host builds?
There was a problem hiding this comment.
Mostly to match how the other CLIs are set up. Some tools may be possible to build for target platforms/architectures, but this consistently uses them from host builds. This can evolve over time, but flatcc was giving me enough trouble already that I just settled for what worked...
Cool, updated that doc too. |
…4605) Attempted fix for failing iree-android-benchmark runs: https://buildkite.com/iree/iree-android-benchmark/builds/1733#3de7c616-bd4d-45d2-8dc1-50a51fbdd047, failing after #4584. cc @hanhanW
* 4da7ac0 Allow benchmark pipeline to be run on presubmit (#4607) * efbf53d Integrate MLIR-EmitC at iml130/mlir-emitc@4e501d8 (#4610) * 9cdd378 Revert removing explicit linker path in compile_android_modules.sh. (#4605) * 7ed1872 Merge pull request #4601 * 4e1a69b Remove custom CMake cross compilation for Android. (#4584) * 38210b5 Merge branch 'main' into google-to-main * 7defc33 Update third_party/ruy and use its own new CMakeLists.txt. (#4564) * 71c6802 Integrate MLIR-EmitC at iml130/mlir-emitc@4e501d8 (#4593) * 7e4dd01 E2E implementation of all remaining fft types (#4585) * 53fcde4 Merge google -> main (#4588) COPYBARA_INTEGRATE_REVIEW=#4614 from NatashaKnk:main-to-google 4da7ac0 PiperOrigin-RevId: 353949105
* 4da7ac0 Allow benchmark pipeline to be run on presubmit (#4607) * efbf53d Integrate MLIR-EmitC at iml130/mlir-emitc@4e501d8 (#4610) * 9cdd378 Revert removing explicit linker path in compile_android_modules.sh. (#4605) * 7ed1872 Merge pull request #4601 * 4e1a69b Remove custom CMake cross compilation for Android. (#4584) * 38210b5 Merge branch 'main' into google-to-main * 7defc33 Update third_party/ruy and use its own new CMakeLists.txt. (#4564) * 71c6802 Integrate MLIR-EmitC at iml130/mlir-emitc@4e501d8 (#4593) * 7e4dd01 E2E implementation of all remaining fft types (#4585) * 53fcde4 Merge google -> main (#4588) COPYBARA_INTEGRATE_REVIEW=#4614 from NatashaKnk:main-to-google 4da7ac0 PiperOrigin-RevId: 353949105
I misconfigured this as part of #4584, leading to issues spotted on #4617. The flatcc cli is still required for the runtime, which is what I originally filed that issue for, but compiler tools like `iree-translate` should not be. See also https://github.com/google/iree/blob/7d0108f0d565956c51c446dd52062fa1e50ca4e3/build_tools/cmake/iree_lit_test.cmake#L39-L43
Rather than having CMake invoke Bazel itself, require that the necessary binaries be built prior to running CMake and then import them. This is similar to what #4584 did in the Android build and has similar advantages: the user can get these binaries in a variety of ways: building with their chosen config (e.g. with local or remote caching), installing prebuilt binaries, etc. It also is significantly more clear what's going on IMO. Having CMake invoke Bazel has caused a fair amount of confusion. Incidentally, I'm pretty sure this increases test coverage by enabling TF tests that were apparently not getting run. Tested: In addition to the CI, ran all the release distribution commands locally and confirmed they still exited successfully.

Cross compilation [for Android] is not special. Compiler tools are built on the host and installed (using CMake, Bazel, via vcpkg,
via pip, etc.). The runtime and target tests are built for the target, referencing host tools where needed using
IREE_HOST_BINARY_ROOT. Some parts of the project only build or are only useful on the host, so some configuration like settingIREE_BUILD_COMPILER=OFFis still useful.This removes our custom CMake code and updates all of our scripts and docs to invoke CMake in two explicit steps: once for the host and once for the target.
Fixes #4323.
Fixes #4520.
Fixes #2494 (tentatively).
Helps with #3843.