Skip to content

Optimizer regression on 1.11 #506

Closed
Closed
@maleadt

Description

@maleadt
Error in testset "JuliaLang/julia#48097: kwcall inference in the presence of overlay method" on worker 4022595:
Test Failed at /home/maleadt/.julia/packages/GPUCompiler/3f5LS/test/native_tests.jl:534
  Expression: !(occursin("inttoptr", ir))
   Evaluated: !(occursin("inttoptr", "define void @julia_parent_21052() local_unnamed_addr #3 {\ntop:\n  %jlcallframe = alloca {}*, i32 4, align 8\n  %0 = call fastcc nonnull {}* @julia_typejoin_21060({}* readonly inttoptr (i64 140677987481232 to {}*), {}* readonly inttoptr (i64 140677987481296 to {}*))\n  %1 = load {}*, {}** bitcast (i8* getelementptr (i8, i8* @small_typeof, i64 64) to {}**), align 8\n  %2 = getelementptr inbounds {}*, {}** %jlcallframe, i32 0\n  store {}* %1, {}** %2, align 8\n  %3 = getelementptr inbounds {}*, {}** %jlcallframe, i32 1\n  store {}* inttoptr (i64 140677987481232 to {}*), {}** %3, align 8\n  %4 = getelementptr inbounds {}*, {}** %jlcallframe, i32 2\n  store {}* inttoptr (i64 140677987481296 to {}*), {}** %4, align 8\n  %5 = getelementptr inbounds {}*, {}** %jlcallframe, i32 3\n  store {}* %0, {}** %5, align 8\n  %6 = call nonnull {}* @jl_f_apply_type({}* null, {}** %jlcallframe, i32 4)\n  ret void\n}\n"))

MWE:

using GPUCompiler, LLVM

module TestRuntime
    # dummy methods
    signal_exception() = return
    malloc(sz) = C_NULL
    report_oom(sz) = return
    report_exception(ex) = return
    report_exception_name(ex) = return
    report_exception_frame(idx, func, file, line) = return
end

struct TestCompilerParams <: AbstractCompilerParams end
GPUCompiler.runtime_module(::CompilerJob{<:Any,TestCompilerParams}) = TestRuntime

child(; kwargs...) = return
function parent()
    child(; a=1f0, b=1.0)
    return
end

Base.Experimental.@MethodTable method_table
Base.Experimental.@overlay method_table @noinline Core.throw_inexacterror(f::Symbol, ::Type{T}, val) where {T} = return

source = methodinstance(typeof(parent), Tuple{})
target = NativeCompilerTarget()
params = TestCompilerParams()
config = CompilerConfig(target, params; kernel=false)
job = CompilerJob(source, config)

JuliaContext() do ctx
    ir, meta = GPUCompiler.compile(:llvm, job; validate=false)
    for f in functions(ir)
        if startswith(LLVM.name(f), "julia_parent")
            println(string(f))
        end
    end
end

Before JuliaLang/julia#51092:

define void @julia_parent_3932() local_unnamed_addr #0 !dbg !4 {
top:
  ret void, !dbg !8
}

After:

define void @julia_parent_12207() local_unnamed_addr #3 !dbg !36 {
top:
  %jlcallframe = alloca {}*, i32 4, align 8
  %0 = call fastcc nonnull {}* @julia_typejoin_12215({}* readonly inttoptr (i64 139659080241488 to {}*), {}* readonly inttoptr (i64 139659080241552 to {}*)), !dbg !40
  %1 = load {}*, {}** bitcast (i8* getelementptr (i8, i8* @small_typeof, i64 64) to {}**), align 8, !dbg !63, !tbaa !64, !alias.scope !68, !noalias !71, !nonnull !39, !dereferenceable !76, !align !77
  %2 = getelementptr inbounds {}*, {}** %jlcallframe, i32 0, !dbg !63
  store {}* %1, {}** %2, align 8, !dbg !63
  %3 = getelementptr inbounds {}*, {}** %jlcallframe, i32 1, !dbg !63
  store {}* inttoptr (i64 139659080241488 to {}*), {}** %3, align 8, !dbg !63
  %4 = getelementptr inbounds {}*, {}** %jlcallframe, i32 2, !dbg !63
  store {}* inttoptr (i64 139659080241552 to {}*), {}** %4, align 8, !dbg !63
  %5 = getelementptr inbounds {}*, {}** %jlcallframe, i32 3, !dbg !63
  store {}* %0, {}** %5, align 8, !dbg !63
  %6 = call nonnull {}* @jl_f_apply_type({}* null, {}** %jlcallframe, i32 4), !dbg !63
  ret void, !dbg !78
}

So basically, JuliaLang/julia#48097 got revived by JuliaLang/julia#51092. @aviatesk any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions