EnzymeAD / Enzyme.jl

Julia bindings for the Enzyme automatic differentiator
https://enzyme.mit.edu
MIT License
455 stars 63 forks source link

LoadError: AssertionError: ; Function Attrs: alwaysinline mustprogress willreturn #1939

Open mhauru opened 1 month ago

mhauru commented 1 month ago

MWE:

module MWE

using Enzyme: Enzyme
using Distributions: Distributions

Enzyme.API.runtimeActivity!(true)

function f(x)
    d = Distributions.MvNormal([1.0, 1.0])
    v = eachcol(x)
    return sum(Base.Fix1(Distributions.logpdf, d), v)
end

x = reshape([0.8, 0.3, 0.2, 0.7], (2, 2))
@show f(x)
Enzyme.gradient(Enzyme.Reverse, f, x)

end

Error:

ERROR: LoadError: AssertionError: ; Function Attrs: alwaysinline mustprogress willreturn
define internal "enzymejl_parmtype"="4767957120" "enzymejl_parmtype_ref"="1" void @diffejulia__sum_829_15487_inner.1({ { [1 x [1 x [1 x i64]]], [1 x {} addrspace(10)*] } } "enzyme_type"="{[0]:Integer, [1]:Integer, [2]:Integer, [3]:Integer, [4]:Integer, [5]:Integer, [6]:Integer, [7]:Integer, [8]:Pointer, [8,0]:Pointer, [8,0,-1]:Float@double, [8,8]:Integer, [8,9]:Integer, [8,10]:Integer, [8,11]:Integer, [8,12]:Integer, [8,13]:Integer, [8,14]:Integer, [8,15]:Integer, [8,16]:Integer, [8,17]:Integer, [8,18]:Integer, [8,19]:Integer, [8,20]:Integer, [8,21]:Integer, [8,22]:Integer, [8,23]:Integer, [8,24]:Integer, [8,25]:Integer, [8,26]:Integer, [8,27]:Integer, [8,28]:Integer, [8,29]:Integer, [8,30]:Integer, [8,31]:Integer, [8,32]:Integer, [8,33]:Integer, [8,34]:Integer, [8,35]:Integer, [8,36]:Integer, [8,37]:Integer, [8,38]:Integer, [8,39]:Integer}" "enzymejl_parmtype"="13872118672" "enzymejl_parmtype_ref"="0" %0, { { [1 x [1 x [1 x i64]]], [1 x {} addrspace(10)*] } } "enzyme_type"="{[0]:Integer, [1]:Integer, [2]:Integer, [3]:Integer, [4]:Integer, [5]:Integer, [6]:Integer, [7]:Integer, [8]:Pointer, [8,0]:Pointer, [8,0,-1]:Float@double, [8,8]:Integer, [8,9]:Integer, [8,10]:Integer, [8,11]:Integer, [8,12]:Integer, [8,13]:Integer, [8,14]:Integer, [8,15]:Integer, [8,16]:Integer, [8,17]:Integer, [8,18]:Integer, [8,19]:Integer, [8,20]:Integer, [8,21]:Integer, [8,22]:Integer, [8,23]:Integer, [8,24]:Integer, [8,25]:Integer, [8,26]:Integer, [8,27]:Integer, [8,28]:Integer, [8,29]:Integer, [8,30]:Integer, [8,31]:Integer, [8,32]:Integer, [8,33]:Integer, [8,34]:Integer, [8,35]:Integer, [8,36]:Integer, [8,37]:Integer, [8,38]:Integer, [8,39]:Integer}" "enzymejl_parmtype"="13872118672" "enzymejl_parmtype_ref"="0" %"'", { {} addrspace(10)*, { i64 }, [1 x [1 x i64]] } "enzyme_type"="{[0]:Pointer, [0,0]:Pointer, [0,0,-1]:Float@double, [0,8]:Integer, [0,9]:Integer, [0,10]:Integer, [0,11]:Integer, [0,12]:Integer, [0,13]:Integer, [0,14]:Integer, [0,15]:Integer, [0,16]:Integer, [0,17]:Integer, [0,18]:Integer, [0,19]:Integer, [0,20]:Integer, [0,21]:Integer, [0,22]:Integer, [0,23]:Integer, [0,24]:Integer, [0,25]:Integer, [0,26]:Integer, [0,27]:Integer, [0,28]:Integer, [0,29]:Integer, [0,30]:Integer, [0,31]:Integer, [0,32]:Integer, [0,33]:Integer, [0,34]:Integer, [0,35]:Integer, [0,36]:Integer, [0,37]:Integer, [0,38]:Integer, [0,39]:Integer, [8]:Integer, [9]:Integer, [10]:Integer, [11]:Integer, [12]:Integer, [13]:Integer, [14]:Integer, [15]:Integer, [16]:Integer, [17]:Integer, [18]:Integer, [19]:Integer, [20]:Integer, [21]:Integer, [22]:Integer, [23]:Integer}" "enzymejl_parmtype"="12923695504" "enzymejl_parmtype_ref"="0" %1, { {} addrspace(10)*, { i64 }, [1 x [1 x i64]] } "enzyme_type"="{[0]:Pointer, [0,0]:Pointer, [0,0,-1]:Float@double, [0,8]:Integer, [0,9]:Integer, [0,10]:Integer, [0,11]:Integer, [0,12]:Integer, [0,13]:Integer, [0,14]:Integer, [0,15]:Integer, [0,16]:Integer, [0,17]:Integer, [0,18]:Integer, [0,19]:Integer, [0,20]:Integer, [0,21]:Integer, [0,22]:Integer, [0,23]:Integer, [0,24]:Integer, [0,25]:Integer, [0,26]:Integer, [0,27]:Integer, [0,28]:Integer, [0,29]:Integer, [0,30]:Integer, [0,31]:Integer, [0,32]:Integer, [0,33]:Integer, [0,34]:Integer, [0,35]:Integer, [0,36]:Integer, [0,37]:Integer, [0,38]:Integer, [0,39]:Integer, [8]:Integer, [9]:Integer, [10]:Integer, [11]:Integer, [12]:Integer, [13]:Integer, [14]:Integer, [15]:Integer, [16]:Integer, [17]:Integer, [18]:Integer, [19]:Integer, [20]:Integer, [21]:Integer, [22]:Integer, [23]:Integer}" "enzymejl_parmtype"="12923695504" "enzymejl_parmtype_ref"="0" %"'1", {} addrspace(10)* %differeturn, { {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)* } %tapeArg) local_unnamed_addr #8 !dbg !73 {
entry:
  %"'de" = alloca {} addrspace(10)*, align 8
  %2 = getelementptr {} addrspace(10)*, {} addrspace(10)** %"'de", i64 0
  store {} addrspace(10)* @ejl_jl_nothing, {} addrspace(10)** %2, align 8
  %3 = call {}*** @julia.get_pgcstack() #10
  %current_task1.i2 = getelementptr inbounds {}**, {}*** %3, i64 -14
  %current_task1.i = bitcast {}*** %current_task1.i2 to {}**
  %"box.i'mi" = extractvalue { {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)* } %tapeArg, 3, !dbg !74
  %box.i = extractvalue { {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)* } %tapeArg, 4, !dbg !74
  %"box4.i'mi" = extractvalue { {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)* } %tapeArg, 1, !dbg !74
  %box4.i = extractvalue { {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)* } %tapeArg, 2, !dbg !74
  %4 = extractvalue { {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)* } %tapeArg, 0, !dbg !74
  br label %invertentry, !dbg !77

invertentry:                                      ; preds = %entry
  store {} addrspace(10)* %differeturn, {} addrspace(10)** %"'de", align 8
  %5 = icmp ne {} addrspace(10)* %box.i, %"box.i'mi", !dbg !74
  %6 = select i1 %5, {} addrspace(10)* @ejl_jl_true, {} addrspace(10)* @ejl_jl_false, !dbg !74
  %7 = icmp ne {} addrspace(10)* %box4.i, %"box4.i'mi", !dbg !74
  %8 = select i1 %7, {} addrspace(10)* @ejl_jl_true, {} addrspace(10)* @ejl_jl_false, !dbg !74
  %9 = call {} addrspace(10)* ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)*, {} addrspace(10)*, ...) @julia.call({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_f_tuple, {} addrspace(10)* null, {} addrspace(10)* @ejl_jl_false, {} addrspace(10)* @ejl_jl_false, {} addrspace(10)* @ejl_jl_false, {} addrspace(10)* %6, {} addrspace(10)* %8, {} addrspace(10)* @ejl_jl_false), !dbg !74
  %10 = call {} addrspace(10)* ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)*, {} addrspace(10)*, ...) @julia.call({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @jl_f_apply_type, {} addrspace(10)* null, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4696806880 to {}*) to {} addrspace(10)*), {} addrspace(10)* %9), !dbg !74
  %11 = call {} addrspace(10)* ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)*, {} addrspace(10)*, ...) @julia.call({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32)* @ijl_apply_generic, {} addrspace(10)* @ejl_enz_runtime_generic_rev, {} addrspace(10)* %10, {} addrspace(10)* @ejl_enz_val_1, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 6085433248 to {}*) to {} addrspace(10)*), {} addrspace(10)* %4, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4697027088 to {}*) to {} addrspace(10)*), {} addrspace(10)* @ejl_jl_nothing, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4724551792 to {}*) to {} addrspace(10)*), {} addrspace(10)* @ejl_jl_nothing, {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4697015920 to {}*) to {} addrspace(10)*), {} addrspace(10)* @ejl_jl_nothing, {} addrspace(10)* %box.i, {} addrspace(10)* %"box.i'mi", {} addrspace(10)* %box4.i, {} addrspace(10)* %"box4.i'mi", {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4696054864 to {}*) to {} addrspace(10)*), {} addrspace(10)* @ejl_jl_nothing), !dbg !74
  fence syncscope("singlethread") seq_cst
  fence syncscope("singlethread") seq_cst
  ret void
}

Base.allocatedinline(actualRetType) != Base.allocatedinline(literal_rt): actualRetType = Any, literal_rt = Float64, rettype = EnzymeCore.Active{Float64}, sret_union=false, pactualRetType=Any

Stacktrace:
  [1] create_abi_wrapper(enzymefn::LLVM.Function, TT::Type, rettype::Type, actualRetType::Type, Mode::Enzyme.API.CDerivativeMode, augmented::Ptr{…}, width::Int64, returnPrimal::Bool, shadow_init::Bool, world::UInt64, interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:4314
  [2] enzyme!(job::GPUCompiler.CompilerJob{…}, mod::LLVM.Module, primalf::LLVM.Function, TT::Type, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, wrap::Bool, modifiedBetween::NTuple{…}, returnPrimal::Bool, expectedTapeType::Type, loweredArgs::Set{…}, boxedArgs::Set{…})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:4163
  [3] codegen(output::Symbol, job::GPUCompiler.CompilerJob{…}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, toplevel::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:6438
  [4] codegen
    @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:5614 [inlined]
  [5] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool)
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7241
  [6] _thunk
    @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7241 [inlined]
  [7] cached_compilation
    @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7282 [inlined]
  [8] thunkbase(ctx::LLVM.Context, mi::Core.MethodInstance, ::Val{…}, ::Type{…}, ::Type{…}, tt::Type{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Type{…}, ::Val{…})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7355
  [9] #s2080#19052
    @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7407 [inlined]
 [10]
    @ Enzyme.Compiler ./none:0
 [11] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any})
    @ Core ./boot.jl:602
 [12] runtime_generic_augfwd(activity::Type{…}, width::Val{…}, ModifiedBetween::Val{…}, RT::Val{…}, f::Base.var"##sum#829", df::Nothing, primal_1::Colon, shadow_1_1::Nothing, primal_2::@Kwargs{}, shadow_2_1::Nothing, primal_3::typeof(sum), shadow_3_1::Nothing, primal_4::Base.Fix1{…}, shadow_4_1::Base.Fix1{…}, primal_5::ColumnSlices{…}, shadow_5_1::ColumnSlices{…})
    @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/rules/jitrules.jl:334
 [13] sum
    @ ./reducedim.jl:1011 [inlined]
 [14] f
    @ ~/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:11 [inlined]
 [15] augmented_julia_f_15459wrap
    @ ~/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:0
 [16] macro expansion
    @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7187 [inlined]
 [17] enzyme_call
    @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:6794 [inlined]
 [18] AugmentedForwardThunk
    @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:6682 [inlined]
 [19] autodiff
    @ ~/.julia/packages/Enzyme/TiboG/src/Enzyme.jl:264 [inlined]
 [20] autodiff
    @ ~/.julia/packages/Enzyme/TiboG/src/Enzyme.jl:332 [inlined]
 [21] gradient(rm::EnzymeCore.ReverseMode{false, EnzymeCore.FFIABI, false, false}, f::typeof(Main.MWE.f), x::Matrix{Float64})
    @ Enzyme ~/.julia/packages/Enzyme/TiboG/src/Enzyme.jl:1049
 [22] top-level scope
    @ ~/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:16
 [23] include(fname::String)
    @ Base.MainInclude ./client.jl:489
 [24] top-level scope
    @ REPL[21]:1
in expression starting at /Users/mhauru/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:1
Some type information was truncated. Use `show(err)` to see complete types.

The MWE is almost the same as #1812, the only difference being that Dirichlet has been replaced with MvNormal. However, the error looks substantially different, and this one fails with both eachrow and eachcol, whereas #1812 only fails with eachrow. Hence unsure if this is the same underlying issue.

wsmoses commented 1 month ago

Looks like you’re on an old Enzyme, what happens on the latest?

On Fri, Oct 4, 2024 at 5:04 AM Markus Hauru @.***> wrote:

MWE:

module MWE using Enzyme: Enzymeusing Distributions: Distributions

Enzyme.API.runtimeActivity!(true) function f(x) d = Distributions.MvNormal([1.0, 1.0]) v = eachcol(x) return sum(Base.Fix1(Distributions.logpdf, d), v)end

x = reshape([0.8, 0.3, 0.2, 0.7], (2, @.*** f(x) Enzyme.gradient(Enzyme.Reverse, f, x) end

Error:

ERROR: LoadError: AssertionError: ; Function Attrs: alwaysinline mustprogress willreturn define internal "enzymejl_parmtype"="4767957120" "enzymejl_parmtype_ref"="1" void @diffejulia__sum_829_15487_inner.1({ { [1 x [1 x [1 x i64]]], [1 x {} addrspace(10)*] } } "enzyme_type"="{[0]:Integer, [1]:Integer, [2]:Integer, [3]:Integer, [4]:Integer, [5]:Integer, [6]:Integer, [7]:Integer, [8]:Pointer, [8,0]:Pointer, @., [8,8]:Integer, [8,9]:Integer, [8,10]:Integer, [8,11]:Integer, [8,12]:Integer, [8,13]:Integer, [8,14]:Integer, [8,15]:Integer, [8,16]:Integer, [8,17]:Integer, [8,18]:Integer, [8,19]:Integer, [8,20]:Integer, [8,21]:Integer, [8,22]:Integer, [8,23]:Integer, [8,24]:Integer, [8,25]:Integer, [8,26]:Integer, [8,27]:Integer, [8,28]:Integer, [8,29]:Integer, [8,30]:Integer, [8,31]:Integer, [8,32]:Integer, [8,33]:Integer, [8,34]:Integer, [8,35]:Integer, [8,36]:Integer, [8,37]:Integer, [8,38]:Integer, [8,39]:Integer}" "enzymejl_parmtype"="13872118672" "enzymejl_parmtype_ref"="0" %0, { { [1 x [1 x [1 x i64]]], [1 x {} addrspace(10)] } } "enzyme_type"="{[0]:Integer, [1]:Integer, [2]:Integer, [3]:Integer, [4]:Integer, [5]:Integer, [6]:Integer, [7]:Integer, [8]:Pointer, [8,0]:Pointer, **@., [8,8]:Integer, [8,9]:Integer, [8,10]:Integer, [8,11]:Integer, [8,12]:Integer, [8,13]:Integer, [8,14]:Integer, [8,15]:Integer, [8,16]:Integer, [8,17]:Integer, [8,18]:Integer, [8,19]:Integer, [8,20]:Integer, [8,21]:Integer, [8,22]:Integer, [8,23]:Integer, [8,24]:Integer, [8,25]:Integer, [8,26]:Integer, [8,27]:Integer, [8,28]:Integer, [8,29]:Integer, [8,30]:Integer, [8,31]:Integer, [8,32]:Integer, [8,33]:Integer, [8,34]:Integer, [8,35]:Integer, [8,36]:Integer, [8,37]:Integer, [8,38]:Integer, [8,39]:Integer}" "enzymejl_parmtype"="13872118672" "enzymejl_parmtype_ref"="0" %"'", { {} addrspace(10), { i64 }, [1 x [1 x i64]] } "enzyme_type"="{[0]:Pointer, [0,0]:Pointer, **@., [0,8]:Integer, [0,9]:Integer, [0,10]:Integer, [0,11]:Integer, [0,12]:Integer, [0,13]:Integer, [0,14]:Integer, [0,15]:Integer, [0,16]:Integer, [0,17]:Integer, [0,18]:Integer, [0,19]:Integer, [0,20]:Integer, [0,21]:Integer, [0,22]:Integer, [0,23]:Integer, [0,24]:Integer, [0,25]:Integer, [0,26]:Integer, [0,27]:Integer, [0,28]:Integer, [0,29]:Integer, [0,30]:Integer, [0,31]:Integer, [0,32]:Integer, [0,33]:Integer, [0,34]:Integer, [0,35]:Integer, [0,36]:Integer, [0,37]:Integer, [0,38]:Integer, [0,39]:Integer, [8]:Integer, [9]:Integer, [10]:Integer, [11]:Integer, [12]:Integer, [13]:Integer, [14]:Integer, [15]:Integer, [16]:Integer, [17]:Integer, [18]:Integer, [19]:Integer, [20]:Integer, [21]:Integer, [22]:Integer, [23]:Integer}" "enzymejl_parmtype"="12923695504" "enzymejl_parmtype_ref"="0" %1, { {} addrspace(10), { i64 }, [1 x [1 x i64]] } "enzyme_type"="{[0]:Pointer, [0,0]:Pointer, **@., [0,8]:Integer, [0,9]:Integer, [0,10]:Integer, [0,11]:Integer, [0,12]:Integer, [0,13]:Integer, [0,14]:Integer, [0,15]:Integer, [0,16]:Integer, [0,17]:Integer, [0,18]:Integer, [0,19]:Integer, [0,20]:Integer, [0,21]:Integer, [0,22]:Integer, [0,23]:Integer, [0,24]:Integer, [0,25]:Integer, [0,26]:Integer, [0,27]:Integer, [0,28]:Integer, [0,29]:Integer, [0,30]:Integer, [0,31]:Integer, [0,32]:Integer, [0,33]:Integer, [0,34]:Integer, [0,35]:Integer, [0,36]:Integer, [0,37]:Integer, [0,38]:Integer, [0,39]:Integer, [8]:Integer, [9]:Integer, [10]:Integer, [11]:Integer, [12]:Integer, [13]:Integer, [14]:Integer, [15]:Integer, [16]:Integer, [17]:Integer, [18]:Integer, [19]:Integer, [20]:Integer, [21]:Integer, [22]:Integer, [23]:Integer}" "enzymejl_parmtype"="12923695504" "enzymejl_parmtype_ref"="0" %"'1", {} addrspace(10) %differeturn, { {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10) } %tapeArg) local_unnamed_addr #8 !dbg !73 { entry: %"'de" = alloca {} addrspace(10), align 8 %2 = getelementptr {} addrspace(10)*, {} addrspace(10)* %"'de", i64 0 store {} addrspace(10) @ejl_jl_nothing, {} addrspace(10) %2, align 8 %3 = call {}* @julia.get_pgcstack() #10 %current_task1.i2 = getelementptr inbounds {}*, {} %3, i64 -14 %current_task1.i = bitcast {} %current_task1.i2 to {} %"box.i'mi" = extractvalue { {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10) } %tapeArg, 3, !dbg !74 %box.i = extractvalue { {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10) } %tapeArg, 4, !dbg !74 %"box4.i'mi" = extractvalue { {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10) } %tapeArg, 1, !dbg !74 %box4.i = extractvalue { {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10) } %tapeArg, 2, !dbg !74 %4 = extractvalue { {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10), {} addrspace(10) } %tapeArg, 0, !dbg !74 br label %invertentry, !dbg !77

invertentry: ; preds = %entry store {} addrspace(10)* %differeturn, {} addrspace(10) %"'de", align 8 %5 = icmp ne {} addrspace(10) %box.i, %"box.i'mi", !dbg !74 %6 = select i1 %5, {} addrspace(10) @ejl_jl_true, {} addrspace(10) @ejl_jl_false, !dbg !74 %7 = icmp ne {} addrspace(10) %box4.i, %"box4.i'mi", !dbg !74 %8 = select i1 %7, {} addrspace(10) @ejl_jl_true, {} addrspace(10) @ejl_jl_false, !dbg !74 %9 = call {} addrspace(10) ({} addrspace(10) ({} addrspace(10)*, {} addrspace(10), i32), {} addrspace(10), ...) @julia.call({} addrspace(10) ({} addrspace(10), {} addrspace(10), i32) @jl_f_tuple, {} addrspace(10) null, {} addrspace(10) @ejl_jl_false, {} addrspace(10) @ejl_jl_false, {} addrspace(10) @ejl_jl_false, {} addrspace(10) %6, {} addrspace(10) %8, {} addrspace(10) @ejl_jl_false), !dbg !74 %10 = call {} addrspace(10) ({} addrspace(10) ({} addrspace(10)*, {} addrspace(10), i32), {} addrspace(10), ...) @julia.call({} addrspace(10) ({} addrspace(10), {} addrspace(10), i32) @jl_f_apply_type, {} addrspace(10) null, {} addrspace(10) addrspacecast ({} inttoptr (i64 4696806880 to {}) to {} addrspace(10)), {} addrspace(10) %9), !dbg !74 %11 = call {} addrspace(10) ({} addrspace(10) ({} addrspace(10), {} addrspace(10), i32), {} addrspace(10), ...) @julia.call({} addrspace(10) ({} addrspace(10), {} addrspace(10)*, i32) @ijl_apply_generic, {} addrspace(10) @ejl_enz_runtime_generic_rev, {} addrspace(10) %10, {} addrspace(10) @ejl_enz_val_1, {} addrspace(10) addrspacecast ({} inttoptr (i64 6085433248 to {}) to {} addrspace(10)), {} addrspace(10) %4, {} addrspace(10) addrspacecast ({} inttoptr (i64 4697027088 to {}) to {} addrspace(10)), {} addrspace(10) @ejl_jl_nothing, {} addrspace(10) addrspacecast ({} inttoptr (i64 4724551792 to {}) to {} addrspace(10)), {} addrspace(10) @ejl_jl_nothing, {} addrspace(10) addrspacecast ({} inttoptr (i64 4697015920 to {}) to {} addrspace(10)), {} addrspace(10) @ejl_jl_nothing, {} addrspace(10) %box.i, {} addrspace(10) %"box.i'mi", {} addrspace(10) %box4.i, {} addrspace(10) %"box4.i'mi", {} addrspace(10) addrspacecast ({} inttoptr (i64 4696054864 to {}) to {} addrspace(10)), {} addrspace(10) @ejl_jl_nothing), !dbg !74 fence syncscope("singlethread") seq_cst fence syncscope("singlethread") seq_cst ret void }

Base.allocatedinline(actualRetType) != Base.allocatedinline(literal_rt): actualRetType = Any, literal_rt = Float64, rettype = EnzymeCore.Active{Float64}, sret_union=false, pactualRetType=Any

Stacktrace: [1] create_abi_wrapper(enzymefn::LLVM.Function, TT::Type, rettype::Type, actualRetType::Type, Mode::Enzyme.API.CDerivativeMode, augmented::Ptr{…}, width::Int64, returnPrimal::Bool, shadow_init::Bool, world::UInt64, interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter) @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:4314 [2] enzyme!(job::GPUCompiler.CompilerJob{…}, mod::LLVM.Module, primalf::LLVM.Function, TT::Type, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, wrap::Bool, modifiedBetween::NTuple{…}, returnPrimal::Bool, expectedTapeType::Type, loweredArgs::Set{…}, boxedArgs::Set{…}) @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:4163 [3] codegen(output::Symbol, job::GPUCompiler.CompilerJob{…}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, toplevel::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing) @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:6438 [4] codegen @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:5614 [inlined] [5] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool) @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7241 [6] _thunk @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7241 [inlined] [7] cached_compilation @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7282 [inlined] [8] thunkbase(ctx::LLVM.Context, mi::Core.MethodInstance, ::Val{…}, ::Type{…}, ::Type{…}, tt::Type{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Val{…}, ::Type{…}, ::Val{…}) @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7355 [9] #s2080#19052 @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7407 [inlined] [10] @ Enzyme.Compiler ./none:0 [11] (::Core.GeneratedFunctionStub)(::UInt64, ::LineNumberNode, ::Any, ::Vararg{Any}) @ Core ./boot.jl:602 [12] runtime_generic_augfwd(activity::Type{…}, width::Val{…}, ModifiedBetween::Val{…}, RT::Val{…}, f::Base.var"##sum#829", df::Nothing, primal_1::Colon, shadow_1_1::Nothing, @.***{}, shadow_2_1::Nothing, primal_3::typeof(sum), shadow_3_1::Nothing, primal_4::Base.Fix1{…}, shadow_4_1::Base.Fix1{…}, primal_5::ColumnSlices{…}, shadow_5_1::ColumnSlices{…}) @ Enzyme.Compiler ~/.julia/packages/Enzyme/TiboG/src/rules/jitrules.jl:334 [13] sum @ ./reducedim.jl:1011 [inlined] [14] f @ ~/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:11 [inlined] [15] augmented_julia_f_15459wrap @ ~/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:0 [16] macro expansion @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:7187 [inlined] [17] enzyme_call @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:6794 [inlined] [18] AugmentedForwardThunk @ ~/.julia/packages/Enzyme/TiboG/src/compiler.jl:6682 [inlined] [19] autodiff @ ~/.julia/packages/Enzyme/TiboG/src/Enzyme.jl:264 [inlined] [20] autodiff @ ~/.julia/packages/Enzyme/TiboG/src/Enzyme.jl:332 [inlined] [21] gradient(rm::EnzymeCore.ReverseMode{false, EnzymeCore.FFIABI, false, false}, f::typeof(Main.MWE.f), x::Matrix{Float64}) @ Enzyme ~/.julia/packages/Enzyme/TiboG/src/Enzyme.jl:1049 [22] top-level scope @ ~/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:16 [23] include(fname::String) @ Base.MainInclude ./client.jl:489 [24] top-level scope @ REPL[21]:1 in expression starting at /Users/mhauru/projects/Enzyme-mwes/MappingRF_BottomRF/mwe.jl:1 Some type information was truncated. Use show(err) to see complete types.

The MWE is almost the same as #1812 https://github.com/EnzymeAD/Enzyme.jl/issues/1812, the only difference being that Dirichlet has been replaced with MvNormal. However, the error looks substantially different, and this one fails with both eachrow and eachcol, whereas #1812 https://github.com/EnzymeAD/Enzyme.jl/issues/1812 only fails with eachrow. Hence unsure if this is the same underlying issue.

— Reply to this email directly, view it on GitHub https://github.com/EnzymeAD/Enzyme.jl/issues/1939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJTUXF643KSAVOJCRNDQV3ZZZR4DAVCNFSM6AAAAABPLRUNWGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGU3DKOJYHAYTOOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mhauru commented 1 month ago

Same thing on Enzyme v0.13.7