-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
tool builds with Enzyme/autodiff fails #130637
Comments
It's not just about dist builds; this happens on any build that triggers tool builds (e.g., running |
move enzyme flags from general cargo to rustc-specific cargo Resolves rust-lang#130637.
move enzyme flags from general cargo to rustc-specific cargo Resolves rust-lang#130637.
Rollup merge of rust-lang#130648 - onur-ozkan:enzyme-linking, r=Kobzol move enzyme flags from general cargo to rustc-specific cargo Resolves rust-lang#130637.
Thank you @onur-ozkan for the quick fix! |
A while ago we merged the first backend pr to enable automatic differentiation in Rust: #129176.
This was good enough to add and enable the
enzyme
config inconfig.toml
and runx.py build --stage 1
.We would now like to improve the integration to also successfully run
x.py dist --stage 1
(to use Rust in our autodiff compiler explorer).@jedbrown and I looked into it for a while and while it seems like a simple linker issue, we didn't fully understood where it comes from and what's the best way to fix it. This commit has a few more changes (not yet upstreamed) that might help for understanding how enzyme is used master...EnzymeAD:rust:master. We also have documentation here: https://enzyme.mit.edu/index.fcgi/rust/
Back to the issue. We first build Enzyme (a git submodule) and then try to link it. To copy Jed's observations:
The code to add
-lEnzyme-19
is insrc/bootstrap/src/core/builder.rs
inside fn cargo.Note that linking works correctly when building normal crates. Also, I find it odd that this one line of code yields so many repeat arguments (as in,
"-Wl,-Bdynamic" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lEnzyme-19" "-lgcc_s").
Is there a better way to link Enzyme?
Should we prefer to elide Enzyme linking when it isn't needed or be more explicit with paths so it is always found?
A potentially related linking error only happens under MacOS: EnzymeAD#175
Related Zulip issue: https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Fixing.20x.2Epy.20dist.20linking.20issue
Tracking:
The text was updated successfully, but these errors were encountered: