-
Notifications
You must be signed in to change notification settings - Fork 126
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
Regression with Clad master
in case of num-diff fallback in specific conditions
#681
Comments
While the reproducer in the original post works with the fix by @PetroZarytskyi, the underlying issue doesn't seem to really fixed because adding another trivial double wrapper(double *params)
{
if (true) {
double constant = 11.;
if (true) { // NEW
return foo(params[0], constant, 1.);
} // NEW
}
return 0.0;
} |
@guitargeek, can you provide us with the values of |
You can just take the code from the initial post in this issue, and replace the |
Do we care what |
Mathematically no, the only requirement to trigger the problem is that de definition of |
Thanks for fixing things up to this point! The current failures with RooFit can be reduced to this function, which can be plugged in to the full reproducer at the beginning of the issue: double wrapper(double *params)
{
double obs[]{
110,
};
double result = 0.0;
double hist[1] = {50.};
double tmp6[] = {params[0], 1.};
for (int j = 0; j < 1; j++) {
double signalshapes = hist[j];
double background1shapes = hist[j];
double tmp0[] = {signalshapes, background1shapes};
double tmp9 = 0.;
for (int i = 0; i < 2; i++) {
tmp9 += tmp0[i] * tmp6[i];
}
result += std::log(tmp9) - std::lgamma(obs[j] + 1.);
}
return result;
} It seems to be related to double-loops again |
When we produce a gradient function we generally have a forward and reverse sweep. In the forward sweep we accumulate the state and in the reverse sweep we use that state to invert the program execution. The forward sweep generally follows the sematics of the primal function and when neccessary stores the state which would be needed but lost for the reverse sweep. However, to minimize the stores onto the tape we need to reuse some of the variables between the forward and the reverse sweeps which requires some variables to be promoted to the enclosing lexical scope of both sweeps. Fixes vgvassilev#659, fixes vgvassilev#681.
Some of the RooFit tests are still failing with Clad
master
, because of code that hits very specific conditions.To reproduce the underlying problem, first create a library with any function:
Then use that library in a function the is differentiated:
Many conditions need to be met to get this Clad error:
-O2
if (true)
in the reproducerfoo(params[0], 11., 1.)
would not hit the bug)The output will be:
My compiler setup:
The text was updated successfully, but these errors were encountered: