EnzymeAD / Enzyme.jl

Julia bindings for the Enzyme automatic differentiator
https://enzyme.mit.edu
MIT License
439 stars 62 forks source link

`empty!` gives error with reverse mode #882

Closed jgreener64 closed 1 year ago

jgreener64 commented 1 year ago

I am on Julia 1.9.0 and Enzyme 9487eb8349fd7d907403533b53c23822313897bb. This code errors, forward mode works.

using Enzyme
function f(x)
    y = [1.0, 2.0]
    empty!(y)
    return x
end
autodiff(Reverse, f, Active, Active(1.0))
ERROR: Enzyme execution failed.
Not applying memset on reverse of jl_array_del_end
Stacktrace:
 [1] _deleteend!
   @ .\array.jl:1023
 [2] empty!
   @ .\array.jl:1773
 [3] f
   @ .\REPL[2]:3
 [4] f
   @ .\REPL[2]:0

Stacktrace:
 [1] throwerr(cstr::Cstring)
   @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:2910
wsmoses commented 1 year ago

Duplicate of https://github.com/EnzymeAD/Enzyme.jl/issues/871