-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake build isn't respecting ALWAYSLINK property, breaking static registration #190
Comments
Seeing the same behavior on Windows with MSVC. CMake:
Bazel:
Linking with |
After reading up on CMake and C++ linking, I have something approximating a solution for ALWAYSLINK in our CMake configuration that registers IREE's passes in the The general idea is to put a list of CMake targets between |
Thanks @ScottTodd for tackling this and apologies that I did not took care within the CMake configuration. To recap and make sure I got it, ALWAYSLINK will only be respected within executables build with |
Libraries using Projects depending on IREE (such as to build compiler tools on top of IREE with their own passes included as well) will either need to use Here's a good reference I found for the The last piece that I haven't figured out yet is transitive dependencies, which that reference has |
Progress on #190. iree-translate now includes options such as `-mlir-to-iree-module`, which is needed for building the samples with CMake. Transitive alwayslink dependencies are not supported yet. Tested on Linux and Windows. I haven't tested gcc yet, which may need a branch, see https://github.com/PixarAnimationStudios/USD/blob/4b1162957b2ad219e1635c81de8343be490e41fc/cmake/macros/Private.cmake#L809-L870 Closes #205 COPYBARA_INTEGRATE_REVIEW=#205 from ScottTodd:cmake-alwayslink c661044 PiperOrigin-RevId: 286088548
Keeping this issue open to track handling transitive dependencies, but this is otherwise fixed. |
I still have some trouble with the iree_cc_binary(
NAME
iree-dump-module
SRCS
"dump_module_main.cc"
DEPS
iree::base::file_io
iree::base::flatbuffer_util
iree::base::init
iree::schemas::bytecode_module_def_cc_fbs
flatbuffers
) results in
This caused by depending on |
Hi, I have Internet access again 🎉. I'll have access to a dev machine again on Monday. For those errors, I'd look at |
Thanks for pointing me on that specific snippet. Currently working on some other, CMake related issues, but might have the chance to take a closer look. |
Oh, that failure was actually simpler and the error message was pretty helpful - |
Addresses failure noted at #190 (comment) Adds configuration for `iree-dump-module` for #393 Closes #464 COPYBARA_INTEGRATE_REVIEW=#464 from ScottTodd:cmake-tools 3b6865d PiperOrigin-RevId: 289541324
* iree: bed2763 Clean up code of legacy benchmark suite (#14081) (Wed Jun 14 00:12:46 2023 -0400) * xla: c13f357f0 Reverts 34d661c3b792cd9a55a5f6de6d5b58e4d7856c4b (Wed Jun 14 11:24:40 2023 -0700) * jax: b42282d30 Ensure effect indices are updated when constvars are modified. This resolves a bug where conditional Read<N> effect indices N were sometimes referring to the incorrect invars. (Wed Jun 14 10:09:54 2023 -0700)
I'm trying to run parts of IREE's compiler rebased off of #188 (eventually trying to refactor some of the CMake pieces into
iree_bytecode_module
and related helpers). However,iree-translate
doesn't seem to have statically registered translations on it.In particular, building
iree_tools_iree_translate
and then runningiree-translate --help
should be showing a list of options like-mlir-to-iree-module
, but the linker (at least on my Linux machine when building via Clang 8.0.1) doesn't seem to be includingiree::compiler::Translation::Sequencer
in the final binary. The Bazel build of the equivalent target works as expected. The dependency is definitely specified correctly, since compile errors inSequencerModuleTranslation.cpp
cause building that target to fail.MLIR has a
whole_archive_link
function here that seems to do what we might need, but I wasn't able to get that working withiree_compiler_Translation_Sequencer
or the other libraries today (may need to adjust paths/names so the-l
can find them?). It looks like there may be other ways to handle this with recent CMake versions, but I ran out of time today to research/experiment further.Also,
"${IREE_ROOT_DIR}/third_party/mlir/tools/mlir-translate/mlir-translate.cpp"
should be changed to"iree_translate_main.cc"
, but that doesn't seem to help with the link issue.The text was updated successfully, but these errors were encountered: