Skip to content

Commit

Permalink
Update usage of GPUCompiler to new interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Seelengrab committed Jun 6, 2024
1 parent 3777a33 commit 24bae9e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/MCAnalyzer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ function mcjob(@nospecialize(func), @nospecialize(types);
cpu::String = (LLVM.version() < v"8") ? "" : unsafe_string(LLVM.API.LLVMGetHostCPUName()),
features::String=(LLVM.version() < v"8") ? "" : unsafe_string(LLVM.API.LLVMGetHostCPUFeatures()),
kwargs...)
source = FunctionSpec(func, Base.to_tuple_type(types), #=kernel=# false)
source = methodinstance(typeof(func), Base.to_tuple_type(types))
target = NativeCompilerTarget(cpu=cpu, features=features)
params = CompilerParams()
CompilerJob(target, source, params), kwargs
config = CompilerConfig(target, params; kernel=false)
CompilerJob(source, config), kwargs
end

include("reflection.jl")
Expand Down Expand Up @@ -78,8 +79,7 @@ analyze(mysum, (Vector{Float64},))
"""
function analyze(@nospecialize(func), @nospecialize(tt), march=:SKL; kwargs...)
job, kwargs = mcjob(func, tt; cpu=llvm_march(march), kwargs...)
mi, _ = GPUCompiler.emit_julia(job)
ir, func = GPUCompiler.emit_llvm(job, mi; ctx=JuliaContext(), only_entry=false, kwargs...)
ir, func = GPUCompiler.compile(:llvm, job; ctx=JuliaContext(), only_entry=false, kwargs...)

mktempdir() do dir
asmfile = joinpath(dir, "a.S")
Expand Down Expand Up @@ -123,8 +123,7 @@ timeline(mysum, (Vector{Float64},))
"""
function timeline(@nospecialize(func), @nospecialize(tt), march=:SKL; kwargs...)
job, kwargs = mcjob(func, tt; cpu=llvm_march(march), kwargs...)
mi, _ = GPUCompiler.emit_julia(job)
ir, func = GPUCompiler.emit_llvm(job, mi; ctx=JuliaContext(), only_entry=false, kwargs...)
ir, _ = GPUCompiler.compile(:llvm, job; ctx=JuliaContext(), only_entry=false, kwargs...)

mktempdir() do dir
asmfile = joinpath(dir, "a.S")
Expand Down Expand Up @@ -168,8 +167,7 @@ bottleneck(mysum, (Vector{Float64},))
"""
function bottleneck(@nospecialize(func), @nospecialize(tt), march=:SKL; kwargs...)
job, kwargs = mcjob(func, tt; cpu=llvm_march(march), kwargs...)
mi, _ = GPUCompiler.emit_julia(job)
ir, func = GPUCompiler.emit_llvm(job, mi; ctx=JuliaContext(), only_entry=false, kwargs...)
ir, _ = GPUCompiler.compile(:llvm, job; ctx=JuliaContext(), only_entry=false, kwargs...)

mktempdir() do dir
asmfile = joinpath(dir, "a.S")
Expand All @@ -187,8 +185,7 @@ end

function allstats(@nospecialize(func), @nospecialize(tt), march=:SKL; kwargs...)
job, kwargs = mcjob(func, tt; cpu=llvm_march(march), kwargs...)
mi, _ = GPUCompiler.emit_julia(job)
ir, func = GPUCompiler.emit_llvm(job, mi; ctx=JuliaContext(), only_entry=false, kwargs...)
ir, func = GPUCompiler.compile(:llvm, job; ctx=JuliaContext(), only_entry=false, kwargs...)

mktempdir() do dir
asmfile = joinpath(dir, "a.S")
Expand Down

0 comments on commit 24bae9e

Please sign in to comment.