Enzyme
Enzyme copied to clipboard
Enzyme: Cannot cast __enzyme_autodiff primal argument 16
I'm getting a weird typecasting issue in Enzyme. What could be the source of it?
https://fwd.gymni.ch/vATLS0
Oh this might be clang splatting the args into two pieces. What happens if you change the function and enzyme call to pass everything by reference
On Thu, Feb 29, 2024 at 8:35 AM Egor Feklisov @.***> wrote:
I'm getting a weird typecasting issue in Enzyme. What could be the source of it?
https://fwd.gymni.ch/vATLS0
— Reply to this email directly, view it on GitHub https://github.com/EnzymeAD/Enzyme/issues/1772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJTUXA2YMIAQEFSFAQ34EDYV5MDLAVCNFSM6AAAAABEAIOIOWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3DCNRVG44TOOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I hope I understood you correctly, but I see a similar issue
https://fwd.gymni.ch/TFoPoL
C var-args passes things by value, so you need to &
the args to make them pointers in that case: https://fwd.gymni.ch/zWsQwn
Hopefully that solve your issue, however keeping this open for now so we can make the nice c++ syntax happy with it [and obviate the need for the extra work]: https://fwd.gymni.ch/UDe5lg
@samuelpmishLLNL @samuelpmish
Sorry, I am having same issue, in a small example I was creating to ask unrelated question. Why is the minimal function below gives same error?
https://fwd.gymni.ch/NzHCYv
int __enzyme_const, __enzyme_dup;
void __enzyme_autodiffs(void (*) (double, double, double*), ...);
void math(double a, double b , double *result) {}
void grad(double a, double b, double *result, double *d_result) {
double d_a = 0.0;
double d_b = 0.0;
__enzyme_autodiffs(math,
__enzyme_dup, a, d_a,
__enzyme_dup, b, d_b,
__enzyme_dup, result, d_result);
}
@ipcamit I think you're just using the wrong names for some of the enzyme stuff.
try:
-
__enzyme_autodiff
rather than__enzyme_autodiffs
-
enzyme_const
instead of__enzyme_const
-
enzyme_dup
instead of__enzyme_dup
see: https://fwd.gymni.ch/k3qaoa
This is embarrassing! I was using __enzyme_autodiff
properly, and was trying to see if its name change will affect the compilation. But completely forgot about enzyme_dup
, I was really sure that all things enzyme start like __enzyme...
! Thank you for taking time to look into this.