You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to its heritage GPUCompiler currently only handles specptr and more recently jfptr.
In EnzymeAD/Enzyme.jl#1134 Enzyme is encountering a expectation mismatch. Esentially we ask GPUCompiler to produce a function with specptr ABI and receive a function with ABI japi
Enzyme most likely will need to handle the multiple ABI's, but I would prefer if there was a better way than just matching the name of the function. Julia internally has the calling convention during codegen and we may be able to put that in meta?
module Native
using GPUCompiler
using ReTestItems
setup = include(joinpath(dirname(pathof(GPUCompiler)), "..", "test", "native_testsetup.jl"))
cd(dirname(setup.file)) do
eval(setup.code)
end
end
asm = sprint(io->Native.code_llvm(io, f, (Float64,)))
r_invoke = r"@ijl_invoke({}* inttoptr (i64 (\d*) to {}*), {}** nonnull %.sub, i32 31, {}* inttoptr (i64 (\d*) to {}*))"
m = match(r_invoke, asm)
F = Base.unsafe_pointer_to_objref(Base.reinterpret(Ptr{Cvoid}, parse(UInt, m.captures[1])))
mi = Base.unsafe_pointer_to_objref(Base.reinterpret(Ptr{Cvoid}, parse(UInt, m.captures[2])))
Due to its heritage GPUCompiler currently only handles
specptr
and more recentlyjfptr
.In EnzymeAD/Enzyme.jl#1134 Enzyme is encountering a expectation mismatch. Esentially we ask GPUCompiler to produce a function with
specptr
ABI and receive a function with ABIjapi
To exemplify the issue on 1.10-rc2
hvcat
contains aninvoke
call. So trying to codegen thef
function using GPUCompiler yields:Enzyme then goes and extracts the method instance of the call target (Enzyme free reproducer below) and GPUCompiler produces a
Enzyme most likely will need to handle the multiple ABI's, but I would prefer if there was a better way than just matching the name of the function. Julia internally has the calling convention during codegen and we may be able to put that in meta?
cc: @gbaraldi @wsmoses
Enzyme free reproducer
function f(temp)
R_inv = [temp 0. 0. 0. 0. 0.;
0. temp 0. 0. 0. 0.;
0. 0. temp 0. 0. 0.;
0. 0. 0. temp 0. 0.;
0. 0. 0. 0. temp 0.;
]
end
module Native
using GPUCompiler
using ReTestItems
setup = include(joinpath(dirname(pathof(GPUCompiler)), "..", "test", "native_testsetup.jl"))
cd(dirname(setup.file)) do
eval(setup.code)
end
end
asm = sprint(io->Native.code_llvm(io, f, (Float64,)))
r_invoke = r"@ijl_invoke({}* inttoptr (i64 (\d*) to {}*), {}** nonnull %.sub, i32 31, {}* inttoptr (i64 (\d*) to {}*))"
m = match(r_invoke, asm)
F = Base.unsafe_pointer_to_objref(Base.reinterpret(Ptr{Cvoid}, parse(UInt, m.captures[1])))
mi = Base.unsafe_pointer_to_objref(Base.reinterpret(Ptr{Cvoid}, parse(UInt, m.captures[2])))
target = Native.NativeCompilerTarget()
params = Native.CompilerParams(false, Native.test_method_table)
config = GPUCompiler.CompilerConfig(target, params; kernel=false, entry_abi=:specfunc, always_inline=false)
job = GPUCompiler.CompilerJob(mi, config)
GPUCompiler.code_llvm(job)
The text was updated successfully, but these errors were encountered: