EnzymeAD / Enzyme.jl

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

Illegal type analysis #1400

Closed jgreener64 closed 6 months ago

jgreener64 commented 6 months ago

Until recently this worked. With Julia 1.10.2 and Enzyme main (8273a6e):

using Enzyme

function f(x)
    a = similar(rand(3, 3))
    fill!(a, x)
    return sum(a)
end

autodiff(Forward, f, Duplicated(2.0, 1.0))[1]
ERROR: Enzyme compilation failed due to illegal type analysis.
Current scope:
; Function Attrs: mustprogress willreturn
define "enzyme_type"="{[-1]:Float@double}" double @preprocess_julia_f_2786(double "enzyme_type"="{[-1]:Float@double}" "enzymejl_parmtype"="140703511776416" "enzymejl_parmtype_ref"="0" %0) local_unnamed_addr #19 !dbg !517 {
top:
  %1 = call {}*** @julia.get_pgcstack() #20
  %ptls_field18 = getelementptr inbounds {}**, {}*** %1, i64 2
  %2 = bitcast {}*** %ptls_field18 to i64***
  %ptls_load1920 = load i64**, i64*** %2, align 8, !tbaa !16
  %3 = getelementptr inbounds i64*, i64** %ptls_load1920, i64 2
  %safepoint = load i64*, i64** %3, align 8, !tbaa !20
  fence syncscope("singlethread") seq_cst
  call void @julia.safepoint(i64* %safepoint) #20, !dbg !518
  fence syncscope("singlethread") seq_cst
  %4 = call noalias nonnull {} addrspace(10)* @ijl_alloc_array_2d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 2281392098768 to {}*) to {} addrspace(10)*), i64 noundef 3, i64 noundef 3) #21, !dbg !519
  %5 = call token (...) @llvm.julia.gc_preserve_begin({} addrspace(10)* nonnull %4) #20, !dbg !526
  %6 = addrspacecast {} addrspace(10)* %4 to {} addrspace(11)*, !dbg !528
  %7 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %6) #22, !dbg !528
  %8 = bitcast {}* %7 to i8**, !dbg !528
  %arrayptr = load i8*, i8** %8, align 8, !dbg !528, !tbaa !20, !alias.scope !299, !noalias !300, !nonnull !15
  %9 = ptrtoint i8* %arrayptr to i64, !dbg !528
  %10 = addrspacecast {} addrspace(10)* %4 to { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)*, !dbg !530
  %arraylen_ptr = getelementptr inbounds { i8 addrspace(13)*, i64, i16, i16, i32 }, { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)* %10, i64 0, i32 1, !dbg !530
  %arraylen = load i64, i64 addrspace(11)* %arraylen_ptr, align 8, !dbg !530, !tbaa !20, !range !298, !alias.scope !299, !noalias !300
  %11 = shl i64 %arraylen, 3, !dbg !531
  %12 = icmp slt i64 %11, 64, !dbg !532
  br i1 %12, label %L17, label %L11, !dbg !534

L11:                                              ; preds = %top
  %13 = call fastcc i64 @julia_xoshiro_bulk_simd_2804(i64 zeroext %9, i64 signext %11) #20, !dbg !535
  %14 = sub i64 %11, %13, !dbg !536
  %15 = getelementptr i8, i8* %arrayptr, i64 %13, !dbg !538
  %16 = ptrtoint i8* %15 to i64, !dbg !538
  br label %L17, !dbg !540

L17:                                              ; preds = %L11, %top
  %value_phi = phi i64 [ %16, %L11 ], [ %9, %top ]
  %value_phi2 = phi i64 [ %14, %L11 ], [ %11, %top ]
  %17 = icmp eq i64 %value_phi2, 0, !dbg !543
  br i1 %17, label %L24, label %L22, !dbg !545

L22:                                              ; preds = %L17
  call fastcc void @julia_xoshiro_bulk_nosimd_2799(i64 zeroext %value_phi, i64 signext %value_phi2) #20, !dbg !546
  br label %L24, !dbg !546

L24:                                              ; preds = %L22, %L17
  call void @llvm.julia.gc_preserve_end(token %5) #20, !dbg !526
  %18 = addrspacecast {} addrspace(10)* %4 to {} addrspace(10)* addrspace(11)*, !dbg !547
  %arraysize_ptr = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %18, i64 3, !dbg !547
  %19 = bitcast {} addrspace(10)* addrspace(11)* %arraysize_ptr to i64 addrspace(11)*, !dbg !547
  %arraysize = load i64, i64 addrspace(11)* %19, align 8, !dbg !547, !tbaa !20, !range !298, !alias.scope !299, !noalias !300
  %arraysize_ptr3 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %18, i64 4, !dbg !547
  %20 = bitcast {} addrspace(10)* addrspace(11)* %arraysize_ptr3 to i64 addrspace(11)*, !dbg !547
  %arraysize4 = load i64, i64 addrspace(11)* %20, align 8, !dbg !547, !tbaa !20, !range !298, !alias.scope !299, !noalias !300
  %21 = call noalias nonnull {} addrspace(10)* @ijl_alloc_array_2d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 2281392098768 to {}*) to {} addrspace(10)*), i64 %arraysize, i64 %arraysize4) #21, !dbg !549
  %22 = addrspacecast {} addrspace(10)* %21 to { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)*, !dbg !550
  %arraylen_ptr5 = getelementptr inbounds { i8 addrspace(13)*, i64, i16, i16, i32 }, { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)* %22, i64 0, i32 1, !dbg !550
  %arraylen6 = load i64, i64 addrspace(11)* %arraylen_ptr5, align 8, !dbg !550, !tbaa !20, !range !298, !alias.scope !299, !noalias !300
  %.not = icmp eq i64 %arraylen6, 0, !dbg !555
  br i1 %.not, label %L60, label %L24.L45_crit_edge, !dbg !553

L24.L45_crit_edge:                                ; preds = %L24
  %23 = addrspacecast {} addrspace(10)* %21 to double addrspace(13)* addrspace(11)*, !dbg !559
  %arrayptr13.pre21 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %23, align 8, !dbg !559, !tbaa !20, !alias.scope !561, !noalias !300
  %24 = add nsw i64 %arraylen6, -1, !dbg !553
  %xtraiter = and i64 %arraylen6, 7, !dbg !553
  %25 = icmp ult i64 %24, 7, !dbg !553
  br i1 %25, label %L60.loopexit.unr-lcssa, label %L24.L45_crit_edge.new, !dbg !553

L24.L45_crit_edge.new:                            ; preds = %L24.L45_crit_edge
  %unroll_iter = and i64 %arraylen6, 9223372036854775800, !dbg !553
  br label %L45, !dbg !553

L45:                                              ; preds = %L45, %L24.L45_crit_edge.new
  %iv = phi i64 [ %iv.next, %L45 ], [ 0, %L24.L45_crit_edge.new ]
  %26 = shl nuw i64 %iv, 3, !dbg !559
  %iv.next = add nuw nsw i64 %iv, 1, !dbg !559
  %27 = shl i64 %iv, 3, !dbg !559
  %28 = add nuw nsw i64 %27, 1, !dbg !559
  %29 = add nsw i64 %28, -1, !dbg !559
  %30 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %29, !dbg !559
  store double %0, double addrspace(13)* %30, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %31 = add nuw nsw i64 %28, 1, !dbg !565
  %32 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %28, !dbg !559
  store double %0, double addrspace(13)* %32, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %33 = add nuw nsw i64 %28, 2, !dbg !565
  %34 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %31, !dbg !559
  store double %0, double addrspace(13)* %34, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %35 = add nuw nsw i64 %28, 3, !dbg !565
  %36 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %33, !dbg !559
  store double %0, double addrspace(13)* %36, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %37 = add nuw nsw i64 %28, 4, !dbg !565
  %38 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %35, !dbg !559
  store double %0, double addrspace(13)* %38, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %39 = add nuw nsw i64 %28, 5, !dbg !565
  %40 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %37, !dbg !559
  store double %0, double addrspace(13)* %40, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %41 = add nuw nsw i64 %28, 6, !dbg !565
  %42 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %39, !dbg !559
  store double %0, double addrspace(13)* %42, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %43 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %41, !dbg !559
  store double %0, double addrspace(13)* %43, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %44 = add nuw nsw i64 %28, 8, !dbg !565
  %niter.next.7 = add nuw i64 %26, 8, !dbg !566
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter, !dbg !566
  br i1 %niter.ncmp.7, label %L60.loopexit.unr-lcssa.loopexit, label %L45, !dbg !566

L60.loopexit.unr-lcssa.loopexit:                  ; preds = %L45
  br label %L60.loopexit.unr-lcssa, !dbg !566

L60.loopexit.unr-lcssa:                           ; preds = %L60.loopexit.unr-lcssa.loopexit, %L24.L45_crit_edge
  %value_phi10.unr = phi i64 [ 1, %L24.L45_crit_edge ], [ %44, %L60.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0, !dbg !566
  br i1 %lcmp.mod.not, label %L60, label %L45.epil.preheader, !dbg !566

L45.epil.preheader:                               ; preds = %L60.loopexit.unr-lcssa
  br label %L45.epil, !dbg !566

L45.epil:                                         ; preds = %L45.epil.preheader, %L45.epil
  %iv1 = phi i64 [ 0, %L45.epil.preheader ], [ %iv.next2, %L45.epil ]
  %45 = add nuw nsw i64 %value_phi10.unr, %iv1, !dbg !559
  %iv.next2 = add nuw nsw i64 %iv1, 1, !dbg !559
  %46 = add nsw i64 %45, -1, !dbg !559
  %47 = getelementptr inbounds double, double addrspace(13)* %arrayptr13.pre21, i64 %46, !dbg !559
  store double %0, double addrspace(13)* %47, align 8, !dbg !559, !tbaa !315, !alias.scope !65, !noalias !564
  %48 = add nuw nsw i64 %45, 1, !dbg !565
  %epil.iter.cmp.not = icmp eq i64 %iv.next2, %xtraiter, !dbg !566
  br i1 %epil.iter.cmp.not, label %L60.loopexit, label %L45.epil, !dbg !566, !llvm.loop !567

L60.loopexit:                                     ; preds = %L45.epil
  br label %L60, !dbg !568

L60:                                              ; preds = %L60.loopexit, %L60.loopexit.unr-lcssa, %L24
  %49 = call fastcc double @julia__mapreduce_2791({} addrspace(10)* noalias nocapture nofree noundef nonnull readonly align 16 dereferenceable(40) %21) #20, !dbg !568
  ret double %49, !dbg !577
}

 Type analysis state:
<analysis>
i64 3: {[-1]:Integer}, intvals: {3,}
{}* inttoptr (i64 2281392098768 to {}*): {[-1]:Anything}, intvals: {}
{} addrspace(10)* addrspacecast ({}* inttoptr (i64 2281392098768 to {}*) to {} addrspace(10)*): {[-1]:Anything}, intvals: {}
  %11 = shl i64 %arraylen, 3, !dbg !57: {[-1]:Integer}, intvals: {}
  %safepoint = load i64*, i64** %3, align 8, !tbaa !20: {}, intvals: {}
  %8 = bitcast {}* %7 to i8**, !dbg !39: {[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer, [-1,12]:Integer, [-1,13]:Integer, [-1,14]:Integer, [-1,15]:Integer, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer, [-1,32]:Integer, [-1,33]:Integer, [-1,34]:Integer, [-1,35]:Integer, [-1,36]:Integer, [-1,37]:Integer, [-1,38]:Integer, [-1,39]:Integer}, intvals: {}
  %arrayptr = load i8*, i8** %8, align 8, !dbg !39, !tbaa !20, !alias.scope !45, !noalias !48, !nonnull !15: {[-1]:Pointer, [-1,-1]:Float@double}, intvals: {}
  %arraysize4 = load i64, i64 addrspace(11)* %20, align 8, !dbg !87, !tbaa !20, !range !56, !alias.scope !45, !noalias !48: {[-1]:Integer}, intvals: {}
  %6 = addrspacecast {} addrspace(10)* %4 to {} addrspace(11)*, !dbg !39: {[-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer, [-1,12]:Integer, [-1,13]:Integer, [-1,14]:Integer, [-1,15]:Integer, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer, [-1,32]:Integer, [-1,33]:Integer, [-1,34]:Integer, [-1,35]:Integer, [-1,36]:Integer, [-1,37]:Integer, [-1,38]:Integer, [-1,39]:Integer}, intvals: {}
  %2 = bitcast {}*** %ptls_field18 to i64***: {[-1]:Pointer}, intvals: {}
  %9 = ptrtoint i8* %arrayptr to i64, !dbg !39: {[-1]:Pointer, [-1,-1]:Integer}, intvals: {}
  %ptls_load1920 = load i64**, i64*** %2, align 8, !tbaa !16: {}, intvals: {}
  %arraysize = load i64, i64 addrspace(11)* %19, align 8, !dbg !87, !tbaa !20, !range !56, !alias.scope !45, !noalias !48: {[-1]:Integer}, intvals: {}
  %1 = call {}*** @julia.get_pgcstack() #20: {}, intvals: {}
double %0: {[-1]:Float@double}, intvals: {}
  %ptls_field18 = getelementptr inbounds {}**, {}*** %1, i64 2: {}, intvals: {}
  %49 = call fastcc double @julia__mapreduce_2791({} addrspace(10)* noalias nocapture nofree noundef nonnull readonly align 16 dereferenceable(40) %21) #20, !dbg !124: {[-1]:Float@double}, intvals: {}
  %7 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %6) #22, !dbg !39: {[-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer, [-1,12]:Integer, [-1,13]:Integer, [-1,14]:Integer, [-1,15]:Integer, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer, [-1,32]:Integer, [-1,33]:Integer, [-1,34]:Integer, [-1,35]:Integer, [-1,36]:Integer, [-1,37]:Integer, [-1,38]:Integer, [-1,39]:Integer}, intvals: {}
  %3 = getelementptr inbounds i64*, i64** %ptls_load1920, i64 2: {[-1]:Pointer}, intvals: {}
  %13 = call fastcc i64 @julia_xoshiro_bulk_simd_2804(i64 zeroext %9, i64 signext %11) #20, !dbg !67: {[-1]:Integer}, intvals: {}
  %value_phi = phi i64 [ %16, %L11 ], [ %9, %top ]: {[-1]:Pointer, [-1,-1]:Integer}, intvals: {}
  %value_phi2 = phi i64 [ %14, %L11 ], [ %11, %top ]: {[-1]:Integer}, intvals: {}
  %21 = call noalias nonnull {} addrspace(10)* @ijl_alloc_array_2d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 2281392098768 to {}*) to {} addrspace(10)*), i64 %arraysize, i64 %arraysize4) #21, !dbg !92: {[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer, [-1,12]:Integer, [-1,13]:Integer, [-1,14]:Integer, [-1,15]:Integer, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer, [-1,32]:Integer, [-1,33]:Integer, [-1,34]:Integer, [-1,35]:Integer, [-1,36]:Integer, [-1,37]:Integer, [-1,38]:Integer, [-1,39]:Integer}, intvals: {}
  %4 = call noalias nonnull {} addrspace(10)* @ijl_alloc_array_2d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 2281392098768 to {}*) to {} addrspace(10)*), i64 noundef 3, i64 noundef 3) #21, !dbg !23: {[-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer, [-1,12]:Integer, [-1,13]:Integer, [-1,14]:Integer, [-1,15]:Integer, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer, [-1,32]:Integer, [-1,33]:Integer, [-1,34]:Integer, [-1,35]:Integer, [-1,36]:Integer, [-1,37]:Integer, [-1,38]:Integer, [-1,39]:Integer}, intvals: {}
</analysis>

Illegal updateAnalysis prev:{[-1]:Pointer, [-1,-1]:Integer} new: {[-1]:Pointer, [-1,-1]:Float@double}
val:   %9 = ptrtoint i8* %arrayptr to i64, !dbg !39 origin=  %9 = ptrtoint i8* %arrayptr to i64, !dbg !39
MethodInstance for f(::Float64)

Caused by:
Stacktrace:
 [1] unsafe_convert
   @ .\pointer.jl:65
 [2] pointer
   @ .\abstractarray.jl:1237
 [3] rand!
   @ C:\Users\Joe\AppData\Local\Programs\Julia-1.10.2\share\julia\stdlib\v1.10\Random\src\XoshiroSimd.jl:293
 [4] rand!
   @ C:\Users\Joe\AppData\Local\Programs\Julia-1.10.2\share\julia\stdlib\v1.10\Random\src\Random.jl:269
 [5] rand
   @ C:\Users\Joe\AppData\Local\Programs\Julia-1.10.2\share\julia\stdlib\v1.10\Random\src\Random.jl:290
 [6] rand
   @ C:\Users\Joe\AppData\Local\Programs\Julia-1.10.2\share\julia\stdlib\v1.10\Random\src\Random.jl:291
 [7] rand
   @ C:\Users\Joe\AppData\Local\Programs\Julia-1.10.2\share\julia\stdlib\v1.10\Random\src\Random.jl:279
 [8] f
   @ .\REPL[2]:2

Stacktrace:
  [1] julia_error(cstr::Cstring, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing}, data2::Ptr{LLVM.API.LLVMOpaqueValue}, B::Ptr{LLVM.API.LLVMOpaqueBuilder})
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:1650
  [2] EnzymeCreateForwardDiff(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{…}, TA::Enzyme.TypeAnalysis, returnValue::Bool, mode::Enzyme.API.CDerivativeMode, width::Int64, additionalArg::Ptr{…}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{…})
    @ Enzyme.API C:\Users\Joe\.julia\dev\Enzyme\src\api.jl:168
  [3] enzyme!(job::GPUCompiler.CompilerJob{…}, mod::LLVM.Module, primalf::LLVM.Function, TT::Type, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, wrap::Bool, modifiedBetween::Tuple{…}, returnPrimal::Bool, expectedTapeType::Type, loweredArgs::Set{…}, boxedArgs::Set{…})
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:3119
  [4] codegen(output::Symbol, job::GPUCompiler.CompilerJob{…}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, toplevel::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:4962
  [5] codegen
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:4389 [inlined]
  [6] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool)
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:5642
  [7] _thunk
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:5642 [inlined]
  [8] cached_compilation
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:5676 [inlined]
  [9] (::Enzyme.Compiler.var"#531#532"{DataType, DataType, DataType, Enzyme.API.CDerivativeMode, Tuple{Bool, Bool}, Int64, Bool, Bool, UInt64, DataType})(ctx::LLVM.Context)
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:5742
 [10] JuliaContext(f::Enzyme.Compiler.var"#531#532"{DataType, DataType, DataType, Enzyme.API.CDerivativeMode, Tuple{Bool, Bool}, Int64, Bool, Bool, UInt64, DataType})
    @ GPUCompiler C:\Users\Joe\.julia\packages\GPUCompiler\U36Ed\src\driver.jl:47
 [11] #s1951#530
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:5694 [inlined]
 [12]
    @ Enzyme.Compiler .\none:0
 [13] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
    @ Core .\boot.jl:602
 [14] autodiff
    @ C:\Users\Joe\.julia\dev\Enzyme\src\Enzyme.jl:382 [inlined]
 [15] autodiff
    @ C:\Users\Joe\.julia\dev\Enzyme\src\Enzyme.jl:300 [inlined]
 [16] autodiff(mode::ForwardMode{FFIABI}, f::typeof(f), args::Duplicated{Float64})
    @ Enzyme C:\Users\Joe\.julia\dev\Enzyme\src\Enzyme.jl:284
 [17] top-level scope
    @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.
wsmoses commented 6 months ago

Should be fixed by https://github.com/EnzymeAD/Enzyme.jl/pull/1413