-
Notifications
You must be signed in to change notification settings - Fork 64
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
Inactivated PyCall Calling Functions Block Enzyme? #1481
Comments
I think the answer here is to add a cutom rule to the pyobject constructor which ensures that all the cross language GC is handled properly. Specifically: https://github.com/JuliaPy/PyCall.jl/blob/2f600fbebee50ab0672e153455e3c0fda1694fba/src/PyCall.jl#L53 Ironically we can almost certainly just copy the cuarray rule https://github.com/JuliaGPU/CUDA.jl/blob/bbfd1ad2c3c3ace2502d61c254a6a7f3c48f2197/ext/EnzymeCoreExt.jl#L107 and https://github.com/JuliaGPU/CUDA.jl/blob/bbfd1ad2c3c3ace2502d61c254a6a7f3c48f2197/ext/EnzymeCoreExt.jl#L304 and https://github.com/JuliaGPU/CUDA.jl/blob/bbfd1ad2c3c3ace2502d61c254a6a7f3c48f2197/ext/EnzymeCoreExt.jl#L331 |
Further investigation, I think the issue here is inactive wasn't being checked in the context of kwargs (and also there may have been kwargs here on the call) Regardless, try #1539 and also possibly doing args...; kwargs... on your inactive marker |
@ChrisRackauckas going to go ahead and close this. please reopen if it persists |
This seems unintentional. Found this as part of a bigger push ODINN-SciML/ODINN.jl#151. If I have these two lines:
https://github.com/ODINN-SciML/ODINN.jl/pull/151/files#diff-71e70aa5cc3c0507c49d0979eb88a9ac88cf5771a6bfe621f134fdbe146aba34R135-R136
uncommented, I get an error due to PyCall:
However, both functions are inactivated at the top of the file:
https://github.com/ODINN-SciML/ODINN.jl/pull/151/files#diff-d3c9b3bf5488114c648831dcc69c1e95f51dd3e64362e32ed25631401ff945afR37-R39
I can "fix" this by commenting out those lines, and those functions have PyCall interior to them, so that makes it clear that these are blocking Enzyme from building the function. However, because those functions are inactivated, my understanding is that Enzyme shouldn't care what's inside of there for the purpose of differentiation. It seems that something in the compiler pass is getting stuck at what's going on with PyCalls when in this case it should just not care / skip over it.
The text was updated successfully, but these errors were encountered: