-
Notifications
You must be signed in to change notification settings - Fork 109
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
Compiler returned -1 when std::vector<double> is involved #2119
Comments
Works in Enzyme Explorer: https://fwd.gymni.ch/JTva2a |
That indeed works, thank you! However, if I try to pass an integer as the dimension of a std::vector variable inside a function, that only works with clang18 and fails compilation with clang20. The function looks as follows, double g2(double x, int n) { I tried to compute the dg2/dx as follows, clang18 with "-O3 --std=c++20" works, but clang20 with "-O3 --std=c++20" fails with the following compilation error, any idea? unknown tbaa call instruction user inst: %call.i = tail call noundef double @pow(double noundef %x, double noundef %conv.i) #12, !dbg !2031, !tbaa !2032 vdptr: {[]:Pointer, [-1]:Integer}
|
Start to try Enzyme in Enzyme explorer. I found it does not compile when a runtime size container is involved, e.g. std::vector, as in the following example,
double dprod(const std::vector& v) {
double r = 1;
for (int i = 0; i < v.size(); i++) {
r *= v[i];
}
return r;
}
double g(double x) {
std::vector v;
v.push_back(x);
v.push_back(x*x);
return dprod(v);
}
int main() {
double x = 3;
double d_x = __enzyme_autodiff((void*)g, enzyme_out, x);
printf("d_x = %g\n", d_x);
}
This is critical for us, because we need to use Eigen::MatrixXd and Eigen::VectorXd with their sizes determined at runtime. Their elements are functions of some physical design variables.
Thanks for your help!
The text was updated successfully, but these errors were encountered: