You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example tries to take the derivative of function which sums elements of a Simbody Matrix accessed through a sub-vector of a view into a column of the matrix (i.e., a VectorView). This example was built with LLVM 18 with and Enzyme v0.0.157.
#include<cstdio>
#include"Simbody.h"usingnamespaceSimTK;externint enzyme_dup;
template <typename return_type, typename... T>
return_type __enzyme_fwddiff(void *, T...);
Real foo(const Matrix& mat) {
// Grab the second column as a VectorView and from that view,// grab a subvector (another VectorView) from the second element// to the third element. Finally, sum the elements of the subvector.
VectorView vec = mat.col(1)(1, 2);
returnvec(0) + vec(1);
}
intmain () {
Matrix mat = Test::randMatrix(4, 4);
Matrix dmat(4, 4, 0.0);
dmat(1, 1) = 1.0;
dmat(1, 2) = 1.0;
Real dfoo = __enzyme_fwddiff<Real>((void*)foo,
enzyme_dup, &mat, &dmat);
return0;
}
Building this example fails during type analysis with the following error message:
[build] ld.lld: error: dependencies/install/simbody/include/simbody/SimTKcommon/internal/BigMatrix.h:217:26: in function preprocess__Z3fooRKN5SimTK7Matrix_IdEE double (ptr): Enzyme: Cannot deduce type of copy call void @llvm.memcpy.p0.p0.i64(ptr align 8 %45, ptr align 4 %3, i64 20, i1 false) #30, !dbg !14589, !tbaa.struct !14493, !noalias !14586
This error points to this line in Simbody, at the construction of a "MatrixHelper" class used here to create a modifiable view into a block of the original matrix (presumably the same sub-vector as above). I can provide more output around the build error above for context if requested.
Adding LLDEnzymeLooseTypeFlags allows the executable to compile, but upon running I receive the error message "Attempting to call an indirect active function whose runtime value is inactive". Replacing foo with:
Real bar(const Matrix& mat) {
// Grab and sum the same elements as in foo(), but directly.
return mat.getElt(1, 1) + mat.getElt(1, 2);
}
compiles without LLDEnzymeLooseTypeFlags, but also produces "Attempting to call an indirect active function whose runtime value is inactive".
The text was updated successfully, but these errors were encountered:
The following example tries to take the derivative of function which sums elements of a Simbody
Matrix
accessed through a sub-vector of a view into a column of the matrix (i.e., aVectorView
). This example was built with LLVM 18 with and Enzyme v0.0.157.This example is part of my Simbody-Enzyme testing repo here. Simbody is compiled with static libraries and LTO enabled. The executable is compiled with
LLDEnzymeFlags
andLLDEnzymePrintFlags
.Building this example fails during type analysis with the following error message:
This error points to this line in Simbody, at the construction of a "MatrixHelper" class used here to create a modifiable view into a block of the original matrix (presumably the same sub-vector as above). I can provide more output around the build error above for context if requested.
Adding
LLDEnzymeLooseTypeFlags
allows the executable to compile, but upon running I receive the error message "Attempting to call an indirect active function whose runtime value is inactive". Replacing foo with:compiles without
LLDEnzymeLooseTypeFlags
, but also produces "Attempting to call an indirect active function whose runtime value is inactive".The text was updated successfully, but these errors were encountered: