Just installed Julia 1.7.1, simple examples now crashing

I had some coding running perfectly fine in an (outdated) version of Julia, which I didn’t realize was outdated as I don’t often keep up to date with these things (1.6.1). Between yesterday and today without changing anything or downloading anything, I’m now not able to precompile DiffEqFlux and am unsure why. I get the following error:
failed to precompile DiffEqFlux [aae7a2af-3d4f-5e19-a356-7da93b79d9d0] to /Users/myname/.julia/compiled/v1.6/DiffEqFlux/jl_zS3YoL)

I was confused but figured I should work on the newest version so I installed 1.7.1. However, DiffEqFlux is no longer working for me at all. This is a recent installation as of this morning. Tried uninstalling and reinstalling to no avail. Directly copy-and-pasting the code from the first DiffEqFlux example here in IJulia causes it to crash when it gets to the DiffEqFlux.sciml_train(…) line.

When I run it through the terminal, it also crashes, giving me a very long error starting with
define internal fastcc nonnull {} addrspace(10)* @preprocess_julia_ddz__10313({} addrspace(10)* nonnull align 16 dereferenceable(40) %0, {} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %1, {} addrspace(10)* nonnull align 16 dereferenceable(40) %2, double %3) unnamed_addr #0 !dbg !121...
and ending with
Assertion failed: (0 && "number of arg operands != function parameters"), function visitCallInst, file /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h, line 8296.
signal (6): Abort trap: 6 in expression starting at /Users/myname/Documents/test1.jl:148 __pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line) Allocations: 376132310 (Pool: 376063032; Big: 69278); GC: 140 zsh: abort julia test1.jl

I’m confused because I didn’t change anything – left my computer on overnight, and what was working suddenly no longer is. Didn’t download anything beyond a couple text files. I’m on OSX 11.3.1 with an M1 chip and the appropriate Julia installation for M1. I don’t know how to interpret this error so any help would be greatly appreciated.

@vchuravy some Enzyme M1 bug?

1 Like

I’d recommend trying this with either L(ong)T(term)S(support) (1.6.5) or 1.7.1 and local environments.

Does it work if you install the Intel version and use Rosetta?

1 Like

Upgrading to 1.6.5 didn’t do anything for me (still the same “failed to precompile error”, unsure where that’s coming from). Using the Intel version with Rosetta works though, so it must be something with the M1 integration.
Much appreciated!

Do you still have the full crash log? If so I would appreciate it being posted either here or to the the Enzyme.jl bug-tracker (GitHub - wsmoses/Enzyme.jl: Julia bindings for the Enzyme automatic differentiator)

cc: @wsmoses

I do!

define internal fastcc nonnull {} addrspace(10)* @preprocess_julia_ddz__10313({} addrspace(10)* nonnull align 16 dereferenceable(40) %0, {} addrspace(10)* nocapture nonnull readonly align 16 dereferenceable(40) %1, {} addrspace(10)* nonnull align 16 dereferenceable(40) %2, double %3) unnamed_addr #0 !dbg !121 {
top:
  %4 = call {}*** @julia.get_pgcstack()
  %5 = bitcast {} addrspace(10)* %1 to { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(10)*, !dbg !122
  %6 = addrspacecast { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(10)* %5 to { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)*, !dbg !122
  %7 = getelementptr inbounds { i8 addrspace(13)*, i64, i16, i16, i32 }, { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)* %6, i64 0, i32 1, !dbg !122
  %8 = load i64, i64 addrspace(11)* %7, align 8, !dbg !122, !tbaa !48, !range !53
  %.not = icmp eq i64 %8, 0, !dbg !122
  br i1 %.not, label %oob, label %idxend, !dbg !122

oob:                                              ; preds = %top
  call void @llvm.trap() #8, !dbg !122
  unreachable, !dbg !122

idxend:                                           ; preds = %top
  %9 = bitcast {} addrspace(10)* %1 to double addrspace(13)* addrspace(10)*, !dbg !122
  %10 = addrspacecast double addrspace(13)* addrspace(10)* %9 to double addrspace(13)* addrspace(11)*, !dbg !122
  %11 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %10, align 16, !dbg !122, !tbaa !54, !nonnull !4
  %12 = load double, double addrspace(13)* %11, align 8, !dbg !122, !tbaa !56
  %.not66 = icmp eq i64 %8, 1, !dbg !126
  br i1 %.not66, label %oob1, label %idxend2, !dbg !126

oob1:                                             ; preds = %idxend
  call void @llvm.trap() #8, !dbg !126
  unreachable, !dbg !126

idxend2:                                          ; preds = %idxend
  %13 = getelementptr inbounds double, double addrspace(13)* %11, i64 1, !dbg !126
  %14 = load double, double addrspace(13)* %13, align 8, !dbg !126, !tbaa !56
  %15 = icmp ugt i64 %8, 2, !dbg !126
  br i1 %15, label %idxend4, label %oob3, !dbg !126

oob3:                                             ; preds = %idxend2
  call void @llvm.trap() #8, !dbg !126
  unreachable, !dbg !126

idxend4:                                          ; preds = %idxend2
  %16 = getelementptr inbounds double, double addrspace(13)* %11, i64 2, !dbg !126
  %17 = load double, double addrspace(13)* %16, align 8, !dbg !126, !tbaa !56
  %.not67 = icmp eq i64 %8, 3, !dbg !126
  br i1 %.not67, label %oob5, label %pass.1, !dbg !126

oob5:                                             ; preds = %idxend4
  call void @llvm.trap() #8, !dbg !126
  unreachable, !dbg !126

oob16:                                            ; preds = %pass.1
  call void @llvm.trap() #8, !dbg !127
  unreachable, !dbg !127

idxend17:                                         ; preds = %pass.1
  %18 = bitcast {} addrspace(10)* %0 to double addrspace(13)* addrspace(10)*, !dbg !127
  %19 = addrspacecast double addrspace(13)* addrspace(10)* %18 to double addrspace(13)* addrspace(11)*, !dbg !127
  %20 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %19, align 16, !dbg !127, !tbaa !54, !nonnull !4
  store double %17, double addrspace(13)* %20, align 8, !dbg !127, !tbaa !56
  %.not68 = icmp eq i64 %71, 1, !dbg !129
  br i1 %.not68, label %oob18, label %idxend19, !dbg !129

oob18:                                            ; preds = %idxend17
  call void @llvm.trap() #8, !dbg !129
  unreachable, !dbg !129

idxend19:                                         ; preds = %idxend17
  %21 = getelementptr inbounds double, double addrspace(13)* %20, i64 1, !dbg !129
  store double %47, double addrspace(13)* %21, align 8, !dbg !129, !tbaa !56
  %22 = fmul double %14, 1.000000e-02, !dbg !131
  %23 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4914148528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %67, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*)), !dbg !132
  %ptls_load225253 = load i8*, i8** %55, align 8, !dbg !132, !tbaa !69
  %24 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load225253, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4857921120 to {}*) to {} addrspace(10)*)) #9, !dbg !132
  %25 = bitcast {} addrspace(10)* %24 to double addrspace(10)*, !dbg !132
  store double %17, double addrspace(10)* %25, align 8, !dbg !132, !tbaa !71
  %26 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4896519312 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %24, {} addrspace(10)* nonnull %23), !dbg !132
  %ptls_load255657 = load i8*, i8** %55, align 8, !dbg !132, !tbaa !69
  %27 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load255657, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4857921120 to {}*) to {} addrspace(10)*)) #9, !dbg !132
  %28 = bitcast {} addrspace(10)* %27 to double addrspace(10)*, !dbg !132
  store double %22, double addrspace(10)* %28, align 8, !dbg !132, !tbaa !71
  %29 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4871997776 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %27, {} addrspace(10)* nonnull %26), !dbg !132
  %30 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4914148528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %54, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*)), !dbg !132
  %31 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4878911504 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %30), !dbg !132
  %32 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4896519312 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %29, {} addrspace(10)* nonnull %31), !dbg !132
  %33 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4920227936 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %0, {} addrspace(10)* nonnull %32, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871136 to {}*) to {} addrspace(10)*)), !dbg !132
  %34 = fmul double %12, -5.000000e-03, !dbg !133
  %35 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4914148528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %67, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*)), !dbg !134
  %ptls_load286061 = load i8*, i8** %55, align 8, !dbg !134, !tbaa !69
  %36 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load286061, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4857921120 to {}*) to {} addrspace(10)*)) #9, !dbg !134
  %37 = bitcast {} addrspace(10)* %36 to double addrspace(10)*, !dbg !134
  store double %47, double addrspace(10)* %37, align 8, !dbg !134, !tbaa !71
  %38 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4896519312 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %36, {} addrspace(10)* nonnull %35), !dbg !134
  %ptls_load316465 = load i8*, i8** %55, align 8, !dbg !134, !tbaa !69
  %39 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load316465, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4857921120 to {}*) to {} addrspace(10)*)) #9, !dbg !134
  %40 = bitcast {} addrspace(10)* %39 to double addrspace(10)*, !dbg !134
  store double %34, double addrspace(10)* %40, align 8, !dbg !134, !tbaa !71
  %41 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4871997776 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %39, {} addrspace(10)* nonnull %38), !dbg !134
  %42 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4914148528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %54, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*)), !dbg !134
  %43 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4878911504 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %42), !dbg !134
  %44 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4896519312 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %41, {} addrspace(10)* nonnull %43), !dbg !134
  %45 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4920227936 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %0, {} addrspace(10)* nonnull %44, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871200 to {}*) to {} addrspace(10)*)), !dbg !134
  ret {} addrspace(10)* undef, !dbg !134

pass.1:                                           ; preds = %idxend4
  %46 = getelementptr inbounds double, double addrspace(13)* %11, i64 3, !dbg !126
  %47 = load double, double addrspace(13)* %46, align 8, !dbg !126, !tbaa !56
  %48 = call nonnull {} addrspace(10)* @jl_alloc_array_1d({} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4862461968 to {}*) to {} addrspace(10)*), i64 noundef 2), !dbg !135
  %49 = bitcast {} addrspace(10)* %48 to double addrspace(13)* addrspace(10)*
  %50 = addrspacecast double addrspace(13)* addrspace(10)* %49 to double addrspace(13)* addrspace(11)*
  %51 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %50, align 8, !dbg !143, !tbaa !54, !nonnull !4
  store double %47, double addrspace(13)* %51, align 8, !dbg !143, !tbaa !56
  %52 = getelementptr inbounds double, double addrspace(13)* %51, i64 1, !dbg !143
  store double %3, double addrspace(13)* %52, align 8, !dbg !143, !tbaa !56
  %53 = load atomic {} addrspace(10)*, {} addrspace(10)** inttoptr (i64 5781943640 to {} addrspace(10)**) unordered, align 8, !dbg !144, !tbaa !92
  %54 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* %53, {} addrspace(10)* nonnull %48, {} addrspace(10)* nonnull %2), !dbg !144
  %ptls_field42 = getelementptr inbounds {}**, {}*** %4, i64 2305843009213693954, !dbg !145
  %55 = bitcast {}*** %ptls_field42 to i8**, !dbg !145
  %ptls_load4344 = load i8*, i8** %55, align 8, !dbg !145, !tbaa !69
  %56 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load4344, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 12342971856 to {}*) to {} addrspace(10)*)) #9, !dbg !145
  %57 = bitcast {} addrspace(10)* %56 to {} addrspace(10)* addrspace(10)*, !dbg !145
  store {} addrspace(10)* %2, {} addrspace(10)* addrspace(10)* %57, align 8, !dbg !145, !tbaa !71
  %58 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @jl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 12342975456 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5860802632 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %56, {} addrspace(10)* nonnull %48), !dbg !145
  %59 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_f_getfield to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* null, {} addrspace(10)* nonnull %58, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5098028216 to {}*) to {} addrspace(10)*)), !dbg !147
  %60 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_f_getfield to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* null, {} addrspace(10)* nonnull %59, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4858478912 to {}*) to {} addrspace(10)*)), !dbg !148
  %61 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4914148528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %60, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4858336448 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*)), !dbg !146
  %ptls_load154748 = load i8*, i8** %55, align 8, !dbg !149, !tbaa !69
  %62 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj(i8* %ptls_load154748, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5985078576 to {}*) to {} addrspace(10)*)) #9, !dbg !149
  %63 = bitcast {} addrspace(10)* %62 to {} addrspace(10)* addrspace(10)*, !dbg !149
  store {} addrspace(10)* %2, {} addrspace(10)* addrspace(10)* %63, align 8, !dbg !149, !tbaa !71
  %64 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @jl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 12342975456 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5860802632 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %62, {} addrspace(10)* nonnull %48), !dbg !149
  %65 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_f_getfield to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* null, {} addrspace(10)* nonnull %64, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5098028216 to {}*) to {} addrspace(10)*)), !dbg !151
  %66 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_f_getfield to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* null, {} addrspace(10)* nonnull %65, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4858478912 to {}*) to {} addrspace(10)*)), !dbg !152
  %67 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_apply_generic to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 4914148528 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %66, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4858336448 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871072 to {}*) to {} addrspace(10)*)), !dbg !150
  %68 = bitcast {} addrspace(10)* %0 to { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(10)*, !dbg !127
  %69 = addrspacecast { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(10)* %68 to { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)*, !dbg !127
  %70 = getelementptr inbounds { i8 addrspace(13)*, i64, i16, i16, i32 }, { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)* %69, i64 0, i32 1, !dbg !127
  %71 = load i64, i64 addrspace(11)* %70, align 8, !dbg !127, !tbaa !48, !range !53
  %.not49 = icmp eq i64 %71, 0, !dbg !127
  br i1 %.not49, label %oob16, label %idxend17, !dbg !127
}

  %66 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_f_getfield to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* null, {} addrspace(10)* nonnull %65, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4376871008 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4858478912 to {}*) to {} addrspace(10)*)), !dbg !106
Assertion failed: (0 && "number of arg operands != function parameters"), function visitCallInst, file /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h, line 8296.

signal (6): Abort trap: 6
in expression starting at /Users/myname/Documents/test1.jl:148
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 376132310 (Pool: 376063032; Big: 69278); GC: 140
zsh: abort      julia test1.jl

The easy immediate fix is to add a custom runtime handler for getfield, though @ChrisRackauckas I’d also question why an untyped getfield is being.

1 Like

@clm can you try using the gfield branch of Enzyme.jl, I just added a conversion to a runtime error for getfield. I want to confirm that you just get the desired runtime error, or it just works.

We can add a proper definition (non runtime error) for getfield shortly.