-
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
Functions with pointer assigns lead to compilation error in reverse mode #197
Comments
Ideally, how should functions containing pointer parameters should be differentiated ?
Error obtained using |
Clad does not yet support multi-arg calls (here pointer equivalent) in forward mode. That means while it won't support any non-real argument, it supports pointers being used in the function body as dependent variables/constants. And if we encounter some pointer arithmetic we do not support, we should ideally ignore it and issue a warning stating that generation of a derivative of that operation is not yet supported. The ideal result of the function causing the issue should just be that it compiles. Maybe there are warnings emitted, but in no case should it result in an error as it does now, especially since the program is syntactically correct. The derivative will not necessarily be correct but that is okay. As for differentiating function with pointer inputs. The pointers are treated mostly as signifying an array (we don't currently support using pointers with the |
Thank you for your detailed reply, I understand the situation much better now. |
You can ask here for now, but on that note, @vgvassilev what about a discussions tab on the repo? |
@parth-07, I would the diagnostics on calling
You can open an issue if something is unclear about the codebase. @grimmmyshini I will have to learn more about "Discussions" and maybe that's the longer term answer to that question. |
@vgvassilev @grimmmyshini I am playing with the clad codebase from last couple of days to understand it better, I am also studying about clang plugins and clang AST, hoping understanding them better will help me to understand the codebase better. I will open an issue if something is unclear, thank you for the supportive responses. |
This commit adds support for pointer operation in reverse mode. The technique is maintain a corresponding derivative pointer variable, which gets updated (and stored/restored) in the exact same way as the primal pointer variable in both forward and reverse passes. Added a workaround (with a FIXME comment) in the UsefulToStoreGlobal method to essentially bypass TBR analysis results for pointer expr. Fixes vgvassilev#195, vgvassilev#197
This commit adds support for pointer operation in reverse mode. The technique is to maintain a corresponding derivative pointer variable, which gets updated (and stored/restored) in the exact same way as the primal pointer variable in both forward and reverse passes. Added a workaround (with a FIXME comment) in the UsefulToStoreGlobal method to essentially bypass TBR analysis results for pointer expr. Fixes vgvassilev#195, Fixes vgvassilev#197
This commit adds support for pointer operation in reverse mode. The technique is to maintain a corresponding derivative pointer variable, which gets updated (and stored/restored) in the exact same way as the primal pointer variable in both forward and reverse passes. Added a workaround (with a FIXME comment) in the UsefulToStoreGlobal method to essentially bypass TBR analysis results for pointer expr. Fixes vgvassilev#195, Fixes vgvassilev#197
This commit adds support for pointer operation in reverse mode. The technique is to maintain a corresponding derivative pointer variable, which gets updated (and stored/restored) in the exact same way as the primal pointer variable in both forward and reverse passes. Added a workaround (with a FIXME comment) in the UsefulToStoreGlobal method to essentially bypass TBR analysis results for pointer expr. Fixes vgvassilev#195, Fixes vgvassilev#197
This commit adds support for pointer operation in reverse mode. The technique is to maintain a corresponding derivative pointer variable, which gets updated (and stored/restored) in the exact same way as the primal pointer variable in both forward and reverse passes. Added a workaround (with a FIXME comment) in the UsefulToStoreGlobal method to essentially bypass TBR analysis results for pointer expr. Fixes vgvassilev#195, Fixes vgvassilev#197
This commit adds support for pointer operation in reverse mode. The technique is to maintain a corresponding derivative pointer variable, which gets updated (and stored/restored) in the exact same way as the primal pointer variable in both forward and reverse passes. Added a workaround (with a FIXME comment) in the UsefulToStoreGlobal method to essentially bypass TBR analysis results for pointer expr. Fixes vgvassilev#195, Fixes vgvassilev#197
This commit adds support for pointer operation in reverse mode. The technique is to maintain a corresponding derivative pointer variable, which gets updated (and stored/restored) in the exact same way as the primal pointer variable in both forward and reverse passes. Added a workaround (with a FIXME comment) in the UsefulToStoreGlobal method to essentially bypass TBR analysis results for pointer expr. Fixes #195, Fixes #197
Any assignment of pointers results in a compilation error. Minimum reproducable example:
results in
error: invalid operands to binary expression ('double *' and 'double *')
Ideally, these expressions should be ignored and warned against, they should still be compiled however. I suspect some issue with the
_result
type mismatch with the intermediate pointers, however, I am not sure. This issue is also closely related to #195 and solving that might also solve this one.This and #195 both work towards adding array/reference differentiability support too and maybe solved as that feature is addressed.
Another example to reproduce the same error is:
results in the same error when executed in reverse mode. It works as expected in the forward mode.
The text was updated successfully, but these errors were encountered: