cmake: make Enzyme Apple dynamic_lookup opt-in#2670
Conversation
|
For context, Rust static links against llvm in our MacOS CI. Without this patch, we end up with a second copy of LLVM in libEnzyme-21.dylib. Having two copies of LLVM and passing objects between them results in bugs. |
|
is there any any way to test the intended use case of this here offhand? somewhat relatedly the current rust linux tests are failing from a test editable only on the rust-lang/rust side |
|
Do you want an extra rust-apple runner in this repo? Then running the apple equivalent of |
|
yeah for sure, if rust has ci resources we can run with here to test apple that would definitely be the best route forward! |
|
at that point I'd recommend just doing an end to end apple test, like the linux one |
|
Oh that wasn't meant as an offer of Rust providing it, I don't think our infra would want to deal with covering this third party repo outside the rust-lang org. But didn't you mention that you got a lot of additional CI resources? |
|
ah okay, and no we don't have many apple CI runners unfortunately. Is there any other reasonable way this can be tested. At minimum, I presume the rust tests should pass here and upstream rust CI (which runs this?). Considering the linux ones here still fail, I'm guessing thats not the case.... |
|
Unfortunate, but then you should just merge it as is, so we can drop it from our fork. |
|
The tests are fixed here: rust-lang/rust#151526, waiting for approval. |
|
nice, left a comment on it! |
Add
ENZYME_APPLE_DYNAMIC_LOOKUPCMake option (default OFF).It turns out that we cannot use std::autodiff in Rust when we dlopen Enzyme without dynamic_lookup on MacOS.
Although Rust’s Enzyme integration requires dynamic lookup on Apple, this should not be the default for all Apple users. This makes the behaviour opt-in while preserving existing builds.
As an alternative, we can add the non-platform-specific name
ENZYME_DYNAMIC_LOOKUP, enabling it only when using Apple.However, I think a platform-specific name is better because we can't use it on Linux or Windows either way now.
cc: @ZuseZ4