-
Notifications
You must be signed in to change notification settings - Fork 8
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
Examples do not compile #71
Comments
That's not you, this branch is just a bit dated and unfortunately ended up having both the old (src/lib) and the new (builtin) autodiff frontend. The new branch is macro2, I will push a few more of my local changes after cleaning up. The new branch compiles and should today be ready to be tested on windows to resolve potential path issues, but for the examples to fully work I will need a bit more time to Cherry-pick all the changes from my last branch. |
All good. Thanks for your quick response. I'll wait for your changes to merge and then I'll resume my efforts to get it working on Windows. No rush. |
I just pushed a change to macro2 which now successfully builds and links Enzyme on Linux, so that should be a nice mwe to get it to work on windows, if you want to try. It uses / as path separator, but that's also done by the original code around it, so I assume it is not the reason for failing on windows. |
By now what's remaining is moving from the syn/quote/parse usage in library/autodiff/src to the rustc ast::MetaItem walking in compiler/rustc_builtin_macros/src/autodiff.rs, the rest should be ported over. I will try to get a first small example to work this evening. |
basic examples now indeed get expanded, the span metadata seems to still be wrong though, since it fails to compile with gibberish error messages. I'll have another look at it next week, after traveling. fn rosenbrock(x: &[f64; 2]) -> f64 {
let mut res = 0.0;
for i in 0..(x.len() - 1) {
let a = x[i + 1] - x[i] * x[i];
let b = x[i] - 1.0;
res += 100.0 * a * a + b * b;
}
res
}
fn d_rosenbrock(x: &[f64; 2], dx: &mut [f64; 2]) -> f64 {
std::hint::black_box(rosenbrock(x), dx);
std::hint::black_box(unsafe { std::mem::zeroed() })
} |
As an aside, src/bootstrap/src/core/build_steps/compile.rs wants to copy enzyme libs but assumes the library names have an .so extension, failing on Windows and macOS. I'll see if I can make a PR for it. |
@motabbara Ping in case that you have time to fix and test the extension on another system :) |
Also the macro2 branch is slowly getting in shape to replace the current main branch. I hope to get to it this weekend. |
Closing since the new macro implementation is now on Master and at least some examples compile in debug mode. |
The examples do not compile.
I followed the build instructions for Linux and attempted to run one of the examples:
cargo +enzyme run --example rosenbrock_fwd_iter
. There are four compilation errors:The second error states there are two definitions of the
autodiff
attribute:autodiff
attribute is also defined in/src/lib.rs
.Two competing definitions of the attribute suggests a configuration issue. Am I missing a step?
The text was updated successfully, but these errors were encountered: