EnzymeAD / Enzyme.jl

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

Missing support for erf (and related I guess) again #1488

Open rcalxrc08 opened 6 months ago

rcalxrc08 commented 6 months ago

same as #364 MWE:

using Enzyme, Test, SpecialFunctions

f1(x) = erf(x)*x
@show first(autodiff(Reverse, f1, Active(1.0))[1])

and I get:

ERROR: Enzyme execution failed.
Enzyme compilation failed.
Current scope:
; Function Attrs: mustprogress willreturn
define "enzyme_type"="{[-1]:Float@double}" double @preprocess_julia_f1_1412(double "enzyme_type"="{[-1]:Float@double}" "enzymejl_parmtype"="140718177488032" "enzymejl_parmtype_ref"="0" %0) local_unnamed_addr #3 !dbg !23 {
top:
  %1 = call {}*** @julia.get_pgcstack() #4
  %ptls_field3 = getelementptr inbounds {}**, {}*** %1, i64 2
  %2 = bitcast {}*** %ptls_field3 to i64***
  %ptls_load45 = load i64**, i64*** %2, align 8, !tbaa !8
  %3 = getelementptr inbounds i64*, i64** %ptls_load45, i64 2
  %safepoint = load i64*, i64** %3, align 8, !tbaa !12
  fence syncscope("singlethread") seq_cst
  call void @julia.safepoint(i64* %safepoint) #4, !dbg !24
  fence syncscope("singlethread") seq_cst
  %4 = call double @.text(double %0) #4, !dbg !25
  %5 = fmul double %4, %0, !dbg !27
  ret double %5, !dbg !27
}

No augmented forward pass found for .text
 at context:   %4 = call double @.text(double %0) #4, !dbg !15

Stacktrace:
 [1] _erf
   @ C:\Users\Nicola\.julia\packages\SpecialFunctions\npKKV\src\erf.jl:15
 [2] erf
   @ C:\Users\Nicola\.julia\packages\SpecialFunctions\npKKV\src\erf.jl:13
 [3] f1
   @ .\REPL[2]:1

Stacktrace:
 [1] throwerr(cstr::Cstring)
   @ Enzyme.Compiler C:\Users\Nicola\.julia\packages\Enzyme\F71IJ\src\compiler.jl:1338
wsmoses commented 6 months ago

What is your Julia version, operating system, Enzyme version, and the result of st?

rcalxrc08 commented 6 months ago

Enzyme v0.12.9, julia 1.10.2, windows.

wsmoses commented 5 months ago

Hm i think we'll need a call or something to debug this, since I have been able to reproduce this and our windows CI passes for this.

Are you available next week some time?