Skip to content
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

Gradient of matrix determinant errors #709

Closed
jgreener64 opened this issue Apr 9, 2023 · 1 comment
Closed

Gradient of matrix determinant errors #709

jgreener64 opened this issue Apr 9, 2023 · 1 comment

Comments

@jgreener64
Copy link
Contributor

I am on Julia 1.8.5 and Enzyme main (73285ce).

using Enzyme, LinearAlgebra

x = rand(5, 5)
dx = zero(x)

autodiff(Reverse, det, Active, Duplicated(x, dx))

Error message, truncated to fit in the issue limit:

ERROR: LoadError: Enzyme compilation failed.
Current scope:
; ModuleID = 'text'
source_filename = "text"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:10:11:12:13"
target triple = "x86_64-w64-mingw32"

; Function Attrs: uwtable
define internal fastcc noundef i8 @julia_istril_5503({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) unnamed_addr #0 !dbg !36 {
top:
  %1 = alloca { [2 x i64], i64 }, align 8
  %2 = alloca [1 x i64], align 8
  %3 = alloca { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, align 8
  %4 = call {}*** @julia.get_pgcstack()
  %5 = bitcast {} addrspace(10)* %0 to {} addrspace(10)* addrspace(10)*, !dbg !38
  %6 = addrspacecast {} addrspace(10)* addrspace(10)* %5 to {} addrspace(10)* addrspace(11)*, !dbg !38
  %7 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6, i64 3, !dbg !38
  %8 = bitcast {} addrspace(10)* addrspace(11)* %7 to i64 addrspace(11)*, !dbg !38
  %9 = load i64, i64 addrspace(11)* %8, align 8, !dbg !38, !tbaa !43, !range !47, !invariant.load !4
  %10 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6, i64 4, !dbg !38
  %11 = bitcast {} addrspace(10)* addrspace(11)* %10 to i64 addrspace(11)*, !dbg !38
  %12 = load i64, i64 addrspace(11)* %11, align 16, !dbg !38, !tbaa !43, !range !47, !invariant.load !4
  %.not = icmp sgt i64 2, %12, !dbg !48
  %value_phi = select i1 %.not, i64 1, i64 %12, !dbg !54
  br i1 %.not, label %L192, label %L25.preheader, !dbg !60

L25.preheader:                                    ; preds = %top
  %.sroa.049.0..sroa_idx = getelementptr inbounds { [2 x i64], i64 }, { [2 x i64], i64 }* %1, i64 0, i32 0, i64 0
  %.sroa.350.0..sroa_idx51 = getelementptr inbounds { [2 x i64], i64 }, { [2 x i64], i64 }* %1, i64 0, i32 0, i64 1
  %13 = getelementptr inbounds { [2 x i64], i64 }, { [2 x i64], i64 }* %1, i64 0, i32 1
  %14 = icmp ne i64 %9, 0
  %15 = bitcast {} addrspace(10)* %0 to double addrspace(13)* addrspace(10)*
  %16 = addrspacecast double addrspace(13)* addrspace(10)* %15 to double addrspace(13)* addrspace(11)*
  %17 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %16, align 16
  %18 = getelementptr inbounds [1 x i64], [1 x i64]* %2, i64 0, i64 0
  br label %L25, !dbg !61

L25:                                              ; preds = %L25.preheader, %L178
  %indvars.iv = phi i64 [ 1, %L25.preheader ], [ %indvars.iv.next, %L178 ]
  %.lcssa92 = phi i64 [ undef, %L25.preheader ], [ %.lcssa91, %L178 ]
  %value_phi4 = phi i64 [ 2, %L25.preheader ], [ %42, %L178 ]
  %smin = call i64 @llvm.smin.i64(i64 %9, i64 %indvars.iv), !dbg !67
  %smax = call i64 @llvm.smax.i64(i64 %smin, i64 noundef 0), !dbg !67
  %19 = add nuw nsw i64 %smax, 1, !dbg !67
  %smax118 = call i64 @llvm.smax.i64(i64 %19, i64 noundef 2), !dbg !67
  %20 = add nsw i64 %smax118, -1, !dbg !67
  %21 = add i64 %value_phi4, -1, !dbg !67
  %.not60 = icmp slt i64 %9, %21, !dbg !69
  %22 = select i1 %.not60, i64 %9, i64 %21, !dbg !74
  %.inv = icmp sgt i64 %22, 0, !dbg !77
  %.35 = select i1 %.inv, i64 %22, i64 0, !dbg !77
  %23 = icmp slt i64 %.35, 1, !dbg !79
  %24 = and i1 %14, %.inv, !dbg !89
  %25 = or i1 %23, %24, !dbg !92
  %26 = icmp sle i64 %value_phi4, %12, !dbg !94
  %27 = and i1 %26, %25, !dbg !97
  br i1 %27, label %L70, label %L67, !dbg !61

L67:                                              ; preds = %L25
  store i64 1, i64* %.sroa.049.0..sroa_idx, align 8, !dbg !98, !tbaa !99
  store i64 %.35, i64* %.sroa.350.0..sroa_idx51, align 8, !dbg !98, !tbaa !99
  store i64 %value_phi4, i64* %13, align 8, !dbg !98, !tbaa !99
  %28 = addrspacecast { [2 x i64], i64 }* %1 to { [2 x i64], i64 } addrspace(11)*, !dbg !61
  %29 = call fastcc nonnull {} addrspace(10)* @julia_throw_boundserror_5508({} addrspace(10)* nonnull align 16 dereferenceable(40) %0, { [2 x i64], i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(24) %28) #35, !dbg !61
  unreachable, !dbg !61

L70:                                              ; preds = %L25
  %30 = add nsw i64 %value_phi4, -1, !dbg !101
  %31 = mul i64 %9, %30, !dbg !115
  br i1 %.inv, label %L124, label %L178, !dbg !118

L124:                                             ; preds = %L70
  %32 = getelementptr inbounds double, double addrspace(13)* %17, i64 %31, !dbg !128
  %value_phi1574 = load double, double addrspace(13)* %32, align 8, !dbg !133, !tbaa !134
  %33 = fcmp une double %value_phi1574, 0.000000e+00, !dbg !137
  br i1 %33, label %L192.loopexit, label %L132, !dbg !144

L132:                                             ; preds = %L124, %L164
  %34 = phi i64 [ %35, %L164 ], [ %.lcssa92, %L124 ]
  %value_phi1775 = phi i64 [ %35, %L164 ], [ 1, %L124 ]
  %.not61 = icmp eq i64 %value_phi1775, %.35, !dbg !145
  %35 = add nuw nsw i64 %value_phi1775, 1, !dbg !147
  br i1 %.not61, label %L178, label %L145, !dbg !150

L145:                                             ; preds = %L132
  %exitcond = icmp eq i64 %value_phi1775, %20, !dbg !151
  br i1 %exitcond, label %L157, label %L164, !dbg !151

L157:                                             ; preds = %L145
  store i64 %smax118, i64* %18, align 8, !dbg !154, !tbaa !99
  %.fca.0.gep37 = getelementptr inbounds { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }* %3, i64 0, i32 0, !dbg !151
  store {} addrspace(10)* %0, {} addrspace(10)** %.fca.0.gep37, align 8, !dbg !151
  %.fca.1.0.0.gep39 = getelementptr inbounds { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }* %3, i64 0, i32 1, i32 0, i64 0, !dbg !151
  store i64 1, i64* %.fca.1.0.0.gep39, align 8, !dbg !151
  %.fca.1.0.1.gep41 = getelementptr inbounds { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }* %3, i64 0, i32 1, i32 0, i64 1, !dbg !151
  store i64 %.35, i64* %.fca.1.0.1.gep41, align 8, !dbg !151
  %.fca.1.1.gep43 = getelementptr inbounds { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }* %3, i64 0, i32 1, i32 1, !dbg !151
  store i64 %value_phi4, i64* %.fca.1.1.gep43, align 8, !dbg !151
  %.fca.2.gep45 = getelementptr inbounds { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }* %3, i64 0, i32 2, !dbg !151
  store i64 %31, i64* %.fca.2.gep45, align 8, !dbg !151
  %.fca.3.gep47 = getelementptr inbounds { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }* %3, i64 0, i32 3, !dbg !151
  store i64 1, i64* %.fca.3.gep47, align 8, !dbg !151
  %36 = addrspacecast { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }* %3 to { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 } addrspace(11)*, !dbg !151
  %37 = addrspacecast [1 x i64]* %2 to [1 x i64] addrspace(11)*, !dbg !151
  %38 = call fastcc nonnull {} addrspace(10)* @julia_throw_boundserror_5510({ {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(48) %36, [1 x i64] addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) %37) #35, !dbg !151
  unreachable, !dbg !151

L164:                                             ; preds = %L145
  %39 = add i64 %value_phi1775, %31, !dbg !155
  %40 = getelementptr inbounds double, double addrspace(13)* %17, i64 %39, !dbg !155
  %value_phi15 = load double, double addrspace(13)* %40, align 8, !dbg !133, !tbaa !134
  %41 = fcmp une double %value_phi15, 0.000000e+00, !dbg !137
  br i1 %41, label %L192.loopexit, label %L132, !dbg !144

L178:                                             ; preds = %L132, %L70
  %.lcssa91 = phi i64 [ %.lcssa92, %L70 ], [ %34, %L132 ]
  %.not62 = icmp eq i64 %value_phi4, %value_phi, !dbg !157
  %42 = add nuw i64 %value_phi4, 1, !dbg !158
  %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !159
  br i1 %.not62, label %L192.loopexit65, label %L25, !dbg !159

L192.loopexit:                                    ; preds = %L124, %L164
  %.35129 = phi i64 [ %.35, %L164 ], [ %22, %L124 ]
  %storemerge = phi i64 [ %35, %L164 ], [ %.lcssa92, %L124 ]
  store i64 1, i64* %.sroa.049.0..sroa_idx, align 8, !dbg !98, !tbaa !99
  store i64 %.35129, i64* %.sroa.350.0..sroa_idx51, align 8, !dbg !98, !tbaa !99
  store i64 %value_phi4, i64* %13, align 8, !dbg !98, !tbaa !99
  store i64 %storemerge, i64* %18, align 8, !tbaa !99
  br label %L192, !dbg !42

L192.loopexit65:                                  ; preds = %L178
  store i64 1, i64* %.sroa.049.0..sroa_idx, align 8, !dbg !98, !tbaa !99
  store i64 %.35, i64* %.sroa.350.0..sroa_idx51, align 8, !dbg !98, !tbaa !99
  store i64 %value_phi, i64* %13, align 8, !dbg !98, !tbaa !99
  store i64 %.lcssa91, i64* %18, align 8, !tbaa !99
  br label %L192, !dbg !42

L192:                                             ; preds = %L192.loopexit65, %L192.loopexit, %top
  %value_phi31 = phi i8 [ 1, %top ], [ 0, %L192.loopexit ], [ 1, %L192.loopexit65 ]
  ret i8 %value_phi31, !dbg !42
}

; Function Attrs: nofree readnone
declare {}*** @julia.get_pgcstack() local_unnamed_addr #1

; Function Attrs: argmemonly nofree nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: noinline noreturn uwtable
define internal fastcc nonnull {} addrspace(10)* @julia_throw_inexacterror_5501({} addrspace(10)* nonnull %0, i64 signext %1) unnamed_addr #3 !dbg !160 {
top:
  %2 = call {}*** @julia.get_pgcstack()
  %3 = call nonnull {} addrspace(10)* @ijl_box_int64(i64 signext %1), !dbg !161
  %4 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @ijl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708259326848 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708254089312 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %0, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708252789568 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %3), !dbg !161
  %5 = addrspacecast {} addrspace(10)* %4 to {} addrspace(12)*, !dbg !161
  call void @ijl_throw({} addrspace(12)* %5), !dbg !161
  unreachable, !dbg !161
}

; Function Attrs: nofree
declare nonnull {} addrspace(10)* @ijl_invoke({} addrspace(10)*, {} addrspace(10)** nocapture readonly, i32, {} addrspace(10)*) local_unnamed_addr #4

; Function Attrs: inaccessiblememonly nofree
declare noalias nonnull {} addrspace(10)* @ijl_box_int64(i64 signext) local_unnamed_addr #5

; Function Attrs: noreturn
declare void @ijl_throw({} addrspace(12)*) local_unnamed_addr #6

; Function Attrs: uwtable
define internal fastcc double @julia_det_5482({ {} addrspace(10)*, {} addrspace(10)*, i64 } addrspace(11)* nocapture noundef nonnull readonly align 8 dereferenceable(24) %0) unnamed_addr #7 !dbg !162 {
top:
  %1 = alloca [2 x i64], align 8
  %2 = call {}*** @julia.get_pgcstack()
  %3 = getelementptr inbounds { {} addrspace(10)*, {} addrspace(10)*, i64 }, { {} addrspace(10)*, {} addrspace(10)*, i64 } addrspace(11)* %0, i64 0, i32 0, !dbg !163
  %4 = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %3 unordered, align 8, !dbg !163, !tbaa !43, !invariant.load !4, !nonnull !4, !dereferenceable !168, !align !169
  %5 = bitcast {} addrspace(10)* %4 to {} addrspace(10)* addrspace(10)*, !dbg !170
  %6 = addrspacecast {} addrspace(10)* addrspace(10)* %5 to {} addrspace(10)* addrspace(11)*, !dbg !170
  %7 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6, i64 3, !dbg !170
  %8 = bitcast {} addrspace(10)* addrspace(11)* %7 to i64 addrspace(11)*, !dbg !170
  %9 = load i64, i64 addrspace(11)* %8, align 8, !dbg !170, !tbaa !43, !range !47, !invariant.load !4
  %10 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6, i64 4, !dbg !170
  %11 = bitcast {} addrspace(10)* addrspace(11)* %10 to i64 addrspace(11)*, !dbg !170
  %12 = load i64, i64 addrspace(11)* %11, align 8, !dbg !170, !tbaa !43, !range !47, !invariant.load !4
  %.not = icmp eq i64 %9, %12, !dbg !172
  br i1 %.not, label %L15, label %L7, !dbg !174

L7:                                               ; preds = %top
  %13 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0, !dbg !175
  store i64 %9, i64* %13, align 8, !dbg !175, !tbaa !99
  %14 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 1, !dbg !175
  store i64 %12, i64* %14, align 8, !dbg !175, !tbaa !99
  %15 = addrspacecast [2 x i64]* %1 to [2 x i64] addrspace(11)*, !dbg !174
  %16 = call nonnull {} addrspace(10)* @julia_string_5485({} addrspace(10)* noundef nonnull addrspacecast ({}* inttoptr (i64 140708302071552 to {}*) to {} addrspace(10)*), [2 x i64] addrspace(11)* nocapture noundef nonnull readonly align 8 dereferenceable(16) %15) #36, !dbg !174
  %current_task1522 = getelementptr inbounds {}**, {}*** %2, i64 -12, !dbg !174
  %current_task15 = bitcast {}*** %current_task1522 to {}**, !dbg !174
  %17 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task15, i64 8, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708257267248 to {}*) to {} addrspace(10)*)) #37, !dbg !174
  %18 = bitcast {} addrspace(10)* %17 to {} addrspace(10)* addrspace(10)*, !dbg !174
  store {} addrspace(10)* %16, {} addrspace(10)* addrspace(10)* %18, align 8, !dbg !174, !tbaa !177
  %19 = addrspacecast {} addrspace(10)* %17 to {} addrspace(12)*, !dbg !174
  call void @ijl_throw({} addrspace(12)* %19), !dbg !174
  unreachable, !dbg !174

L15:                                              ; preds = %top
  %20 = getelementptr inbounds { {} addrspace(10)*, {} addrspace(10)*, i64 }, { {} addrspace(10)*, {} addrspace(10)*, i64 } addrspace(11)* %0, i64 0, i32 2, !dbg !180
  %21 = load i64, i64 addrspace(11)* %20, align 8, !dbg !185, !tbaa !43, !invariant.load !4
  %.not16 = icmp eq i64 %21, 0, !dbg !185
  br i1 %.not16, label %L18, label %common.ret, !dbg !184

L18:                                              ; preds = %L15
  %.not18.not = icmp eq i64 %9, 0, !dbg !186
  br i1 %.not18.not, label %oksrem.thread, label %L36.preheader, !dbg !194

L36.preheader:                                    ; preds = %L18
  %22 = bitcast {} addrspace(10)* %4 to double addrspace(13)* addrspace(10)*
  %23 = addrspacecast double addrspace(13)* addrspace(10)* %22 to double addrspace(13)* addrspace(11)*
  %24 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %23, align 8, !tbaa !43, !invariant.load !4, !nonnull !4
  %25 = getelementptr inbounds { {} addrspace(10)*, {} addrspace(10)*, i64 }, { {} addrspace(10)*, {} addrspace(10)*, i64 } addrspace(11)* %0, i64 0, i32 1
  %26 = bitcast {} addrspace(10)* addrspace(11)* %25 to i64 addrspace(13)* addrspace(10)* addrspace(11)*
  %27 = load atomic i64 addrspace(13)* addrspace(10)*, i64 addrspace(13)* addrspace(10)* addrspace(11)* %26 unordered, align 8, !tbaa !43, !invariant.load !4, !nonnull !4, !dereferenceable !168, !align !169
  %28 = addrspacecast i64 addrspace(13)* addrspace(10)* %27 to i64 addrspace(13)* addrspace(11)*
  %29 = load i64 addrspace(13)*, i64 addrspace(13)* addrspace(11)* %28, align 8, !tbaa !195, !nonnull !4
  br label %L36, !dbg !198

L36:                                              ; preds = %L36.preheader, %L36
  %value_phi4 = phi i64 [ %39, %L36 ], [ 1, %L36.preheader ]
  %value_phi6 = phi i64 [ %value_phi8, %L36 ], [ 0, %L36.preheader ]
  %value_phi7 = phi double [ %35, %L36 ], [ 1.000000e+00, %L36.preheader ]
  %30 = add nsw i64 %value_phi4, -1, !dbg !199
  %31 = mul i64 %9, %30, !dbg !199
  %32 = add i64 %30, %31, !dbg !199
  %33 = getelementptr inbounds double, double addrspace(13)* %24, i64 %32, !dbg !199
  %34 = load double, double addrspace(13)* %33, align 8, !dbg !199, !tbaa !134
  %35 = fmul double %value_phi7, %34, !dbg !202
  %36 = getelementptr inbounds i64, i64 addrspace(13)* %29, i64 %30, !dbg !204
  %37 = load i64, i64 addrspace(13)* %36, align 8, !dbg !204, !tbaa !134
  %.not19 = icmp ne i64 %37, %value_phi4, !dbg !206
  %38 = zext i1 %.not19 to i64, !dbg !205
  %value_phi8 = add i64 %value_phi6, %38, !dbg !205
  %.not20.not = icmp eq i64 %value_phi4, %9, !dbg !209
  %39 = add nuw nsw i64 %value_phi4, 1, !dbg !210
  br i1 %.not20.not, label %oksrem, label %L36, !dbg !198

common.ret:                                       ; preds = %oksrem.thread, %oksrem, %L15
  %common.ret.op = phi double [ 0.000000e+00, %L15 ], [ %value_phi1325, %oksrem.thread ], [ %40, %oksrem ]
  ret double %common.ret.op, !dbg !211

oksrem:                                           ; preds = %L36
  %phi.bo = and i64 %value_phi8, 1, !dbg !212
  %phi.cmp = icmp eq i64 %phi.bo, 0, !dbg !212
  %40 = fneg double %35, !dbg !218
  br i1 %phi.cmp, label %oksrem.thread, label %common.ret, !dbg !218

oksrem.thread:                                    ; preds = %L18, %oksrem
  %value_phi1325 = phi double [ %35, %oksrem ], [ 1.000000e+00, %L18 ]
  br label %common.ret, !dbg !218
}

; Function Attrs: inaccessiblememonly allocsize(1)
declare noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}**, i64, {} addrspace(10)*) local_unnamed_addr #8

; Function Attrs: noinline noreturn uwtable
define internal fastcc noalias nonnull align 536870912 dereferenceable(4294967295) {} addrspace(10)* @julia_throw_boundserror_5508({} addrspace(10)* nonnull align 16 dereferenceable(40) %0, { [2 x i64], i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(24) %1) unnamed_addr #9 !dbg !220 {
top:
  %2 = call {}*** @julia.get_pgcstack()
  %current_task12 = getelementptr inbounds {}**, {}*** %2, i64 -12, !dbg !221
  %current_task1 = bitcast {}*** %current_task12 to {}**, !dbg !221
  %3 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 140708254192976 to {}*) to {} addrspace(10)*)) #37, !dbg !221
  %4 = bitcast {} addrspace(10)* %3 to i8 addrspace(10)*, !dbg !221
  %5 = bitcast { [2 x i64], i64 } addrspace(11)* %1 to i8 addrspace(11)*, !dbg !221
  call void @llvm.memcpy.p10i8.p11i8.i64(i8 addrspace(10)* noundef nonnull align 8 dereferenceable(24) %4, i8 addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(24) %5, i64 noundef 24, i1 noundef false), !dbg !221, !tbaa !222
  %6 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @ijl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708294987248 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708252892384 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %0, {} addrspace(10)* nonnull %3), !dbg !221
  %7 = addrspacecast {} addrspace(10)* %6 to {} addrspace(12)*, !dbg !221
  call void @ijl_throw({} addrspace(12)* %7) #38, !dbg !221
  unreachable, !dbg !221
}

; Function Attrs: argmemonly nofree nounwind willreturn
declare void @llvm.memcpy.p10i8.p11i8.i64(i8 addrspace(10)* noalias nocapture writeonly, i8 addrspace(11)* noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: noinline noreturn uwtable
define internal fastcc nonnull {} addrspace(10)* @julia__throw_argerror_5499() unnamed_addr #10 !dbg !223 {
top:
  %0 = call {}*** @julia.get_pgcstack()
  %current_task12 = getelementptr inbounds {}**, {}*** %0, i64 -12, !dbg !224
  %current_task1 = bitcast {}*** %current_task12 to {}**, !dbg !224
  %1 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 8, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708252869856 to {}*) to {} addrspace(10)*)) #37, !dbg !224
  %2 = bitcast {} addrspace(10)* %1 to {} addrspace(10)* addrspace(10)*, !dbg !224
  store {} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708307593520 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspace(10)* %2, align 8, !dbg !224, !tbaa !177
  %3 = addrspacecast {} addrspace(10)* %1 to {} addrspace(12)*, !dbg !224
  call void @ijl_throw({} addrspace(12)* %3), !dbg !224
  unreachable, !dbg !224
}

; Function Attrs: noinline noreturn uwtable
define internal fastcc noalias nonnull align 536870912 dereferenceable(4294967295) {} addrspace(10)* @julia_throw_boundserror_5510({ {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(48) %0, [1 x i64] addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) %1) unnamed_addr #11 !dbg !225 {
top:
  %2 = call {}*** @julia.get_pgcstack()
  %current_task13 = getelementptr inbounds {}**, {}*** %2, i64 -12, !dbg !226
  %current_task1 = bitcast {}*** %current_task13 to {}**, !dbg !226
  %3 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 48, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 2160513537120 to {}*) to {} addrspace(10)*)) #37, !dbg !226
  %4 = bitcast {} addrspace(10)* %3 to i8 addrspace(10)*, !dbg !226
  %5 = bitcast { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 } addrspace(11)* %0 to i8 addrspace(11)*, !dbg !226
  call void @llvm.memcpy.p10i8.p11i8.i64(i8 addrspace(10)* noundef nonnull align 8 dereferenceable(48) %4, i8 addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(48) %5, i64 noundef 48, i1 noundef false), !dbg !226, !tbaa !222
  %6 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 140708253670272 to {}*) to {} addrspace(10)*)) #37, !dbg !226
  %7 = getelementptr inbounds [1 x i64], [1 x i64] addrspace(11)* %1, i64 0, i64 0, !dbg !226
  %8 = bitcast {} addrspace(10)* %6 to i64 addrspace(10)*, !dbg !226
  %9 = load i64, i64 addrspace(11)* %7, align 8, !dbg !226, !tbaa !43, !invariant.load !4
  store i64 %9, i64 addrspace(10)* %8, align 8, !dbg !226, !tbaa !177
  %10 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @ijl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708269303328 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 140708252892384 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %3, {} addrspace(10)* nonnull %6), !dbg !226
  %11 = addrspacecast {} addrspace(10)* %10 to {} addrspace(12)*, !dbg !226
  call void @ijl_throw({} addrspace(12)* %11) #38, !dbg !226
  unreachable, !dbg !226
}

; Function Attrs: uwtable
define internal fastcc noundef i8 @julia_istriu_5533({} addrspace(10)* nonnull align 16 dereferenceable(40) %0) unnamed_addr #0 !dbg !227 {
top:
  %1 = alloca { [2 x i64], i64 }, align 8
  %2 = alloca [1 x i64], align 8
  %3 = alloca { {} addrspace(10)*, { [2 x i64], i64 }, i64, i64 }, align 8
  %4 = call {}*** @julia.get_pgcstack()
  %5 = bitcast {} addrspace(10)* %0 to {} addrspace(10)* addrspace(10)*, !dbg !228
  %6 = addrspacecast {} addrspace(10)* addrspace(10)* %5 to {} addrspace(10)* addrspace(11)*, !dbg !228
  %7 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6, i64 3, !dbg !228
  %8 = bitcast {} addrspace(10)* addrspace(11)* %7 to i64 addrspace(11)*, !dbg !228
  %9 = load i64, i64 addrspace(11)* %8, align 8, !dbg !228, !tbaa !43, !range !47, !invariant.load !4
  %10 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %6, i64 4, !dbg !228
  %11 = bitcast {} addrspace(10)* addrspace(11)* %10 to i64 addrspace(11)*, !dbg !228
  %12 = load i64, i64 addrspace(11)* %11, align 16, !dbg !228, !tbaa !43, !range !47, !invariant.load !4
  %13 = add i64 -1, %9, !dbg !233
  %.not = icmp slt i64 %13, %12, !dbg !236
  %14 = select i1 %.not, i64 %13, i64 %12, !dbg !240
  %.inv = icmp sgt i64 %14, 0, !dbg !242
  %. = select i1 %.inv, i64 %14, i64 0, !dbg !242
  br i1 %.inv, label %L25.preheader, label %L196, !dbg !235

L25.preheader:                                    ; preds = %top
  %.sroa.047.0..sroa_idx = getelementptr inbounds { [2 x i64], i64 }, { [2 x i64], i64 }* %1, i64 0, i32 0, i64 0
  %.sroa.348.0..sroa_idx49 = getelementptr inbounds { [2 x i64], i64 }, { [2 x i64], i64 }* %1, i64 0, i32 0, i64 1
  %15 = getelementptr inbounds { [2 x i64], i64 }, { [2 x i64], i64 }* %1, i64 0, i32 1
  %16 = bitcast {} addrspace(10)* %0 to double addrspace(13)* addrspace(10)*
  %17 = addrspacecast double addrspace(13)* addrspace(10)* %16 to double addrspace(13)* addrspace(11)*
  %18 = load double addrspace(13)*, double addrspace(13)* addrspace(11)* %17, align 16
  %19 = getelementptr inbounds [1 x i64], [1 x i64]* %2, i64 0, i64 0
  br label %L25, !dbg !248

[...]

!1461 = !DILocation(line: 459, scope: !740, inlinedAt: !1462)
!1462 = !DILocation(line: 468, scope: !740, inlinedAt: !1463)
!1463 = !DILocation(line: 378, scope: !743, inlinedAt: !1464)
!1464 = !DILocation(line: 797, scope: !745, inlinedAt: !1459)
!1465 = !DILocation(line: 8, scope: !747, inlinedAt: !1466)
!1466 = !DILocation(line: 104, scope: !750, inlinedAt: !1467)
!1467 = !DILocation(line: 412, scope: !753, inlinedAt: !1468)
!1468 = !DILocation(line: 565, scope: !1447)
!1469 = !DILocation(line: 65, scope: !758, inlinedAt: !1468)
!1470 = !DILocation(line: 30, scope: !760, inlinedAt: !1471)
!1471 = !DILocation(line: 50, scope: !762, inlinedAt: !1468)
!1472 = !DILocation(line: 38, scope: !764, inlinedAt: !1473)
!1473 = !DILocation(line: 56, scope: !766, inlinedAt: !1474)
!1474 = !DILocation(line: 569, scope: !1447)
!1475 = !DILocation(line: 83, scope: !728, inlinedAt: !1476)
!1476 = !DILocation(line: 29, scope: !770, inlinedAt: !1474)
!1477 = !DILocation(line: 85, scope: !772, inlinedAt: !1478)
!1478 = !DILocation(line: 30, scope: !770, inlinedAt: !1474)
!1479 = !DILocation(line: 570, scope: !1447)
!1480 = distinct !DISubprogram(name: "getrf!", linkageName: "julia_getrf!_5487", scope: null, file: !35, line: 558, type: !37, scopeLine: 558, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !34, retainedNodes: !4)
!1481 = !DILocation(line: 214, scope: !720, inlinedAt: !1482)
!1482 = !DILocation(line: 212, scope: !722, inlinedAt: !1483)
!1483 = !DILocation(line: 560, scope: !1480)
!1484 = !DILocation(line: 152, scope: !725, inlinedAt: !1485)
!1485 = !DILocation(line: 561, scope: !1480)
!1486 = !DILocation(line: 83, scope: !728, inlinedAt: !1487)
!1487 = !DILocation(line: 488, scope: !730, inlinedAt: !1488)
!1488 = !DILocation(line: 562, scope: !1480)
!1489 = !DILocation(line: 489, scope: !733, inlinedAt: !1487)
!1490 = !DILocation(line: 83, scope: !728, inlinedAt: !1491)
!1491 = !DILocation(line: 489, scope: !736, inlinedAt: !1492)
!1492 = !DILocation(line: 563, scope: !1480)
!1493 = !DILocation(line: 489, scope: !733, inlinedAt: !1491)
!1494 = !DILocation(line: 459, scope: !740, inlinedAt: !1495)
!1495 = !DILocation(line: 468, scope: !740, inlinedAt: !1496)
!1496 = !DILocation(line: 378, scope: !743, inlinedAt: !1497)
!1497 = !DILocation(line: 797, scope: !745, inlinedAt: !1492)
!1498 = !DILocation(line: 8, scope: !747, inlinedAt: !1499)
!1499 = !DILocation(line: 104, scope: !750, inlinedAt: !1500)
!1500 = !DILocation(line: 412, scope: !753, inlinedAt: !1501)
!1501 = !DILocation(line: 565, scope: !1480)
!1502 = !DILocation(line: 65, scope: !758, inlinedAt: !1501)
!1503 = !DILocation(line: 30, scope: !760, inlinedAt: !1504)
!1504 = !DILocation(line: 50, scope: !762, inlinedAt: !1501)
!1505 = !DILocation(line: 38, scope: !764, inlinedAt: !1506)
!1506 = !DILocation(line: 56, scope: !766, inlinedAt: !1507)
!1507 = !DILocation(line: 569, scope: !1480)
!1508 = !DILocation(line: 83, scope: !728, inlinedAt: !1509)
!1509 = !DILocation(line: 29, scope: !770, inlinedAt: !1507)
!1510 = !DILocation(line: 85, scope: !772, inlinedAt: !1511)
!1511 = !DILocation(line: 30, scope: !770, inlinedAt: !1507)
!1512 = !DILocation(line: 570, scope: !1480)

No augmented forward pass found for dgetrf_64_
declare void @dgetrf_64_(i8*, i8*, i64, i8*, i64, i64) local_unnamed_addr #25



Stacktrace:
  [1] julia_error(cstr::Cstring, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing})
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:5080
  [2] EnzymeCreatePrimalAndGradient(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{Enzyme.API.CDIFFE_TYPE}, TA::Enzyme.TypeAnalysis, returnValue::Bool, dretUsed::Bool, mode::Enzyme.API.CDerivativeMode, width::Int64, additionalArg::Ptr{Nothing}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool}, augmented::Ptr{Nothing}, atomicAdd::Bool)
    @ Enzyme.API C:\Users\Joe\.julia\dev\Enzyme\src\api.jl:123
  [3] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, mod::LLVM.Module, primalf::LLVM.Function, TT::Type, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, wrap::Bool, modifiedBetween::Tuple{Bool, Bool}, returnPrimal::Bool, jlrules::Vector{String}, expectedTapeType::Type)
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:6562
  [4] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, ctx::LLVM.Context, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ Enzyme.Compiler C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:7817
  [5] _thunk
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:8329 [inlined]
  [6] _thunk
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:8326 [inlined]
  [7] cached_compilation
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:8362 [inlined]
  [8] #s260#178
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:8424 [inlined]
  [9] var"#s260#178"(FA::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, ReturnPrimal::Any, ShadowInit::Any, parent_job::Any, World::Any, ::Any, ::Any, ::Any, ::Any, tt::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
    @ Enzyme.Compiler .\none:0
 [10] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
    @ Core .\boot.jl:582
 [11] thunk (repeats 2 times)
    @ C:\Users\Joe\.julia\dev\Enzyme\src\compiler.jl:8379 [inlined]
 [12] autodiff(#unused#::EnzymeCore.ReverseMode{false}, f::Const{typeof(det)}, #unused#::Type{Active}, args::Duplicated{Matrix{Float64}})
    @ Enzyme C:\Users\Joe\.julia\dev\Enzyme\src\Enzyme.jl:199
 [13] autodiff(::EnzymeCore.ReverseMode{false}, ::typeof(det), ::Type, ::Duplicated{Matrix{Float64}})
    @ Enzyme C:\Users\Joe\.julia\dev\Enzyme\src\Enzyme.jl:214
 [14] top-level scope
    @ C:\Users\Joe\Downloads\temp.jl:6
 [15] include(fname::String)
    @ Base.MainInclude .\client.jl:476
 [16] top-level scope
    @ REPL[1]:1
in expression starting at C:\Users\Joe\Downloads\temp.jl:6
@wsmoses
Copy link
Member

wsmoses commented Apr 9, 2023

Duplicate of #241

@wsmoses wsmoses marked this as a duplicate of #241 Apr 9, 2023
@wsmoses wsmoses closed this as completed Apr 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants