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

Issues with Wishart from Distributions.jl #1081

Closed
torfjelde opened this issue Sep 25, 2023 · 11 comments · Fixed by #1089
Closed

Issues with Wishart from Distributions.jl #1081

torfjelde opened this issue Sep 25, 2023 · 11 comments · Fixed by #1089

Comments

@torfjelde
Copy link

using Distributions, Enzyme

let dist = Wishart(7, [1 0.5; 0.5 1]), x = rand(dist), ∂f∂x = zero(x)
    _, y = Enzyme.autodiff(Enzyme.ReverseWithPrimal, logpdf, Enzyme.Active,
                           Enzyme.Const(dist), Enzyme.Duplicated(x, ∂f∂x))
    y, ∂f∂x
end

fails with a stacktrace that is too long to paste, but here's the beginning of it:

LLVM error: broken gc calling conv fix
Range types must match instruction type!
  call fastcc void @augmented_julia_chkuplofinite_16058({} addrspace(10)* nocapture noundef nonnull readonly align 16 dereferenceable(40) %0), !dbg !700, !range !166

; ModuleID = 'start'
source_filename = "start"
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-linux-gnu"

@_j_str5 = private unnamed_addr constant [11 x i8] c"typeassert\00"
@_j_const7 = private unnamed_addr constant [129 x [2 x double]] [[2 x double] zeroinitializer, [2 x double] [double 0x3F7FE02A6B200000, double 0xBD6F30EE07912DF9], [2 x double] [double 0x3F8FC0A8B1000000, double 0xBD5FE0E183092C59], [2 x double] [double 0x3F97B91B07D80000, double 0xBD62772AB6C0559C], [2 x double] [double 0x3F9F829B0E780000, double 0x3D2980267C7E09E4], [2 x double] [double 0x3FA39E87BA000000, double 0xBD642A056FEA4DFD], [2 x double] [double 0x3FA77458F6340000, double 0xBD62303B9CB0D5E1], [2 x double] [double 0x3FAB42DD71180000, double 0x3D671BEC28D14C7E], [2 x double] [double 0x3FAF0A30C0100000, double 0x3D662A6617CC9717], [2 x double] [double 0x3FB16536EEA40000, double 0xBD60A3E2F3B47D18], [2 x double] [double 0x3FB341D7961C0000, double 0xBD4717B6B33E44F8], [2 x double] [double 0x3FB51B073F060000, double 0x3D383F69278E686A], [2 x double] [double 0x3FB6F0D28AE60000, double 0xBD62968C836CC8C2], [2 x double] [double 0x3FB8C345D6320000, double 0xBD5937C294D2F567], [2 x double] [double 0x3FBA926D3A4A0000, double 0x3D6AAC6CA17A4554], [2 x double] [double 0x3FBC5E548F5C0000, double 0xBD4C5E7514F4083F], [2 x double] [double 0x3FBE27076E2A0000, double 0x3D6E5CBD3D50FFFC], [2 x double] [double 0x3FBFEC9131DC0000, double 0xBD354555D1AE6607], [2 x double] [double 0x3FC0D77E7CD10000, double 0xBD6C69A65A23A170], [2 x double] [double 0x3FC1B72AD52F0000, double 0x3D69E80A41811A39], [2 x double] [double 0x3FC29552F8200000, double 0xBD35B967F4471DFC], [2 x double] [double 0x3FC371FC201F0000, double 0xBD6C22F10C9A4EA8], [2 x double] [double 0x3FC44D2B6CCB0000, double 0x3D6F4799F4F6543E], [2 x double] [double 0x3FC526E5E3A20000, double 0xBD62F21746FF8A47], [2 x double] [double 0x3FC5FF3070A80000, double 0xBD6B0B0DE3077D7E], [2 x double] [double 0x3FC6D60FE71A0000, double 0xBD56F1B955C4D1DA], [2 x double] [double 0x3FC7AB8902110000, double 0xBD537B720E4A694B], [2 x double] [double 0x3FC87FA065210000, double 0xBD5B77B7EFFB7F41], [2 x double] [double 0x3FC9525A9CF40000, double 0x3D65AD1D904C1D4E], [2 x double] [double 0x3FCA23BC1FE30000, double 0xBD62A739B23B93E1], [2 x double] [double 0x3FCAF3C94E810000, double 0xBD600349CC67F9B2], [2 x double] [double 0x3FCBC286742E0000, double 0xBD6CCA75818C5DBC], [2 x double] [double 0x3FCC8FF7C79B0000, double 0xBD697794F689F843], [2 x double] [double 0x3FCD5C216B500000, double 0xBD611BA91BBCA682], [2 x double] [double 0x3FCE27076E2B0000, double 0xBD3A342C2AF0003C], [2 x double] [double 0x3FCEF0ADCBDC0000, double 0x3D664D948637950E], [2 x double] [double 0x3FCFB9186D5E0000, double 0x3D5F1546AAA3361C], [2 x double] [double 0x3FD0402594B50000, double 0xBD67DF928EC217A5], [2 x double] [double 0x3FD0A324E2738000, double 0x3D50E35F73F7A018], [2 x double] [double 0x3FD1058BF9AE8000, double 0xBD6A9573B02FAA5A], [2 x double] [double 0x3FD1675CABAB8000, double 0x3D630701CE63EAB9], [2 x double] [double 0x3FD1C898C1698000, double 0x3D59FAFBC68E7540], [2 x double] [double 0x3FD22941FBCF8000, double 0xBD3A6976F5EB0963], [2 x double] [double 0x3FD2895A13DE8000, double 0x3D3A8D7AD24C13F0], [2 x double] [double 0x3FD2E8E2BAE10000, double 0x3D5D309C2CC91A85], [2 x double] [double 0x3FD347DD9A988000, double 0xBD25594DD4C58092], [2 x double] [double 0x3FD3A64C55698000, double 0xBD6D0B1C68651946], [2 x double] [double 0x3FD4043086868000, double 0x3D63F1DE86093EFA], [2 x double] [double 0x3FD4618BC21C8000, double 0xBD609EC17A426426], [2 x double] [double 0x3FD4BE5F95778000, double 0xBD3D7C92CD9AD824], [2 x double] [double 0x3FD51AAD872E0000, double 0xBD3F4BD8DB0A7CC1], [2 x double] [double 0x3FD5767717458000, double 0xBD62C9D5B2A49AF9], [2 x double] [double 0x3FD5D1BDBF580000, double 0x3D4394A11B1C1EE4], [2 x double] [double 0x3FD62C82F2BA0000, double 0xBD6C356848506EAD], [2 x double] [double 0x3FD686C81E9B0000, double 0x3D54AEC442BE1015], [2 x double] [double 0x3FD6E08EAA2B8000, double 0x3D60F1C609C98C6C], [2 x double] [double 0x3FD739D7F6BC0000, double 0xBD67FCB18ED9D603], [2 x double] [double 0x3FD792A55FDD8000, double 0xBD6C2EC1F512DC03], [2 x double] [double 0x3FD7EAF83B828000, double 0x3D67E1B259D2F3DA], [2 x double] [double 0x3FD842D1DA1E8000, double 0x3D462E927628CBC2], [2 x double] [double 0x3FD89A3386C18000, double 0xBD6ED2A52C73BF78], [2 x double] [double 0x3FD8F11E87368000, double 0xBD5D3881E8962A96], [2 x double] [double 0x3FD947941C210000, double 0x3D56FABA4CDD147D], [2 x double] [double 0x3FD99D9581180000, double 0xBD5F753456D113B8], [2 x double] [double 0x3FD9F323ECBF8000, double 0x3D584BF2B68D766F], [2 x double] [double 0x3FDA484090E58000, double 0x3D6D8515FE535B87], [2 x double] [double 0x3FDA9CEC9A9A0000, double 0x3D40931A909FEA5E], [2 x double] [double 0x3FDAF12932478000, double 0xBD3E53BB31EED7A9], [2 x double] [double 0x3FDB44F77BCC8000, double 0x3D4EC5197DDB55D3], [2 x double] [double 0x3FDB985896930000, double 0x3D50FB598FB14F89], [2 x double] [double 0x3FDBEB4D9DA70000, double 0x3D5B7BF7861D37AC], [2 x double] [double 0x3FDC3DD7A7CD8000, double 0x3D66A6B9D9E0A5BD], [2 x double] [double 0x3FDC8FF7C79A8000, double 0x3D5A21AC25D81EF3], [2 x double] [double 0x3FDCE1AF0B860000, double 0xBD48290905A86AA6], [2 x double] [double 0x3FDD32FE7E010000, double 0xBD542A9E21373414], [2 x double] [double 0x3FDD83E7258A0000, double 0x3D679F2828ADD176], [2 x double] [double 0x3FDDD46A04C20000, double 0xBD6DAFA08CECADB1], [2 x double] [double 0x3FDE24881A7C8000, double 0xBD53D9E34270BA6B], [2 x double] [double 0x3FDE744261D68000, double 0x3D3E1F8DF68DBCF3], [2 x double] [double 0x3FDEC399D2468000, double 0x3D49802EB9DCA7E7], [2 x double] [double 0x3FDF128F5FAF0000, double 0x3D3BB2CD720EC44C], [2 x double] [double 0x3FDF6123FA700000, double 0x3D645630A2B61E5B], [2 x double] [double 0x3FDFAF588F790000, double 0xBD49C24CA098362B], [2 x double] [double 0x3FDFFD2E08580000, double 0xBD46CF54D05F9367], [2 x double] [double 0x3FE02552A5A5C000, double 0x3D60FEC69C695D7F], [2 x double] [double 0x3FE04BDF9DA94000, double 0xBD692D9A033EFF75], [2 x double] [double 0x3FE0723E5C1CC000, double 0x3D6F404E57963891], [2 x double] [double 0x3FE0986F4F574000, double 0xBD55BE8DC04AD601], [2 x double] [double 0x3FE0BE72E4254000, double 0xBD657D49676844CC], [2 x double] [double 0x3FE0E44985D1C000, double 0x3D5917EDD5CBBD2D], [2 x double] [double 0x3FE109F39E2D4000, double 0x3D592DFBC7D93617], [2 x double] [double 0x3FE12F7195940000, double 0xBD6043ACFEDCE638], [2 x double] [double 0x3FE154C3D2F4C000, double 0x3D65E9A98F33A396], [2 x double] [double 0x3FE179EABBD88000, double 0x3D69A0BFC60E6FA0], [2 x double] [double 0x3FE19EE6B467C000, double 0x3D52DD98B97BAEF0], [2 x double] [double 0x3FE1C3B81F714000, double 0xBD3EDA1B58389902], [2 x double] [double 0x3FE1E85F5E704000, double 0x3D1A07BD8B34BE7C], [2 x double] [double 0x3FE20CDCD192C000, double 0xBD64926CAFC2F08A], [2 x double] [double 0x3FE23130D7BEC000, double 0xBD17AFA4392F1BA7], [2 x double] [double 0x3FE2555BCE990000, double 0xBD506987F78A4A5E], [2 x double] [double 0x3FE2795E1289C000, double 0xBD5DCA290F81848D], [2 x double] [double 0x3FE29D37FEC2C000, double 0xBD5EEA6F465268B4], [2 x double] [double 0x3FE2C0E9ED448000, double 0x3D5D1772F5386374], [2 x double] [double 0x3FE2E47436E40000, double 0x3D334202A10C3491], [2 x double] [double 0x3FE307D7334F0000, double 0x3D60BE1FB590A1F5], [2 x double] [double 0x3FE32B1339120000, double 0x3D6D71320556B67B], [2 x double] [double 0x3FE34E289D9D0000, double 0xBD6E2CE9146D277A], [2 x double] [double 0x3FE37117B5474000, double 0x3D4ED71774092113], [2 x double] [double 0x3FE393E0D3564000, double 0xBD65E6563BBD9FC9], [2 x double] [double 0x3FE3B6844A000000, double 0xBD3EEA838909F3D3], [2 x double] [double 0x3FE3D9026A714000, double 0x3D66FAA404263D0B], [2 x double] [double 0x3FE3FB5B84D18000, double 0xBD60BDA4B162AFA3], [2 x double] [double 0x3FE41D8FE8468000, double 0xBD5AA33736867A17], [2 x double] [double 0x3FE43F9FE2F9C000, double 0x3D5CCEF4E4F736C2], [2 x double] [double 0x3FE4618BC21C4000, double 0x3D6EC27D0B7B37B3], [2 x double] [double 0x3FE48353D1EA8000, double 0x3D51BEE7ABD17660], [2 x double] [double 0x3FE4A4F85DB04000, double 0xBD244FDD840B8591], [2 x double] [double 0x3FE4C679AFCD0000, double 0xBD61C64E971322CE], [2 x double] [double 0x3FE4E7D811B74000, double 0x3D6BB09CB0985646], [2 x double] [double 0x3FE50913CC018000, double 0xBD6794B434C5A4F5], [2 x double] [double 0x3FE52A2D265BC000, double 0x3D46ABB9DF22BC57], [2 x double] [double 0x3FE54B2467998000, double 0x3D6497A915428B44], [2 x double] [double 0x3FE56BF9D5B40000, double 0xBD58CD7DC73BD194], [2 x double] [double 0x3FE58CADB5CD8000, double 0xBD49DB3DB43689B4], [2 x double] [double 0x3FE5AD404C358000, double 0x3D6F2CFB29AAA5F0], [2 x double] [double 0x3FE5CDB1DC6C0000, double 0x3D67648CF6E3C5D7], [2 x double] [double 0x3FE5EE02A9240000, double 0x3D667570D6095FD2], [2 x double] [double 0x3FE60E32F4478000, double 0x3D51B194F912B417], [2 x double] [double 0x3FE62E42FEFA4000, double 0xBD48432A1B0E2634]]
@0 = private unnamed_addr constant [17879 x i8] c"Enzyme compilation failed.\0ACurrent scope: \0A; Function Attrs: mustprogress willreturn\0Adefine internal fastcc void @preprocess_julia_potrs__15971(i32 zeroext %0, {} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %1, {} addrspace(10)* noundef nonnull align 16 dereferenceable(40) %2) unnamed_addr #71 !dbg !3896 {\0Atop:\0A  %3 = call noalias nonnull dereferenceable(8) dereferenceable_or_null(8) i8* @malloc(i64 8), !enzyme_fromstack !360\0A  %4 = bitcast i8* %3 to i64*, !enzyme_caststack !70\0A  %5 = bitcast i64* %4 to i8*\0A  %6 = call noalias nonnull dereferenceable(1) dereferenceable_or_null(1) i8* @malloc(i64 1), !enzyme_fromstack !3897\0A  %7 = call noalias nonnull dereferenceable(8) dereferenceable_or_null(8) i8* @malloc(i64 8), !enzyme_fromstack !360\0A  %8 = bitcast i8* %7 to i64*, !enzyme_caststack !70\0A  %9 = bitcast i64* %8 to i8*\0A  %10 = call noalias nonnull dereferenceable(8) dereferenceable_or_null(8) i8* @malloc(i64 8), !enzyme_fromstack !360\0A  %11 = bitcast i8* %10 to i64*, !enzyme_caststack !70\0A  %12 = bitcast i64* %11 to i8*\0A  %13 = call noalias nonnull dereferenceable(8) dereferenceable_or_null(8) i8* @malloc(i64 8), !enzyme_fromstack !360\0A  %14 = bitcast i8* %13 to i64*, !enzyme_caststack !70\0A  %15 = bitcast i64* %14 to i8*\0A  %16 = call noalias nonnull dereferenceable(8) dereferenceable_or_null(8) i8* @malloc(i64 8), !enzyme_fromstack !360\0A  %17 = bitcast i8* %16 to i64*, !enzyme_caststack !70\0A  %18 = bitcast i64* %17 to i8*\0A  %19 = call noalias nonnull dereferenceable(16) dereferenceable_or_null(16) i8* @malloc(i64 16), !enzyme_fromstack !2661\0A  %20 = bitcast i8* %19 to [2 x i64]*, !enzyme_caststack !70\0A  %21 = call {}*** @julia.get_pgcstack() #72\0A  %22 = addrspacecast {} addrspace(10)* %1 to {} addrspace(11)*, !dbg !3898\0A  %23 = bitcast {} addrspace(10)* %1 to {} addrspace(10)* addrspace(10)*, !dbg !3898\0A  %24 = addrspacecast {} addrspace(10)* addrspace(10)* %23 to {} addrspace(10)* addrspace(11)*, !dbg !3898\0A  %25 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %24, i64 3, !dbg !3898\0A  %26 = bitcast {} addrspace(10)* addrspace(11)* %25 to i64 addrspace(11)*, !dbg !3898\0A  %27 = load i64, i64 addrspace(11)* %26, align 8, !dbg !3898, !tbaa !74, !range !78, !invariant.load !70, !alias.scope !79, !noalias !82\0A  %28 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %24, i64 4, !dbg !3898\0A  %29 = bitcast {} addrspace(10)* addrspace(11)* %28 to i64 addrspace(11)*, !dbg !3898\0A  %30 = load i64, i64 addrspace(11)* %29, align 16, !dbg !3898, !tbaa !74, !range !78, !invariant.load !70, !alias.scope !79, !noalias !82\0A  %.not = icmp eq i64 %27, %30, !dbg !3901\0A  br i1 %.not, label %L13, label %L6, !dbg !3902\0A\0AL6:                                               ; preds = %top\0A  %31 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 0, !dbg !3903\0A  store i64 %27, i64* %31, align 8, !dbg !3903, !tbaa !129, !alias.scope !131, !noalias !3904\0A  %32 = getelementptr inbounds [2 x i64], [2 x i64]* %20, i64 0, i64 1, !dbg !3903\0A  store i64 %30, i64* %32, align 8, !dbg !3903, !tbaa !129, !alias.scope !131, !noalias !3904\0A  %33 = addrspacecast [2 x i64]* %20 to [2 x i64] addrspace(11)*, !dbg !3902\0A  %34 = call nonnull {} addrspace(10)* @julia_string_15923({} addrspace(10)* nofree noundef nonnull align 128 addrspacecast ({}* inttoptr (i64 140273867056768 to {}*) to {} addrspace(10)*), [2 x i64] addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(16) %33) #73, !dbg !3902\0A  %current_task2143 = getelementptr inbounds {}**, {}*** %21, i64 -13, !dbg !3902\0A  %current_task21 = bitcast {}*** %current_task2143 to {}**, !dbg !3902\0A  %35 = call noalias nonnull {} addrspace(10)* @julia.gc_alloc_obj({}** nonnull %current_task21, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 140273859838656 to {}*) 
@wsmoses
Copy link
Member

wsmoses commented Sep 26, 2023

What version of enzyme are you on? (the output of ] st`). This bug doesn't reproduce for me (and from the looks was fixed a long time ago).

Reopen if it persists on current release/main

@wsmoses wsmoses closed this as not planned Won't fix, can't repro, duplicate, stale Sep 26, 2023
@torfjelde
Copy link
Author

torfjelde commented Sep 26, 2023

Sorry, forgot to include the deps as I had already added it to my original comment in the PR.
But aight, will check with main when I find some time 👍

@yebai
Copy link

yebai commented Sep 26, 2023

I can reproduce this bug on MacOS.

(jl_V30byf) pkg> st
Status `/private/var/folders/m8/xtrwgfnd6n17xhdx98_9y5nc0000gn/T/jl_V30byf/Project.toml`
  [31c24e10] Distributions v0.25.100
  [7da242da] Enzyme v0.11.8

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 20 × Apple M1 Ultra
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 16 virtual cores

Error:

julia> using Distributions, Enzyme

julia> let dist = Wishart(7, [1 0.5; 0.5 1]), x = rand(dist), ∂f∂x = zero(x)
           _, y = Enzyme.autodiff(Enzyme.ReverseWithPrimal, logpdf, Enzyme.Active,
                                  Enzyme.Const(dist), Enzyme.Duplicated(x, ∂f∂x))
           y, ∂f∂x
       end
warning: didn't implement memmove, using memcpy as fallback which can result in errors
warning: didn't implement memmove, using memcpy as fallback which can result in errors
warning: didn't implement memmove, using memcpy as fallback which can result in errors
warning: didn't implement memmove, using memcpy as fallback which can result in errors
ERROR: LLVM error: broken gc calling conv fix
Range types must match instruction type!
  call fastcc void @augmented_julia_chkuplofinite_4765({} addrspace(10)* nocapture noundef nonnull readonly align 16 dereferenceable(40) %0), !dbg !700, !range !166

; ModuleID = 'start'
source_filename = "start"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-ni:10:11:12:13"
target triple = "arm64-apple-darwin22.4.0"

@_j_str5 = private unnamed_addr constant [11 x i8] c"typeassert\00"
@_j_const7 = private unnamed_addr constant [129 x [2 x double]] [[2 x double] zeroinitializer, [2 x double] [double 0x3F7FE02A6B200000, double 0xBD6F30EE07912DF9], [2 x double] [double 0x3F8FC0A8B1000000, double 0xBD5FE0E183092C59], [2 x double] [double 0x3F97B91B07D80000, double 0xBD62772AB6C0559C], [2 x double] [double 0x3F9F829B0E780000, double 0x3D2980267C7E09E4], [2 x double] [double 0x3FA39E87BA000000, double 0xBD642A056FEA4DFD], [2 x double] [double 0x3FA77458F6340000, double 0xBD62303B9CB0D5E1], [2 x double] [double 0x3FAB42DD71180000, double 0x3D671BEC28D14C7E], [2 x double] [double 0x3FAF0A30C0100000, double 0x3D662A6617CC9717], [2 x double] [double 0x3FB16536EEA40000, double 0xBD60A3E2F3B47D18], [2 x double] [double 0x3FB341D7961C0000, double 0xBD4717B6B33E44F8], [2 x double] [double 0x3FB51B073F060000, double 0x3D383F69278E686A], [2 x double] [double 0x3FB6F0D28AE60000, double 0xBD62968C836CC8C2], [2 x double] [double 0x3FB8C345D6320000, double 0xBD5937C294D2F567], [2 x double] [double 0x3FBA926D3A4A0000, double 0x3D6AAC6CA17A4554], [2 x double] ......

@wsmoses wsmoses reopened this Sep 26, 2023
@wsmoses
Copy link
Member

wsmoses commented Sep 26, 2023

Let me try my Mac laptop to try to reproduce as well.

@wsmoses
Copy link
Member

wsmoses commented Sep 26, 2023

If not I may ask to hop on a zoom or something to try to figure out the root cause.

@simsurace
Copy link
Contributor

I can reproduce with the same error:

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 8 virtual cores
Environment:
  JULIA_IMAGE_THREADS = 1

(@gp) pkg> st
Status `~/.julia/environments/gp/Project.toml`
  [31c24e10] Distributions v0.25.102
  [7da242da] Enzyme v0.11.8 `~/.julia/dev/Enzyme`

@wsmoses
Copy link
Member

wsmoses commented Oct 6, 2023

Looks like it was 1.9 specific. Fixed by the above PR.

Note that this then goes hits an unimplemented lapack call:


No augmented forward pass found for dpotrf_64_
 at context:   call void @dpotrf_64_(i8* nonnull %7, i8* nonnull %10, i64 %46, i8* nonnull %13, i64 %bitcast_coercion32, i64 1) #86 [ "jl_roots"({} addrspace(10)* null, {} addrspace(10)* null, {} addrspace(10)* %3, {} addrspace(10)* null, {} addrspace(10)* null) ], !dbg !132

Stacktrace:
 [1] potrf!
   @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl:3226


Stacktrace:
  [1] throwerr(cstr::Cstring)
    @ Enzyme.Compiler ~/git/Enzyme.jl/src/compiler.jl:3012
  [2] potrf!
    @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl:3226
  [3] _chol!
    @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/cholesky.jl:187 [inlined]
  [4] #cholesky!#140
    @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/cholesky.jl:268
  [5] cholesky!
    @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/cholesky.jl:267 [inlined]
  [6] #cholesky!#141
    @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/cholesky.jl:301
  [7] cholesky! (repeats 2 times)
    @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/cholesky.jl:295 [inlined]
  [8] cholesky (repeats 2 times)
    @ ~/git/Enzyme.jl/julia-1.10.0-beta2/share/julia/stdlib/v1.10/LinearAlgebra/src/cholesky.jl:401 [inlined]
  [9] nonsingular_wishart_logkernel
    @ ~/.julia/packages/Distributions/fYgbJ/src/matrix/wishart.jl:189
 [10] logkernel
    @ ~/.julia/packages/Distributions/fYgbJ/src/matrix/wishart.jl:163 [inlined]
 [11] _logpdf
    @ ~/.julia/packages/Distributions/fYgbJ/src/matrixvariates.jl:82 [inlined]
 [12] logpdf
    @ ~/.julia/packages/Distributions/fYgbJ/src/common.jl:250 [inlined]
 [13] logpdf
    @ ~/.julia/packages/Distributions/fYgbJ/src/common.jl:0 [inlined]
 [14] diffejulia_logpdf_1054_inner_1wrap
    @ ~/.julia/packages/Distributions/fYgbJ/src/common.jl:0
 [15] macro expansion

@wsmoses wsmoses closed this as completed Oct 6, 2023
@yebai
Copy link

yebai commented Oct 8, 2023

@wsmoses I suggest that we always add a test to similar bugfix PRs, so avoid accidentally breaking these again. This is particularly useful, given that subtle Julia internal changes often affect Enzyme.

@devmotion
Copy link
Contributor

I was happy when I saw that this issue was closed - but when checking the MWE I noticed that it still doesn't work and one runs into the BLAS issue mentioned in #1081 (comment). So maybe this issue should be kept open until the potrf! issue is fixed?

@wsmoses
Copy link
Member

wsmoses commented Jan 26, 2024

So these are two separate issues, one of which is that we had the calling convention mismatch (here), the second of which is an implementation of potrf and/or cholesky, etc.

I'd like to keep this issue just to the calling conv fix. You can open another for cholesky, though I think we may have ones for those already. In any case, it should be fixed by #1220 which I was just finishing up now and hopefully should be merged in a few mins.

@wsmoses
Copy link
Member

wsmoses commented Jan 26, 2024

and @devmotion FYI cholesky support is now merged. If you retry turing back on main, that error should go away.

The final remaining error is an issue that comes from Julia1.10/GPUCompiler causing an infinite recursion for hvcat, that doesn't have any good fixes immediately. I'd recommend commenting that final stackoverflow error out, but then I think the remaining Turing.jl should pass

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

Successfully merging a pull request may close this issue.

5 participants