-
Notifications
You must be signed in to change notification settings - Fork 123
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
Trying to differentiate an operator in reverse mode fails. #917
Comments
Don't we need to just pass the 4 arguments instead of 3? |
from my limited experience of working with operator differentiation in lambda functions, this error typically means that the constructed list of arguments for the pullback is ill-formed. the pullbacks normally accept a pointer to the derivative object of the class. I assume this may not be the case for non-differentiable types, which may result into this mismatch (if the VisitCallExpr method doesn't realise that we don't have to pass any pointers to the derivative objects to the pullback, it's gonna add this argument to the list). from what I also understand, clang does not count the first invisible argument, which is the object that calls the method itself, so in the AST it probably expects 4 args and receives 5 actually (if I remember correctly). not sure if it's exactly the case, but maybe that helps. it's only my assumption though and maybe you've already checked all of this and realised the issue |
Test:
Clang invocation:
Error:
The
operator_plus_pullback
that Clad is generating is:I don't understand what the error here is, so I'm not sure how to go about fixing this, but I discovered this when creating tests for
[[clad::non_differentiable]]
in reverse mode and this error is now blocking that PR.The text was updated successfully, but these errors were encountered: