Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7142,8 +7142,8 @@ function _link(@nospecialize(job::CompilerJob{<:EnzymeTarget}), mod::LLVM.Module
end

# Now invoke the JIT
jitted_mod = JIT.add!(mod)
adjoint_addr = JIT.lookup(adjoint_name)
jit_dylib = JIT.add!(mod)
adjoint_addr = JIT.lookup(jit_dylib, adjoint_name)

adjoint_ptr = pointer(adjoint_addr)
if adjoint_ptr === C_NULL
Expand All @@ -7157,7 +7157,7 @@ function _link(@nospecialize(job::CompilerJob{<:EnzymeTarget}), mod::LLVM.Module
if primal_name isa Nothing
primal_ptr = C_NULL
else
primal_addr = JIT.lookup(primal_name)
primal_addr = JIT.lookup(jit_dylib, primal_name)
primal_ptr = pointer(primal_addr)
if primal_ptr === C_NULL
throw(
Expand Down
6 changes: 5 additions & 1 deletion src/compiler/orcv2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,16 @@ function add!(mod)
jd = LLVM.JITDylib(lljit)
tsm = move_to_threadsafe(mod)
LLVM.add!(lljit, jd, tsm)
return nothing
return jd
end

function lookup(name)
lljit = jit[].jit
LLVM.lookup(lljit, JITDylib(lljit), name)
end

function lookup(jd::JITDylib, name)
LLVM.lookup(jit[].jit, jd, name)
end

end # module
Loading