-
Notifications
You must be signed in to change notification settings - Fork 66
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
Enzyme fails to reverse mode AD through broadcast assignment with CuArrays #2116
Comments
I think JuliaGPU/CUDA.jl#2563 should resolve, give it a go? |
Hi, thanks for the rapid reply @wsmoses! I tried the fix, upgrading to CUDA=5.5.2 and Enzyme=0.13.16 and it seems like the launch_configuration is still captured by Enzyme. I tried to copy your fix directly into the script above to ensure that the rule is used by Enzyme: using OrdinaryDiffEq
using Plots
using Enzyme
using CUDA
using EnzymeCore
function EnzymeCore.EnzymeRules.inactive_noinl(::typeof(CUDA.launch_configuration), args...; kwargs...)
return nothing
end
gpu = CuArray
# Define the mass-damper system
function mass_damper!(du, u, p, t)
sys = p
du .= sys*u
nothing
end
etc... But it still gives me this error, which I suspect that it doesn't ignores it fully?
What do you think? Which version of julia are you using? I'm using 1.10.6 atm. after seeing some issues reported on the combination Julia=1.11.x and CUDA/Enzyme... |
I switched out the rule you defined with the one that prevent inlining: function EnzymeCore.EnzymeRules.inactive(::typeof(CUDA.launch_configuration), args...; kwargs...)
return nothing
end This seems to work! I dont know why it doesn't work with the version that allows inlining tho? Do you have any idea? |
Origin of the problem is trying to use Enzyme.jl in the EnzymeJVP() in SciMLSensitivities. After boiling it down to a small example it seems that Enzyme has problems compiling the code for reverse mode AD through the
.=
operator in the system equation. The code works if you switch theCuArray
type withArray
on line 7.Code to reproduce error:
Error message:
Versioninfo() of the system:
Packages are:
The text was updated successfully, but these errors were encountered: