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

LLVM bug encountered in Turing.jl #658

Closed
ViralBShah opened this issue Mar 9, 2023 · 4 comments
Closed

LLVM bug encountered in Turing.jl #658

ViralBShah opened this issue Mar 9, 2023 · 4 comments

Comments

@ViralBShah
Copy link
Contributor

ViralBShah commented Mar 9, 2023

@yebai mentioned to me: It is difficult to figure out which function caused Enzyme to fail below. This makes it hard to find out which function needs a chain rule.

julia> using Turing, LogDensityProblems, LogDensityProblemsAD, DynamicPPL, Enzyme

julia> @model function linear_regression(x)
           β ~ Normal(0, 1)
           α ~ Normal(0, 1)
           σ ~ InverseGamma(2, 3)
           μ = α .+ β .* x
           y ~ MvNormal(μ, σ)
       end
linear_regression (generic function with 2 methods)

julia> x = randn(10);

julia> model = linear_regression(x);

julia> cmodel = model | (y = model(),);

julia> f = ADgradient(:Enzyme, DynamicPPL.LogDensityFunction(cmodel, SimpleVarInfo((α = 0.0, β = 1.0, σ = 1.0,))));

julia> LogDensityProblems.logdensity_and_gradient(f, [0.0, 1.0, 1.0])
julia: /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/Support/Casting.h:269: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::Instruction; Y = llvm::Value; typename llvm::cast_retty<X, 
Y*>::ret_type = llvm::Instruction*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

@yebai Can you provide a stacktrace. @wsmoses said on slack that this is an LLVM bug.

@wsmoses
Copy link
Member

wsmoses commented Mar 9, 2023

Perhaps this is it? (from https://pipelines.actions.githubusercontent.com/serviceHosts/0c878943-700a-40ba-8133-274020e1bd9e/_apis/pipelines/1/runs/18942/signedlogcontent/3?urlExpires=2023-03-09T15%3A20%3A38.4878704Z&urlSigningMethod=HMACV1&urlSignature=zszbo6Vi8C%2F6qgCvcPnLd7zFxgY7qaKJW267uuCKCxs%3D https://github.com/TuringLang/Turing.jl/actions/runs/4352542010/jobs/7605450766 )

Humorously, it is a bug in not handling a memmove of 0 bytes. Should get a patch for this quickly.

2023-03-07T10:59:12.0865047Z   %28 = call i64 @memmove(i64 %27, i64 %22, i64 noundef 0) #61, !dbg !123
2023-03-07T10:59:12.0866443Z julia: /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:3483: void AdjointGenerator<AugmentedReturnType>::visitMemTransferCommon(llvm::Intrinsic::ID, llvm::MaybeAlign, llvm::MaybeAlign, llvm::CallInst&, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Value*) [with AugmentedReturnType = AugmentedReturn*; llvm::Intrinsic::ID = unsigned int]: Assertion `size != 0' failed.
2023-03-07T10:59:12.0867177Z 
2023-03-07T10:59:12.0867356Z signal (6): Aborted
2023-03-07T10:59:12.0867747Z in expression starting at /home/runner/work/Turing.jl/Turing.jl/test/inference/hmc.jl:1
2023-03-07T10:59:12.1020021Z pthread_kill at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
2023-03-07T10:59:12.1020619Z raise at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
2023-03-07T10:59:12.1021103Z abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
2023-03-07T10:59:12.1021465Z unknown function (ip: 0x7f2bb9d0371a)
2023-03-07T10:59:12.1021909Z __assert_fail at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
2023-03-07T10:59:12.1022397Z visitMemTransferCommon at /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:3483
2023-03-07T10:59:12.1022882Z visitCallInst at /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:11212
2023-03-07T10:59:12.1023648Z delegateCallInst at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:299 [inlined]
2023-03-07T10:59:12.1024308Z visitCall at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209 [inlined]
2023-03-07T10:59:12.1024910Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209
2023-03-07T10:59:12.1025508Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:112 [inlined]
2023-03-07T10:59:12.1026006Z CreateAugmentedPrimal at /workspace/srcdir/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:2261
2023-03-07T10:59:12.1026510Z visitCallInst at /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:12129
2023-03-07T10:59:12.1027113Z delegateCallInst at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:299 [inlined]
2023-03-07T10:59:12.1027809Z visitCall at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209 [inlined]
2023-03-07T10:59:12.1028405Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209
2023-03-07T10:59:12.1029119Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:112 [inlined]
2023-03-07T10:59:12.1029616Z CreateAugmentedPrimal at /workspace/srcdir/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:2261
2023-03-07T10:59:12.1030087Z visitCallInst at /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:12129
2023-03-07T10:59:12.1030690Z delegateCallInst at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:299 [inlined]
2023-03-07T10:59:12.1031308Z visitCall at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209 [inlined]
2023-03-07T10:59:12.1031893Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209
2023-03-07T10:59:12.1032490Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:112 [inlined]
2023-03-07T10:59:12.1032973Z CreateAugmentedPrimal at /workspace/srcdir/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:2261
2023-03-07T10:59:12.1033441Z visitCallInst at /workspace/srcdir/Enzyme/enzyme/Enzyme/AdjointGenerator.h:12129
2023-03-07T10:59:12.1034053Z delegateCallInst at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:299 [inlined]
2023-03-07T10:59:12.1034664Z visitCall at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209 [inlined]
2023-03-07T10:59:12.1035257Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/Instruction.def:209
2023-03-07T10:59:12.1035851Z visit at /opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/usr/local/include/llvm/IR/InstVisitor.h:112 [inlined]
2023-03-07T10:59:12.1036343Z CreatePrimalAndGradient at /workspace/srcdir/Enzyme/enzyme/Enzyme/EnzymeLogic.cpp:3974
2023-03-07T10:59:12.1036867Z EnzymeCreatePrimalAndGradient at /workspace/srcdir/Enzyme/enzyme/Enzyme/CApi.cpp:474
2023-03-07T10:59:12.1037366Z EnzymeCreatePrimalAndGradient at /home/runner/.julia/packages/Enzyme/DIkTv/src/api.jl:123
2023-03-07T10:59:12.1037830Z enzyme! at /home/runner/.julia/packages/Enzyme/DIkTv/src/compiler.jl:5187
2023-03-07T10:59:12.1038199Z unknown function (ip: 0x7f2b09a79b12)
2023-03-07T10:59:12.1038578Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:12.1039007Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:12.1042712Z #codegen#142 at /home/runner/.julia/packages/Enzyme/DIkTv/src/compiler.jl:6383
2023-03-07T10:59:12.1043627Z codegen##kw at /home/runner/.julia/packages/Enzyme/DIkTv/src/compiler.jl:6055 [inlined]
2023-03-07T10:59:12.1044089Z _thunk at /home/runner/.julia/packages/Enzyme/DIkTv/src/compiler.jl:6870 [inlined]
2023-03-07T10:59:12.1044517Z _thunk at /home/runner/.julia/packages/Enzyme/DIkTv/src/compiler.jl:6864
2023-03-07T10:59:12.1044891Z unknown function (ip: 0x7f2b09a7467d)
2023-03-07T10:59:12.1045348Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:12.1045776Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:12.1046243Z cached_compilation at /home/runner/.julia/packages/Enzyme/DIkTv/src/compiler.jl:6908
2023-03-07T10:59:12.1046616Z unknown function (ip: 0x7f2b09667403)
2023-03-07T10:59:12.1046983Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:12.1047398Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:12.1047822Z #s883#169 at /home/runner/.julia/packages/Enzyme/DIkTv/src/compiler.jl:6968 [inlined]
2023-03-07T10:59:12.1048167Z #s883#169 at ./none:0
2023-03-07T10:59:12.1048519Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:12.1049019Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:12.1125493Z GeneratedFunctionStub at ./boot.jl:580
2023-03-07T10:59:12.1126095Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:12.1126592Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:12.1132716Z jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
2023-03-07T10:59:12.1133217Z jl_call_staged at /buildworker/worker/package_linux64/build/src/method.c:431
2023-03-07T10:59:12.1133716Z jl_code_for_staged at /buildworker/worker/package_linux64/build/src/method.c:482
2023-03-07T10:59:12.1228318Z get_staged at ./compiler/utilities.jl:111
2023-03-07T10:59:12.1333139Z retrieve_code_info at ./compiler/utilities.jl:123 [inlined]
2023-03-07T10:59:12.1333690Z InferenceState at ./compiler/inferencestate.jl:234
2023-03-07T10:59:12.1416563Z typeinf_edge at ./compiler/typeinfer.jl:814 [inlined]
2023-03-07T10:59:12.1417088Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.1515026Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.1620705Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.1701279Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.1777701Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.1870049Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.1961222Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.2039444Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.2120563Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.2200224Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.2278092Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.2278483Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.2355930Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.2434530Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.2512633Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.2590627Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.2668447Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.2746410Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.2824247Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.2901816Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.2979671Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.3060005Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.3060355Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.3135793Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.3216423Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.3294570Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.3372116Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.3449829Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.3528415Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.3606278Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.3683829Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.3763055Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.3844169Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.3844775Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.3927252Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.4005491Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.4083294Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.4160973Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.4238660Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.4316653Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.4395485Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.4474105Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.4551756Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.4629183Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.4629550Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.4707319Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.4785223Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.4862807Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.4941041Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.5020545Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.5099719Z typeinf_local at ./compiler/abstractinterpretation.jl:1900
2023-03-07T10:59:12.5177362Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.5254690Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.5333549Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.5413146Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.5413518Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.5488631Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.5566342Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.5649589Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.5730166Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.5808277Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.5885896Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.5963686Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.6041587Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.6119573Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.6202604Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.6202973Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.6279308Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.6357116Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.6435686Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.6513161Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.6590989Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.6669266Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.6747246Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.6828751Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.6906828Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.6986917Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.6987272Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.7062272Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.7139639Z abstract_call at ./compiler/abstractinterpretation.jl:1395
2023-03-07T10:59:12.7216943Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.7294686Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.7374840Z typeinf_local at ./compiler/abstractinterpretation.jl:1900
2023-03-07T10:59:12.7457951Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.7535785Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.7613182Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.7692957Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.7693321Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.7768732Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.7846561Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.7923831Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.8004280Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.8082016Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.8159935Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.8237467Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.8315040Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.8392798Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.8473205Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.8473560Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.8548612Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.8627035Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.8709826Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.8790302Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.8868493Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.8945994Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:12.9023407Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.9100681Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.9178513Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:12.9258288Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:12.9258646Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:12.9333575Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:12.9411185Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:12.9489220Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:12.9566863Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:12.9644778Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:12.9722788Z typeinf_local at ./compiler/abstractinterpretation.jl:1900
2023-03-07T10:59:12.9801509Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:12.9879697Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:12.9960932Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:13.0043174Z typeinf_edge at ./compiler/typeinfer.jl:823 [inlined]
2023-03-07T10:59:13.0043525Z abstract_call_method at ./compiler/abstractinterpretation.jl:504
2023-03-07T10:59:13.0118969Z abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:105
2023-03-07T10:59:13.0196971Z abstract_call_known at ./compiler/abstractinterpretation.jl:1342
2023-03-07T10:59:13.0274560Z abstract_call at ./compiler/abstractinterpretation.jl:1397
2023-03-07T10:59:13.0352280Z abstract_call at ./compiler/abstractinterpretation.jl:1382
2023-03-07T10:59:13.0429670Z abstract_eval_statement at ./compiler/abstractinterpretation.jl:1534
2023-03-07T10:59:13.0507029Z typeinf_local at ./compiler/abstractinterpretation.jl:1918
2023-03-07T10:59:13.0584373Z typeinf_nocycle at ./compiler/abstractinterpretation.jl:2014
2023-03-07T10:59:13.0662767Z _typeinf at ./compiler/typeinfer.jl:226
2023-03-07T10:59:13.0740571Z typeinf at ./compiler/typeinfer.jl:209
2023-03-07T10:59:13.0820047Z typeinf_ext at ./compiler/typeinfer.jl:909
2023-03-07T10:59:13.0898652Z typeinf_ext_toplevel at ./compiler/typeinfer.jl:942
2023-03-07T10:59:13.0978307Z typeinf_ext_toplevel at ./compiler/typeinfer.jl:938
2023-03-07T10:59:13.1065505Z jfptr_typeinf_ext_toplevel_11534.clone_1 at /opt/hostedtoolcache/julia/1.7.3/x64/lib/julia/sys.so (unknown line)
2023-03-07T10:59:13.1066063Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:13.1066513Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1077994Z jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
2023-03-07T10:59:13.1078468Z jl_type_infer at /buildworker/worker/package_linux64/build/src/gf.c:295
2023-03-07T10:59:13.1083801Z jl_generate_fptr at /buildworker/worker/package_linux64/build/src/jitlayers.cpp:338
2023-03-07T10:59:13.1093991Z jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:1980
2023-03-07T10:59:13.1094523Z jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:2246 [inlined]
2023-03-07T10:59:13.1101316Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2239 [inlined]
2023-03-07T10:59:13.1101763Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1102182Z #step#33 at /home/runner/.julia/packages/DynamicPPL/HyKGK/src/sampler.jl:111
2023-03-07T10:59:13.1115084Z step at /home/runner/.julia/packages/DynamicPPL/HyKGK/src/sampler.jl:92 [inlined]
2023-03-07T10:59:13.1115497Z macro expansion at /home/runner/.julia/packages/AbstractMCMC/F9Hbk/src/sample.jl:125 [inlined]
2023-03-07T10:59:13.1115911Z macro expansion at /home/runner/.julia/packages/AbstractMCMC/F9Hbk/src/logging.jl:16 [inlined]
2023-03-07T10:59:13.1116305Z #mcmcsample#19 at /home/runner/.julia/packages/AbstractMCMC/F9Hbk/src/sample.jl:116
2023-03-07T10:59:13.1116623Z unknown function (ip: 0x7f2b09a625b0)
2023-03-07T10:59:13.1116934Z mcmcsample##kw at /home/runner/.julia/packages/AbstractMCMC/F9Hbk/src/sample.jl:109
2023-03-07T10:59:13.1117245Z unknown function (ip: 0x7f2b09a52e29)
2023-03-07T10:59:13.1117553Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:13.1117909Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1118278Z #sample#3 at /home/runner/work/Turing.jl/Turing.jl/src/inference/Inference.jl:160
2023-03-07T10:59:13.1118581Z unknown function (ip: 0x7f2b09a52bc1)
2023-03-07T10:59:13.1118895Z sample at /home/runner/work/Turing.jl/Turing.jl/src/inference/Inference.jl:159 [inlined]
2023-03-07T10:59:13.1119279Z #sample#2 at /home/runner/work/Turing.jl/Turing.jl/src/inference/Inference.jl:146 [inlined]
2023-03-07T10:59:13.1119660Z sample at /home/runner/work/Turing.jl/Turing.jl/src/inference/Inference.jl:146
2023-03-07T10:59:13.1119962Z unknown function (ip: 0x7f2b09a52967)
2023-03-07T10:59:13.1120269Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:13.1120789Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1167174Z jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
2023-03-07T10:59:13.1167549Z do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:126
2023-03-07T10:59:13.1167921Z eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:215
2023-03-07T10:59:13.1168289Z eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:461
2023-03-07T10:59:13.1168650Z eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:516
2023-03-07T10:59:13.1168999Z eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:516
2023-03-07T10:59:13.1169333Z eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:516
2023-03-07T10:59:13.1170060Z eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:516
2023-03-07T10:59:13.1170443Z jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:731
2023-03-07T10:59:13.1171096Z jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:885
2023-03-07T10:59:13.1178002Z jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
2023-03-07T10:59:13.1178384Z jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:944
2023-03-07T10:59:13.1255899Z eval at ./boot.jl:373 [inlined]
2023-03-07T10:59:13.1256152Z include_string at ./loading.jl:1196
2023-03-07T10:59:13.1256494Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:13.1256857Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1333795Z _include at ./loading.jl:1253
2023-03-07T10:59:13.1334314Z include at ./client.jl:451 [inlined]
2023-03-07T10:59:13.1334677Z macro expansion at /home/runner/.julia/packages/TimerOutputs/LHjFw/src/TimerOutput.jl:237 [inlined]
2023-03-07T10:59:13.1335084Z macro expansion at /home/runner/work/Turing.jl/Turing.jl/test/runtests.jl:77 [inlined]
2023-03-07T10:59:13.1335516Z macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
2023-03-07T10:59:13.1335926Z macro expansion at /home/runner/work/Turing.jl/Turing.jl/test/runtests.jl:75 [inlined]
2023-03-07T10:59:13.1336337Z macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
2023-03-07T10:59:13.1336739Z macro expansion at /home/runner/work/Turing.jl/Turing.jl/test/runtests.jl:74 [inlined]
2023-03-07T10:59:13.1337136Z macro expansion at /home/runner/.julia/packages/TimerOutputs/LHjFw/src/TimerOutput.jl:237 [inlined]
2023-03-07T10:59:13.1337527Z macro expansion at /home/runner/work/Turing.jl/Turing.jl/test/runtests.jl:70 [inlined]
2023-03-07T10:59:13.1337930Z macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]
2023-03-07T10:59:13.1338551Z top-level scope at /home/runner/work/Turing.jl/Turing.jl/test/runtests.jl:57
2023-03-07T10:59:13.1342415Z jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:876
2023-03-07T10:59:13.1350358Z jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
2023-03-07T10:59:13.1350793Z jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:944
2023-03-07T10:59:13.1427782Z eval at ./boot.jl:373 [inlined]
2023-03-07T10:59:13.1428041Z include_string at ./loading.jl:1196
2023-03-07T10:59:13.1428356Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:13.1428793Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1506295Z _include at ./loading.jl:1253
2023-03-07T10:59:13.1506539Z include at ./client.jl:451
2023-03-07T10:59:13.1506870Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:13.1507347Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1514797Z jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
2023-03-07T10:59:13.1515217Z do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:126
2023-03-07T10:59:13.1522599Z eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:215
2023-03-07T10:59:13.1530472Z eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:166 [inlined]
2023-03-07T10:59:13.1530907Z eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:587
2023-03-07T10:59:13.1538331Z jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:731
2023-03-07T10:59:13.1546243Z jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:885
2023-03-07T10:59:13.1554229Z jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:830
2023-03-07T10:59:13.1554672Z jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:944
2023-03-07T10:59:13.1632787Z eval at ./boot.jl:373 [inlined]
2023-03-07T10:59:13.1633046Z exec_options at ./client.jl:268
2023-03-07T10:59:13.1712598Z _start at ./client.jl:495
2023-03-07T10:59:13.1790342Z jfptr__start_22567.clone_1 at /opt/hostedtoolcache/julia/1.7.3/x64/lib/julia/sys.so (unknown line)
2023-03-07T10:59:13.1790772Z _jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
2023-03-07T10:59:13.1791133Z jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
2023-03-07T10:59:13.1799015Z jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
2023-03-07T10:59:13.1799430Z true_main at /buildworker/worker/package_linux64/build/src/jlapi.c:559
2023-03-07T10:59:13.1800373Z jl_repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:701
2023-03-07T10:59:13.1800784Z main at /buildworker/worker/package_linux64/build/cli/loader_exe.c:42
2023-03-07T10:59:13.1801180Z unknown function (ip: 0x7f2bb9d04d8f)
2023-03-07T10:59:13.1801781Z __libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
2023-03-07T10:59:13.1802194Z _start at /opt/hostedtoolcache/julia/1.7.3/x64/bin/julia (unknown line)
2023-03-07T10:59:13.1802571Z Allocations: 6516803303 (Pool: 6508146826; Big: 8656477); GC: 2926

@wsmoses
Copy link
Member

wsmoses commented Mar 9, 2023

Fix for the memmove error at least, if that happens to be the same: EnzymeAD/Enzyme#1016

@wsmoses
Copy link
Member

wsmoses commented Mar 10, 2023

This does not reproduce on main, instead revealing a Turing type unstable getfield.

Please reopen if this persists.

ERROR: Enzyme: not yet implemented in reverse mode, jl_getfield
Stacktrace:
 [1] getproperty
   @ ./Base.jl:32
 [2] MvNormal
   @ ./deprecated.jl:104

@wsmoses wsmoses closed this as completed Mar 10, 2023
@devmotion
Copy link
Contributor

With main, I get a different error message:

julia> LogDensityProblems.logdensity_and_gradient(f, [0.0, 1.0, 1.0])
ERROR: Return of nothing must be marked Const
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] #s451#163
   @ ~/.julia/packages/Enzyme/SUstD/src/compiler.jl:8173 [inlined]
 [3] var"#s451#163"(F::Any, Fn::Any, DF::Any, A::Any, TT::Any, Mode::Any, ModifiedBetween::Any, width::Any, specid::Any, ReturnPrimal::Any, ShadowInit::Any, ::Any, #unused#::Type, f::Any, df::Any, #unused#::Type, tt::Any, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Type, #unused#::Any)
   @ Enzyme.Compiler ./none:0
 [4] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
   @ Core ./boot.jl:582
 [5] thunk
   @ ~/.julia/packages/Enzyme/SUstD/src/compiler.jl:8218 [inlined]
 [6] thunk
   @ ~/.julia/packages/Enzyme/SUstD/src/compiler.jl:8211 [inlined]
 [7] runtime_generic_augfwd(activity::Val{(false, false, true)}, width::Val{1}, ModifiedBetween::Val{(true, true, true)}, RT::Val{NamedTuple{(Symbol("1"), Symbol("2"), Symbol("3")), Tuple{Any, Any, Any}}}, f::typeof(Base.depwarn), df::Nothing, primal_1::String, shadow_1_1::Nothing, primal_2::Symbol, shadow_2_1::Symbol)
   @ Enzyme.Compiler ~/.julia/packages/Enzyme/SUstD/src/compiler.jl:1050

Regardless, the problem here is not Turing but it seems the issues are caused by the line

           y ~ MvNormal(μ, σ)

in the model, or rather the fact that this MvNormal constructor is deprecated. Replacing it with

           y ~ MvNormal(μ, σ^2 * I)

(which the deprecated call is forwarded to), fixes the example:

julia> LogDensityProblems.logdensity_and_gradient(f, [0.0, 1.0, 1.0])
(-130.65686521906758, [-6.769465686621555, -3.431034957759231, 226.65365479589548])

@wsmoses should Enzyme be able to handle the deprecation?

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

3 participants