-
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
impl new modes for higher order ad #106
Conversation
Are you trying with a matching test? Perhaps an update to EnzymeAD/rustbook#4? |
Did you miss my zulip message @jedbrown ? |
|
The error message is confusing because the local variable is |
The logic is: |
Thanks, do you know what's wrong with my example now? diff --git a/samples/tests/neohookean/mod.rs b/samples/tests/neohookean/mod.rs
index 3d3dabb..76270d2 100644
--- a/samples/tests/neohookean/mod.rs
+++ b/samples/tests/neohookean/mod.rs
@@ -241,7 +241,7 @@ impl NH {
// We can only differentiate free functions, not methods (yet)
// Helmholtz free energy density
-#[autodiff(d_psi, Reverse, Duplicated, Const, Active)]
+#[autodiff(d_psi, ReverseFirst, Duplicated, Const, Active)]
fn psi(e: &KM, nh: &NH) -> f64 {
let mu = nh.mu;
let lambda = nh.lambda;
@@ -335,7 +335,6 @@ fn check_stress() {
assert!(diff < 1e-14);
}
-#[cfg(broken)]
#[test]
fn check_dstress() {
let nh = NH::from_youngs(1.0, 0.3); And then $ cargo +enzyme t
[...]
num_fnc_args: 2
input_activity.len(): 2
num_fnc_args: 2
input_activity.len(): 2
Function return type does not match operand type of return inst!
ret { double } %5
doubleLLVM ERROR: Broken function found, compilation aborted!
warning: `samples` (test "mod") generated 1 warning
error: could not compile `samples` (test "mod"); 1 warning emitted |
Or should I try working around this by using an output argument instead of return value? |
If you can get it to work just by changing the return style I'd appreciate it, since I hope for more perf from my tt work. |
Does currently not work, fails to diff the fwd function, the rev succeeds (forward-over-reverse example from julia docs).
Fails inside of Enzyme
Extra info during compiling the example is available through rustc's tracing infra:
RUSTC_LOG=rustc_codegen_llvm::llvm=trace cargo +enzyme build
Can you please look into it @wsmoses? I hope there is just some call setting wrong, but it would be nice if it would hit an enzyme assertion instead of an llvm one. Also, I here reuse the enzymelogicref, but the same issue happens if I don't.