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

[ForwardMode] unimplemented derivative for trtrs #1991

Open
mhauru opened this issue Oct 21, 2024 · 0 comments
Open

[ForwardMode] unimplemented derivative for trtrs #1991

mhauru opened this issue Oct 21, 2024 · 0 comments

Comments

@mhauru
Copy link
Contributor

mhauru commented Oct 21, 2024

MWE:

using Distributions
using Enzyme: Enzyme
using PDMats: PDMat

d = MvNormal([-0.15], PDMat([6.1;;]))
x = [-0.05]
Enzyme.gradient(Enzyme.Forward, Enzyme.Const(x -> logpdf(d, x)), x)

Output:

^[ERROR: Current scope:
; Function Attrs: mustprogress willreturn
define internal fastcc nonnull "enzyme_type"="{[-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}" {} addrspace(10)* @preprocess_julia_trtrs__2820(i32 noundef zeroext "enzyme_inactive" "enzyme_type"="{[-1]:Integer}" "enzymejl_parmtype"="5196160368" "enzymejl_parmtype_ref"="0" %0, i32 noundef zeroext "enzyme_inactive" "enzyme_type"="{[-1]:Integer}" "enzymejl_parmtype"="5196160368" "enzymejl_parmtype_ref"="0" %1, {} addrspace(10)* noundef nonnull align 16 dereferenceable(40) "enzyme_type"="{[-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}" "enzymejl_parmtype"="6150064016" "enzymejl_parmtype_ref"="2" %2, {} addrspace(10)* noundef nonnull align 16 dereferenceable(40) "enzyme_type"="{[-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}" "enzymejl_parmtype"="5124203456" "enzymejl_parmtype_ref"="2" %3) unnamed_addr #40 !dbg !1857 {
top:
  %4 = alloca i64, align 16
  %5 = bitcast i64* %4 to i8*
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca i64, align 16
  %10 = bitcast i64* %9 to i8*
  %11 = alloca i64, align 16
  %12 = bitcast i64* %11 to i8*
  %13 = alloca i64, align 16
  %14 = bitcast i64* %13 to i8*
  %15 = alloca i64, align 16
  %16 = bitcast i64* %15 to i8*
  %17 = call {}*** @julia.get_pgcstack() #41
  %current_task1124 = getelementptr inbounds {}**, {}*** %17, i64 -14
  %current_task1 = bitcast {}*** %current_task1124 to {}**
  %ptls_field125 = getelementptr inbounds {}**, {}*** %17, i64 2
  %18 = bitcast {}*** %ptls_field125 to i64***
  %ptls_load126127 = load i64**, i64*** %18, align 8, !tbaa !34
  %19 = getelementptr inbounds i64*, i64** %ptls_load126127, i64 2
  %safepoint = load i64*, i64** %19, align 8, !tbaa !38
  fence syncscope("singlethread") seq_cst
  call void @julia.safepoint(i64* %safepoint) #41, !dbg !1858
  fence syncscope("singlethread") seq_cst
  switch i32 %1, label %L18 [
    i32 1308622848, label %L39
    i32 1409286144, label %L39
    i32 1124073472, label %L39
  ], !dbg !1859

L18:                                              ; preds = %top
  %20 = call nonnull {} addrspace(10)* @julia_string_2832({} addrspace(10)* nofree noundef nonnull align 32 addrspacecast ({}* inttoptr (i64 5229217568 to {}*) to {} addrspace(10)*), i32 noundef zeroext %1) #41, !dbg !1861
  %box = call noalias nonnull dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5195018480 to {}*) to {} addrspace(10)*)) #42, !dbg !1861
  %21 = bitcast {} addrspace(10)* %box to [1 x {} addrspace(10)*] addrspace(10)*, !dbg !1861, !enzyme_inactive !33
  %22 = getelementptr [1 x {} addrspace(10)*], [1 x {} addrspace(10)*] addrspace(10)* %21, i64 0, i64 0, !dbg !1861
  store {} addrspace(10)* %20, {} addrspace(10)* addrspace(10)* %22, align 8, !dbg !1861, !tbaa !49, !alias.scope !53, !noalias !1862
  %23 = addrspacecast {} addrspace(10)* %box to {} addrspace(12)*, !dbg !1861, !enzyme_inactive !33
  call void @ijl_throw({} addrspace(12)* %23) #43, !dbg !1861
  unreachable, !dbg !1861

L39:                                              ; preds = %top, %top, %top
  %24 = addrspacecast {} addrspace(10)* %2 to {} addrspace(11)*, !dbg !1865
  %25 = addrspacecast {} addrspace(10)* %2 to {} addrspace(10)* addrspace(11)*, !dbg !1865
  %arraysize_ptr = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %25, i64 3, !dbg !1865
  %26 = bitcast {} addrspace(10)* addrspace(11)* %arraysize_ptr to i64 addrspace(11)*, !dbg !1865
  %arraysize = load i64, i64 addrspace(11)* %26, align 8, !dbg !1865, !tbaa !38, !range !78, !alias.scope !41, !noalias !44, !enzyme_inactive !33
  %arraysize_ptr8 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %25, i64 4, !dbg !1865
  %27 = bitcast {} addrspace(10)* addrspace(11)* %arraysize_ptr8 to i64 addrspace(11)*, !dbg !1865
  %arraysize9 = load i64, i64 addrspace(11)* %27, align 16, !dbg !1865, !tbaa !38, !range !78, !alias.scope !41, !noalias !44, !enzyme_inactive !33
  %.not = icmp eq i64 %arraysize, %arraysize9, !dbg !1868
  br i1 %.not, label %L52, label %L44, !dbg !1869

L44:                                              ; preds = %L39
  %newstruct105 = call noalias nonnull dereferenceable(16) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 16, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5126013728 to {}*) to {} addrspace(10)*)) #42, !dbg !1870
  %28 = addrspacecast {} addrspace(10)* %newstruct105 to {} addrspace(10)* addrspace(11)*, !dbg !1870, !enzyme_inactive !33
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %28, align 8, !dbg !1870, !tbaa !562, !alias.scope !53, !noalias !1862
  %29 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %28, i64 1, !dbg !1870
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %29, align 8, !dbg !1870, !tbaa !562, !alias.scope !53, !noalias !1862
  %box107 = call noalias nonnull dereferenceable(24) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-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}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 4467129680 to {}*) to {} addrspace(10)*)) #42, !dbg !1870
  %30 = bitcast {} addrspace(10)* %box107 to { {} addrspace(10)*, [2 x i64] } addrspace(10)*, !dbg !1870, !enzyme_inactive !33
  %.repack = getelementptr inbounds { {} addrspace(10)*, [2 x i64] }, { {} addrspace(10)*, [2 x i64] } addrspace(10)* %30, i64 0, i32 0, !dbg !1870
  store {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5241529376 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspace(10)* %.repack, align 8, !dbg !1870, !tbaa !49, !alias.scope !53, !noalias !1862
  %.repack134.repack = getelementptr inbounds { {} addrspace(10)*, [2 x i64] }, { {} addrspace(10)*, [2 x i64] } addrspace(10)* %30, i64 0, i32 1, i64 0, !dbg !1870
  store i64 %arraysize, i64 addrspace(10)* %.repack134.repack, align 8, !dbg !1870, !tbaa !49, !alias.scope !53, !noalias !1862
  %.repack134.repack136 = getelementptr inbounds { {} addrspace(10)*, [2 x i64] }, { {} addrspace(10)*, [2 x i64] } addrspace(10)* %30, i64 0, i32 1, i64 1, !dbg !1870
  store i64 %arraysize9, i64 addrspace(10)* %.repack134.repack136, align 8, !dbg !1870, !tbaa !49, !alias.scope !53, !noalias !1862
  store atomic {} addrspace(10)* %box107, {} addrspace(10)* addrspace(11)* %28 release, align 8, !dbg !1870, !tbaa !562, !alias.scope !53, !noalias !1862
  call void ({} addrspace(10)*, ...) @julia.write_barrier({} addrspace(10)* nofree noundef nonnull %newstruct105, {} addrspace(10)* nofree nonnull %box107) #44, !dbg !1870
  %31 = addrspacecast {} addrspace(10)* %newstruct105 to i8 addrspace(11)*, !dbg !1870, !enzyme_inactive !33
  %32 = getelementptr inbounds i8, i8 addrspace(11)* %31, i64 8, !dbg !1870
  %33 = bitcast i8 addrspace(11)* %32 to {} addrspace(10)* addrspace(11)*, !dbg !1870
  store atomic {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4333961224 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspace(11)* %33 release, align 8, !dbg !1870, !tbaa !562, !alias.scope !53, !noalias !1862
  %box109 = call noalias nonnull dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5172855472 to {}*) to {} addrspace(10)*)) #42, !dbg !1869
  %34 = bitcast {} addrspace(10)* %box109 to [1 x {} addrspace(10)*] addrspace(10)*, !dbg !1869, !enzyme_inactive !33
  %35 = getelementptr [1 x {} addrspace(10)*], [1 x {} addrspace(10)*] addrspace(10)* %34, i64 0, i64 0, !dbg !1869
  store {} addrspace(10)* %newstruct105, {} addrspace(10)* addrspace(10)* %35, align 8, !dbg !1869, !tbaa !49, !alias.scope !53, !noalias !1862
  %36 = addrspacecast {} addrspace(10)* %box109 to {} addrspace(12)*, !dbg !1869, !enzyme_inactive !33
  call void @ijl_throw({} addrspace(12)* %36) #43, !dbg !1869
  unreachable, !dbg !1869

L52:                                              ; preds = %L39
  switch i32 %0, label %L63 [
    i32 1426063360, label %L69
    i32 1275068416, label %L69
  ], !dbg !1871

L63:                                              ; preds = %L52
  %37 = insertvalue { {} addrspace(10)*, i32 } { {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5229219008 to {}*) to {} addrspace(10)*), i32 0 }, i32 %0, 1, !dbg !1873
  %newstruct = call noalias nonnull dereferenceable(16) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 16, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5126013728 to {}*) to {} addrspace(10)*)) #42, !dbg !1873
  %38 = addrspacecast {} addrspace(10)* %newstruct to {} addrspace(10)* addrspace(11)*, !dbg !1873, !enzyme_inactive !33
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %38, align 8, !dbg !1873, !tbaa !562, !alias.scope !53, !noalias !1862
  %39 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %38, i64 1, !dbg !1873
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %39, align 8, !dbg !1873, !tbaa !562, !alias.scope !53, !noalias !1862
  %box13 = call noalias nonnull dereferenceable(16) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,8]:Integer, [-1,9]:Integer, [-1,10]:Integer, [-1,11]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 16, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5145474416 to {}*) to {} addrspace(10)*)) #42, !dbg !1873
  %40 = bitcast {} addrspace(10)* %box13 to { {} addrspace(10)*, i32 } addrspace(10)*, !dbg !1873, !enzyme_inactive !33
  store { {} addrspace(10)*, i32 } %37, { {} addrspace(10)*, i32 } addrspace(10)* %40, align 8, !dbg !1873, !tbaa !49, !alias.scope !53, !noalias !1862
  store atomic {} addrspace(10)* %box13, {} addrspace(10)* addrspace(11)* %38 release, align 8, !dbg !1873, !tbaa !562, !alias.scope !53, !noalias !1862
  call void ({} addrspace(10)*, ...) @julia.write_barrier({} addrspace(10)* nofree noundef nonnull %newstruct, {} addrspace(10)* nofree nonnull %box13) #44, !dbg !1873
  %41 = addrspacecast {} addrspace(10)* %newstruct to i8 addrspace(11)*, !dbg !1873, !enzyme_inactive !33
  %42 = getelementptr inbounds i8, i8 addrspace(11)* %41, i64 8, !dbg !1873
  %43 = bitcast i8 addrspace(11)* %42 to {} addrspace(10)* addrspace(11)*, !dbg !1873
  store atomic {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4333961224 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspace(11)* %43 release, align 8, !dbg !1873, !tbaa !562, !alias.scope !53, !noalias !1862
  %box15 = call noalias nonnull dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5195018480 to {}*) to {} addrspace(10)*)) #42, !dbg !1874
  %44 = bitcast {} addrspace(10)* %box15 to [1 x {} addrspace(10)*] addrspace(10)*, !dbg !1874, !enzyme_inactive !33
  %45 = getelementptr [1 x {} addrspace(10)*], [1 x {} addrspace(10)*] addrspace(10)* %44, i64 0, i64 0, !dbg !1874
  store {} addrspace(10)* %newstruct, {} addrspace(10)* addrspace(10)* %45, align 8, !dbg !1874, !tbaa !49, !alias.scope !53, !noalias !1862
  %46 = addrspacecast {} addrspace(10)* %box15 to {} addrspace(12)*, !dbg !1874, !enzyme_inactive !33
  call void @ijl_throw({} addrspace(12)* %46) #43, !dbg !1874
  unreachable, !dbg !1874

L69:                                              ; preds = %L52, %L52
  %47 = addrspacecast {} addrspace(10)* %3 to { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)*, !dbg !1875
  %arraylen_ptr = getelementptr inbounds { i8 addrspace(13)*, i64, i16, i16, i32 }, { i8 addrspace(13)*, i64, i16, i16, i32 } addrspace(11)* %47, i64 0, i32 1, !dbg !1875
  %arraylen = load i64, i64 addrspace(11)* %arraylen_ptr, align 8, !dbg !1875, !tbaa !116, !range !78, !alias.scope !119, !noalias !120, !enzyme_inactive !33
  %48 = icmp eq i64 %arraysize, %arraylen, !dbg !1877
  br i1 %48, label %L153, label %L73, !dbg !1876

L73:                                              ; preds = %L69
  %49 = call noalias nonnull "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Integer}" {} addrspace(10)* @ijl_box_int64(i64 signext %arraylen) #45, !dbg !1879
  %50 = call noalias nonnull "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Integer}" {} addrspace(10)* @ijl_box_int64(i64 signext %arraysize) #45, !dbg !1879
  %51 = call nonnull "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)*, {} addrspace(10)*, {} addrspace(10)*, ...) @julia.call2({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* noundef nonnull @ijl_invoke, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5138974592 to {}*) to {} addrspace(10)*), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5124395440 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5228831744 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %49, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5228831712 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %50) #46, !dbg !1879
  %box21 = call noalias nonnull dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5172855472 to {}*) to {} addrspace(10)*)) #42, !dbg !1879
  %52 = bitcast {} addrspace(10)* %box21 to [1 x {} addrspace(10)*] addrspace(10)*, !dbg !1879, !enzyme_inactive !33
  %53 = getelementptr [1 x {} addrspace(10)*], [1 x {} addrspace(10)*] addrspace(10)* %52, i64 0, i64 0, !dbg !1879
  store {} addrspace(10)* %51, {} addrspace(10)* addrspace(10)* %53, align 8, !dbg !1879, !tbaa !49, !alias.scope !53, !noalias !1862
  %54 = addrspacecast {} addrspace(10)* %box21 to {} addrspace(12)*, !dbg !1879, !enzyme_inactive !33
  call void @ijl_throw({} addrspace(12)* %54) #43, !dbg !1879
  unreachable, !dbg !1879

L153:                                             ; preds = %L69
  %55 = addrspacecast {} addrspace(10)* %3 to {} addrspace(11)*, !dbg !1875
  %56 = lshr i32 %0, 24, !dbg !1880
  %value_phi26 = trunc i32 %56 to i8, !dbg !1888
  store i8 %value_phi26, i8* %6, align 1, !dbg !1884, !tbaa !562, !alias.scope !53, !noalias !1862
  %57 = lshr i32 %1, 24, !dbg !1880
  %value_phi29 = trunc i32 %57 to i8, !dbg !1888
  store i8 %value_phi29, i8* %7, align 1, !dbg !1884, !tbaa !562, !alias.scope !53, !noalias !1862
  store i8 78, i8* %8, align 1, !dbg !1884, !tbaa !562, !alias.scope !53, !noalias !1862
  store i64 %arraysize, i64* %9, align 16, !dbg !1884, !tbaa !562, !alias.scope !53, !noalias !1862
  store i64 1, i64* %11, align 16, !dbg !1884, !tbaa !562, !alias.scope !53, !noalias !1862
  %.not129 = icmp eq i64 %arraysize, 0, !dbg !1889
  %58 = select i1 %.not129, i64 1, i64 %arraysize, !dbg !1891
  store i64 %58, i64* %13, align 16, !dbg !1884, !tbaa !562, !alias.scope !53, !noalias !1862
  store i64 %58, i64* %15, align 16, !dbg !1884, !tbaa !562, !alias.scope !53, !noalias !1862
  %59 = call nonnull "enzyme_type"="{[-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}" {}* @julia.pointer_from_objref({} addrspace(11)* noundef %24) #47, !dbg !1892
  %60 = bitcast {}* %59 to double**, !dbg !1892
  %arrayptr131 = load double*, double** %60, align 8, !dbg !1892, !tbaa !38, !alias.scope !41, !noalias !44, !nonnull !33
  %61 = call nonnull "enzyme_type"="{[-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}" {}* @julia.pointer_from_objref({} addrspace(11)* noundef %55) #47, !dbg !1892
  %62 = bitcast {}* %61 to double**, !dbg !1892
  %arrayptr72132 = load double*, double** %62, align 8, !dbg !1892, !tbaa !683, !alias.scope !119, !noalias !120, !nonnull !33
  %bitcast_coercion77 = ptrtoint i64* %4 to i64, !dbg !1893
  call void @dtrtrs_64_(i8* noundef nonnull %6, i8* noundef nonnull %7, i8* noundef nonnull %8, i8* noundef nonnull %10, i8* noundef nonnull %12, double* nonnull %arrayptr131, i8* noundef nonnull %14, double* nonnull %arrayptr72132, i8* noundef nonnull %16, i64 noundef %bitcast_coercion77, i64 noundef 1, i64 noundef 1, i64 noundef 1) #41 [ "jl_roots"({} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* %3, {} addrspace(10)* null, {} addrspace(10)* %2, {} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* null) ], !dbg !1887
  %63 = load i64, i64* %4, align 16, !dbg !1896, !tbaa !562, !alias.scope !53, !noalias !97
  %.not133 = icmp eq i64 %63, 0, !dbg !1899
  br i1 %.not133, label %L273, label %L263, !dbg !1900

L263:                                             ; preds = %L153
  %64 = icmp sgt i64 %63, -1, !dbg !1901
  br i1 %64, label %L270, label %L265, !dbg !1902

L265:                                             ; preds = %L263
  %65 = sub i64 0, %63, !dbg !1903
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %5) #41
  call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %6) #41
  call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %7) #41
  call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %8) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %10) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %12) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %14) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %16) #41
  %66 = call noalias nonnull "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Integer}" {} addrspace(10)* @ijl_box_int64(i64 signext %65) #45, !dbg !1904
  %67 = call nonnull "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)*, {} addrspace(10)*, {} addrspace(10)*, ...) @julia.call2({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* nonnull @ijl_invoke, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5138974592 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5124395440 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5229218400 to {}*) to {} addrspace(10)*), {} addrspace(10)* nonnull %66, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5229218368 to {}*) to {} addrspace(10)*)) #46, !dbg !1904
  %box88 = call noalias nonnull dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 8, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5195018480 to {}*) to {} addrspace(10)*)) #42, !dbg !1904
  %68 = bitcast {} addrspace(10)* %box88 to [1 x {} addrspace(10)*] addrspace(10)*, !dbg !1904, !enzyme_inactive !33
  %69 = getelementptr [1 x {} addrspace(10)*], [1 x {} addrspace(10)*] addrspace(10)* %68, i64 0, i64 0, !dbg !1904
  store {} addrspace(10)* %67, {} addrspace(10)* addrspace(10)* %69, align 8, !dbg !1904, !tbaa !49, !alias.scope !53, !noalias !1862
  %70 = addrspacecast {} addrspace(10)* %box88 to {} addrspace(12)*, !dbg !1904, !enzyme_inactive !33
  call void @ijl_throw({} addrspace(12)* %70) #43, !dbg !1904
  unreachable, !dbg !1904

L270:                                             ; preds = %L263
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %5) #41
  call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %6) #41
  call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %7) #41
  call void @llvm.lifetime.end.p0i8(i64 1, i8* nonnull %8) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %10) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %12) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %14) #41
  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %16) #41
  %box93 = call noalias nonnull dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task1, i64 8, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5162718960 to {}*) to {} addrspace(10)*)) #42, !dbg !1905
  %memcpy_refined_dst = bitcast {} addrspace(10)* %box93 to i64 addrspace(10)*, !dbg !1905, !enzyme_inactive !33
  store i64 %63, i64 addrspace(10)* %memcpy_refined_dst, align 8, !dbg !1905, !tbaa !49, !alias.scope !53, !noalias !1862
  %71 = addrspacecast {} addrspace(10)* %box93 to {} addrspace(12)*, !dbg !1905, !enzyme_inactive !33
  call void @ijl_throw({} addrspace(12)* %71) #43, !dbg !1905
  unreachable, !dbg !1905

L273:                                             ; preds = %L153
  ret {} addrspace(10)* %3, !dbg !1906
}

in Mode: ForwardMode
cannot handle blas argument  within trtrs of   call void @dtrtrs_64_(i8* noundef nonnull %6, i8* noundef nonnull %7, i8* noundef nonnull %8, i8* noundef nonnull %10, i8* noundef nonnull %12, double* nonnull %arrayptr131, i8* noundef nonnull %14, double* nonnull %arrayptr72132, i8* noundef nonnull %16, i64 noundef %bitcast_coercion77, i64 noundef 1, i64 noundef 1, i64 noundef 1) #41 [ "jl_roots"({} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* %3, {} addrspace(10)* null, {} addrspace(10)* %2, {} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* null) ], !dbg !114

Stacktrace:
 [1] trtrs!
   @ ~/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl:3557


Stacktrace:
  [1] trtrs!
    @ ~/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl:3557
  [2] generic_trimatdiv!
    @ ~/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/triangular.jl:830 [inlined]
  [3] _ldiv!
    @ ~/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/triangular.jl:752 [inlined]
  [4] ldiv!
    @ ~/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/triangular.jl:745 [inlined]
  [5] \
    @ ~/.julia/juliaup/julia-1.10.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/triangular.jl:1485 [inlined]
  [6] invquad
    @ ~/.julia/packages/PDMats/cAM9h/src/pdmat.jl:146
  [7] sqmahal
    @ ~/.julia/packages/Distributions/uuqsE/src/multivariate/mvnormal.jl:267
  [8] _logpdf
    @ ~/.julia/packages/Distributions/uuqsE/src/multivariate/mvnormal.jl:143 [inlined]
  [9] logpdf
    @ ~/.julia/packages/Distributions/uuqsE/src/common.jl:263 [inlined]
 [10] logpdf
    @ ~/.julia/packages/Distributions/uuqsE/src/common.jl:0 [inlined]
 [11] fwddiffejulia_logpdf_2780_inner_1wrap
    @ ~/.julia/packages/Distributions/uuqsE/src/common.jl:0
 [12] macro expansion
    @ ~/.julia/packages/Enzyme/vgArw/src/compiler.jl:8136 [inlined]
 [13] enzyme_call
    @ ~/.julia/packages/Enzyme/vgArw/src/compiler.jl:7702 [inlined]
 [14] ForwardModeThunk
    @ ~/.julia/packages/Enzyme/vgArw/src/compiler.jl:7491 [inlined]
 [15] runtime_generic_fwd(activity::Type{…}, runtimeActivity::Val{…}, width::Val{…}, RT::Val{…}, f::typeof(logpdf), df::Nothing, primal_1::FullNormal, shadow_1_1::Nothing, primal_2::Vector{…}, shadow_2_1::Vector{…})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/vgArw/src/rules/jitrules.jl:305
 [16] #3
    @ ./REPL[12]:1 [inlined]
 [17] fwddiffejulia__3_1968wrap
    @ ./REPL[12]:0
 [18] macro expansion
    @ ~/.julia/packages/Enzyme/vgArw/src/compiler.jl:8136 [inlined]
 [19] enzyme_call
    @ ~/.julia/packages/Enzyme/vgArw/src/compiler.jl:7702 [inlined]
 [20] ForwardModeThunk
    @ ~/.julia/packages/Enzyme/vgArw/src/compiler.jl:7491 [inlined]
 [21] autodiff
    @ ~/.julia/packages/Enzyme/vgArw/src/Enzyme.jl:647 [inlined]
 [22] macro expansion
    @ ~/.julia/packages/Enzyme/vgArw/src/Enzyme.jl:2068 [inlined]
 [23] gradient(::EnzymeCore.ForwardMode{…}, ::EnzymeCore.Const{…}, ::Vector{…}; chunk::Nothing, shadows::Tuple{…})
    @ Enzyme ~/.julia/packages/Enzyme/vgArw/src/Enzyme.jl:1970
 [24] gradient(::EnzymeCore.ForwardMode{…}, ::EnzymeCore.Const{…}, ::Vector{…})
    @ Enzyme ~/.julia/packages/Enzyme/vgArw/src/Enzyme.jl:1970
 [25] top-level scope
    @ REPL[12]:1
Some type information was truncated. Use `show(err)` to see complete types.

Julia 1.10.5, Enzyme v0.13.11.

Both a fix and a more minimal and informative error message would be helpful.

@wsmoses wsmoses changed the title "cannot handle blas argument" from PDMat [ForwardMode] unimplemented derivative for trtrs Oct 22, 2024
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

1 participant