iree-org / iree

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

Compiler API: implement linking with installed-LLVM #14086

Open bjacob opened 1 year ago

bjacob commented 1 year ago

When built with installed-LLVM (a.k.a. bring-your-own-LLVM, as opposed to the default bundled-LLVM build), the Compiler API currently disables linking, as a runtime error: https://github.com/openxla/iree/blob/c457c30c0ed86f42b76f18eb7fa160d6daeba49a/compiler/src/iree/compiler/API/Internal/LLDToolEntryPoint.cpp#L12-L21

This IREE_COMPILER_LLD_DISABLED token is defined in the build when IREE_LLD_TARGET is falseish, https://github.com/openxla/iree/blob/c457c30c0ed86f42b76f18eb7fa160d6daeba49a/compiler/src/iree/compiler/API/Internal/CMakeLists.txt#L95-L111

Which happens when building with installed-LLVM, since IREE_LLD_TARGET is only defined in the bundled-LLVM case.

ScottTodd commented 1 year ago

Oh, I had some state on this with https://github.com/openxla/iree/pull/12583 and related issues/discussions (https://github.com/openxla/iree/issues/12830, https://github.com/openxla/iree/pull/12884). I've context switched out much of that though...

Evan-Zhao commented 1 year ago

Curious what's the status on this now? I'm on commit #675aafb56 (18 hours ago) and ran into the same problem.

stellaraccident commented 1 year ago

I wasn't aware that we had left this dangling issue. I think some patches were landed which probably fixed the mechanism but probably neglected to get it over the line completely.

ScottTodd commented 11 months ago

https://github.com/openxla/iree/pull/15580 made LLD optional, but I still see a few "byo llvm" tests trying to link with it and failing (on https://github.com/openxla/iree/pull/15878, logs: https://github.com/openxla/iree/actions/runs/7171206985/job/19525680395?pr=15878#step:4:18074).

Evan-Zhao commented 11 months ago

15580 made LLD optional, but I still see a few "byo llvm" tests trying to link with it and failing (on #15878, logs: https://github.com/openxla/iree/actions/runs/7171206985/job/19525680395?pr=15878#step:4:18074).

I see that merge request (good to have!), but IREE_COMPILER_LLD_DISABLED is still around as a separate TODO item on this line. Do we have that done somewhere waiting to be merged? If not, maybe I can go and try to figure this out?