iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.54k stars 562 forks source link

Bazel build includes unused LLVM targets #16915

Open ScottTodd opened 4 months ago

ScottTodd commented 4 months ago

The upstream LLVM Bazel build has a list of LLVM targets that get unconditionally included in our builds: https://github.com/llvm/llvm-project/blob/009f88fc0e3a036be97ef7b222b90af342bae0b7/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel#L1857-L2189 . These dramatically inflate build times, as compiling these targets is one of the slowest parts of an LLVM source build.

I'm seeing those targets get built with bazel build //tools:iree-opt. Could run some queries to see how the targets are specifically getting pulled in.

In our CMake build we conditionally enable targets based on configuration settings: https://github.com/openxla/iree/blob/d6357b4bbc55c9be36aa3bbe4c55f0fe1c2a010f/build_tools/cmake/iree_llvm.cmake#L128-L130 Bazel could either do the same with configs/selects, or it could at least be trimmed to just the set of targets that we use/support: https://github.com/openxla/iree/blob/d6357b4bbc55c9be36aa3bbe4c55f0fe1c2a010f/compiler/plugins/target/LLVMCPU/LLVMTargetOptions.cpp#L486-L494

benvanik commented 4 months ago

lol sparc and systemz