-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Labels
Julia v1.12Related to compatibility with Julia v1.12Related to compatibility with Julia v1.12
Description
On #2675
Error During Test at /home/runner/work/Enzyme.jl/Enzyme.jl/test/usermixed.jl:124
Got exception outside of a @test
AssertionError: Enzyme Internal Error (expectLen != length(parameters(f)))
define double @julia_user_mixfnc_28726(ptr addrspace(11) nocapture noundef nonnull readonly align 8 dereferenceable(16) %"tup::Tuple", ptr nocapture readonly %.roots.tup) #8 !dbg !31 {
top:
%.size = alloca i64, align 8
%"new::Tuple" = alloca [1 x i64], align 8
%pgcstack = call ptr @julia.get_pgcstack()
%0 = getelementptr inbounds i8, ptr %.roots.tup, i32 0
%1 = load ptr addrspace(10), ptr %0, align 8, !tbaa !9, !alias.scope !33, !noalias !34
%current_task = getelementptr inbounds i8, ptr %pgcstack, i32 -152
%ptls_field = getelementptr inbounds i8, ptr %current_task, i32 168
%ptls_load = load ptr, ptr %ptls_field, align 8, !tbaa !9
%2 = getelementptr inbounds i8, ptr %ptls_load, i32 16
%safepoint = load ptr, ptr %2, align 8, !tbaa !13
fence syncscope("singlethread") seq_cst
call void @julia.safepoint(ptr %safepoint), !dbg !35
fence syncscope("singlethread") seq_cst
br i1 false, label %L20, label %L8, !dbg !36
L8: ; preds = %top
%3 = addrspacecast ptr addrspace(10) %1 to ptr addrspace(11), !dbg !39
%.size_ptr = getelementptr inbounds i8, ptr addrspace(11) %3, i32 16, !dbg !39
call void @llvm.memcpy.p0.p11.i64(ptr align 8 %.size, ptr addrspace(11) align 8 %.size_ptr, i64 8, i1 false), !dbg !39, !tbaa !28, !alias.scope !41, !noalias !42
%bitcast = load i64, ptr %.size, align 8, !dbg !36, !tbaa !43, !alias.scope !45, !noalias !46
%4 = icmp ult i64 0, %bitcast, !dbg !36
%5 = xor i1 %4, true, !dbg !36
br i1 %5, label %L17, label %L16, !dbg !36
L16: ; preds = %L8
br label %L20, !dbg !36
L17: ; preds = %L8
%6 = getelementptr inbounds i8, ptr %"new::Tuple", i32 0, !dbg !36
call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 @_j_const_1, i64 8, i1 false), !dbg !36, !tbaa !28, !alias.scope !47, !noalias !48
%7 = addrspacecast ptr %"new::Tuple" to ptr addrspace(11), !dbg !36
call void @julia_throw_boundserror_28731(ptr addrspace(10) %1, ptr addrspace(11) nocapture readonly %7) #11, !dbg !36
call void @ijl_error(ptr @_j_str__Internal_Error___IR_Vali____2), !dbg !36
unreachable, !dbg !36
L20: ; preds = %L16, %top
%8 = addrspacecast ptr addrspace(10) %1 to ptr addrspace(11), !dbg !49
%9 = getelementptr inbounds { ptr, ptr addrspace(10) }, ptr addrspace(11) %8, i32 0, i32 0, !dbg !49
%memoryref_data = load ptr, ptr addrspace(11) %9, align 8, !dbg !49, !tbaa !50, !alias.scope !53, !noalias !54
%10 = getelementptr inbounds { ptr, ptr addrspace(10) }, ptr addrspace(11) %8, i32 0, i32 1, !dbg !49
%memoryref_mem = load ptr addrspace(10), ptr addrspace(11) %10, align 8, !dbg !49, !tbaa !50, !alias.scope !53, !noalias !54, !dereferenceable_or_null !27, !align !25
%11 = insertvalue { ptr, ptr addrspace(10) } zeroinitializer, ptr %memoryref_data, 0, !dbg !49
%.ref = insertvalue { ptr, ptr addrspace(10) } %11, ptr addrspace(10) %memoryref_mem, 1, !dbg !49
%12 = addrspacecast ptr addrspace(10) %memoryref_mem to ptr addrspace(11), !dbg !49
%13 = getelementptr inbounds { i64, ptr }, ptr addrspace(11) %12, i32 0, i32 0, !dbg !49
%memory_len = load i64, ptr addrspace(11) %13, align 8, !dbg !49, !tbaa !55, !range !57, !alias.scope !53, !noalias !54
%14 = add nuw i64 %memory_len, %memory_len, !dbg !49
%15 = add i64 0, %memory_len, !dbg !49
%memoryref_ovflw = icmp uge i64 %15, %14, !dbg !49
%memoryref_data_byteoffset = getelementptr i8, ptr %memoryref_data, i64 0, !dbg !49
%16 = addrspacecast ptr addrspace(10) %memoryref_mem to ptr addrspace(11), !dbg !49
%17 = getelementptr inbounds { i64, ptr }, ptr addrspace(11) %16, i32 0, i32 0, !dbg !49
%memory_len1 = load i64, ptr addrspace(11) %17, align 8, !dbg !49, !tbaa !55, !range !57, !alias.scope !53, !noalias !54
%18 = addrspacecast ptr addrspace(10) %memoryref_mem to ptr addrspace(11), !dbg !49
%memory_data_ptr = getelementptr inbounds { i64, ptr }, ptr addrspace(11) %18, i32 0, i32 1, !dbg !49
%memory_data = load ptr, ptr addrspace(11) %memory_data_ptr, align 8, !dbg !49, !tbaa !58, !alias.scope !53, !noalias !54, !nonnull !0
%19 = ptrtoint ptr %memory_data to i64, !dbg !49
%20 = ptrtoint ptr %memoryref_data_byteoffset to i64, !dbg !49
%21 = sub i64 %20, %19, !dbg !49
%memoryref_bytelen = mul nuw nsw i64 %memory_len1, 8, !dbg !49
%memoryref_isinbounds = icmp ult i64 %21, %memoryref_bytelen, !dbg !49
%22 = xor i1 %memoryref_ovflw, true, !dbg !49
%"memoryref_isinbounds¬ovflw" = and i1 %22, %memoryref_isinbounds, !dbg !49
br i1 %"memoryref_isinbounds¬ovflw", label %idxend, label %oob, !dbg !49
L24: ; preds = %load
%"tup::Tuple.unbox" = load double, ptr addrspace(11) %"tup::Tuple", align 8, !dbg !60, !tbaa !13, !alias.scope !16, !noalias !19
%23 = fmul double %"tup::Tuple.unbox", %33, !dbg !60
ret double %23, !dbg !38
oob: ; preds = %L20
%"+Core.GenericMemoryRef#28729" = load ptr, ptr @_Core_GenericMemoryRef_28729, align 8, !dbg !49, !tbaa !13, !alias.scope !16, !noalias !19, !nonnull !0, !dereferenceable !26, !align !27
%GenericMemoryRef = ptrtoint ptr %"+Core.GenericMemoryRef#28729" to i64, !dbg !49
%24 = inttoptr i64 %GenericMemoryRef to ptr, !dbg !49
%current_task2 = getelementptr inbounds i8, ptr %pgcstack, i32 -152, !dbg !49
%25 = addrspacecast ptr %24 to ptr addrspace(10), !dbg !49
%"box::GenericMemoryRef" = call noalias nonnull align 8 dereferenceable(16) ptr addrspace(10) @julia.gc_alloc_obj(ptr %current_task2, i64 16, ptr addrspace(10) %25) #12, !dbg !49
%26 = addrspacecast ptr addrspace(10) %"box::GenericMemoryRef" to ptr addrspace(11), !dbg !49
store { ptr, ptr addrspace(10) } %.ref, ptr addrspace(11) %26, align 8, !dbg !49, !tbaa !63, !alias.scope !67, !noalias !68
%27 = addrspacecast ptr addrspace(10) %"box::GenericMemoryRef" to ptr addrspace(12), !dbg !49
call void @ijl_bounds_error_int(ptr addrspace(12) %27, i64 1), !dbg !49
unreachable, !dbg !49
idxend: ; preds = %L20
%28 = insertvalue { ptr, ptr addrspace(10) } zeroinitializer, ptr %memoryref_data_byteoffset, 0, !dbg !49
%memory_ref = insertvalue { ptr, ptr addrspace(10) } %28, ptr addrspace(10) %memoryref_mem, 1, !dbg !49
%29 = addrspacecast ptr addrspace(10) %memoryref_mem to ptr addrspace(11), !dbg !49
%30 = getelementptr inbounds { i64, ptr }, ptr addrspace(11) %29, i32 0, i32 0, !dbg !49
%memory_len3 = load i64, ptr addrspace(11) %30, align 8, !dbg !49, !tbaa !55, !range !57, !alias.scope !53, !noalias !54
%31 = icmp eq i64 %memory_len3, 0, !dbg !49
br i1 %31, label %oob4, label %load, !dbg !49
oob4: ; preds = %idxend
%32 = addrspacecast ptr addrspace(10) %memoryref_mem to ptr addrspace(12), !dbg !49
call void @ijl_bounds_error_int(ptr addrspace(12) %32, i64 1), !dbg !49
unreachable, !dbg !49
load: ; preds = %idxend
%memoryref_data5 = call ptr addrspace(13) @julia.gc_loaded(ptr addrspace(10) %memoryref_mem, ptr %memoryref_data), !dbg !49
%33 = load double, ptr addrspace(13) %memoryref_data5, align 8, !dbg !49, !tbaa !69, !alias.scope !67, !noalias !68
br label %L24, !dbg !49
after_error: ; No predecessors!
call void @llvm.trap(), !dbg !36
unreachable, !dbg !36
after_noret: ; No predecessors!
call void @llvm.trap(), !dbg !36
unreachable, !dbg !36
}
expectLen=1
swiftself=false
sret=nothing
returnRoots=nothing
mi.specTypes.parameters=svec(Main.var"##usermixed#277".var"#user_mixfnc", Tuple{Float64, Vector{Float64}})
retRemoved=false
parmsRemoved=UInt64[]
Stacktrace:
[1] julia_activity_rule(f::LLVM.Function)
@ Enzyme.Compiler ~/work/Enzyme.jl/Enzyme.jl/src/rules/activityrules.jl:48
[2] handle_compiled(state::Enzyme.Compiler.HandlerState, edges::Vector{Any}, run_enzyme::Bool, mode::Enzyme.API.CDerivativeMode, world::UInt64, method_table::Compiler.OverlayMethodTable, custom::Dict{String, LLVM.API.LLVMLinkage}, mod::LLVM.Module, mi::Core.MethodInstance, k_name::String, rettype::Type)
@ Enzyme.Compiler ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:628
[3] set_module_types!(interp::Enzyme.Compiler.Interpreter.EnzymeInterpreter{Nothing}, mod::LLVM.Module, primalf::LLVM.Function, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget{GPUCompiler.NativeCompilerTarget}, Enzyme.Compiler.EnzymeCompilerParams{Enzyme.Compiler.PrimalCompilerParams}}, edges::Vector{Any}, run_enzyme::Bool, mode::Enzyme.API.CDerivativeMode)
@ Enzyme.Compiler ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:1220
[4] compile_unhooked(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget{GPUCompiler.NativeCompilerTarget}, Enzyme.Compiler.EnzymeCompilerParams{Enzyme.Compiler.PrimalCompilerParams}})
@ Enzyme.Compiler ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:4627
[5] compile(target::Symbol, job::GPUCompiler.CompilerJob; kwargs::@Kwargs{})
@ GPUCompiler ~/.julia/packages/GPUCompiler/Gp8bZ/src/driver.jl:67
[6] compile
@ ~/.julia/packages/GPUCompiler/Gp8bZ/src/driver.jl:55 [inlined]
[7] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget{GPUCompiler.NativeCompilerTarget}, Enzyme.Compiler.EnzymeCompilerParams{Enzyme.Compiler.PrimalCompilerParams}}, postopt::Bool)
@ Enzyme.Compiler ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:5960
[8] _thunk
@ ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:5958 [inlined]
[9] cached_compilation
@ ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:6015 [inlined]
[10] thunkbase(mi::Core.MethodInstance, World::UInt64, FA::Type{<:EnzymeCore.Annotation}, A::Type{<:EnzymeCore.Annotation}, TT::Type, Mode::Enzyme.API.CDerivativeMode, width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, StrongZero::Bool, edges::Vector{Any})
@ Enzyme.Compiler ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:6131
[11] thunk_generator(world::UInt64, source::Union{LineNumberNode, Method}, FA::Type, A::Type, TT::Type, Mode::Enzyme.API.CDerivativeMode, Width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, StrongZero::Bool, self::Any, fakeworld::Any, fa::Type, a::Type, tt::Type, mode::Type, width::Type, modifiedbetween::Type, returnprimal::Type, shadowinit::Type, abi::Type, erriffuncwritten::Type, runtimeactivity::Type, strongzero::Type)
@ Enzyme.Compiler ~/work/Enzyme.jl/Enzyme.jl/src/compiler.jl:6275
[12] autodiff
@ ~/work/Enzyme.jl/Enzyme.jl/src/Enzyme.jl:502 [inlined]
[13] autodiff(mode::EnzymeCore.ReverseMode{false, false, false, EnzymeCore.FFIABI, false, false}, f::typeof(Main.var"##usermixed#277".user_mixfnc), ::Type{EnzymeCore.Active}, args::EnzymeCore.MixedDuplicated{Tuple{Float64, Vector{Float64}}})
@ Enzyme ~/work/Enzyme.jl/Enzyme.jl/src/Enzyme.jl:542
[14] top-level scope
@ ~/work/Enzyme.jl/Enzyme.jl/test/usermixed.jl:125
[15] macro expansion
@ ~/work/Enzyme.jl/Enzyme.jl/julia/usr/share/julia/stdlib/v1.12/Test/src/Test.jl:1776 [inlined]
[16] macro expansion
@ ~/work/Enzyme.jl/Enzyme.jl/test/usermixed.jl:128 [inlined]
Metadata
Metadata
Assignees
Labels
Julia v1.12Related to compatibility with Julia v1.12Related to compatibility with Julia v1.12