Skip to content

Commit 1c42a57

Browse files
author
kylincaster
committed
update for GPUCompiler by removing the deprecated API
1 parent 1eda46a commit 1c42a57

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

src/StaticCompiler.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,9 @@ function static_llvm_module(f, tt, name=fix_name(f); demangle=true, target::Stat
452452
if !demangle
453453
name = "julia_"*name
454454
end
455-
job, kwargs = static_job(f, tt; name, target, kwargs...)
455+
job, kwargs = static_job(f, tt; name, target, strip=true, only_entry=false, validate=false, libraries=false, kwargs...)
456456
m = GPUCompiler.JuliaContext() do context
457-
m, _ = GPUCompiler.codegen(:llvm, job; strip=true, only_entry=false, validate=false, libraries=false)
457+
m, _ = GPUCompiler.compile(:llvm, job; kwargs...)
458458
locate_pointers_and_runtime_calls(m)
459459
m
460460
end
@@ -469,17 +469,17 @@ function static_llvm_module(funcs::Union{Array,Tuple}; demangle=true, target::St
469469
if !demangle
470470
name_f = "julia_"*name_f
471471
end
472-
job, kwargs = static_job(f, tt; name = name_f, target, kwargs...)
473-
mod,_ = GPUCompiler.codegen(:llvm, job; strip=true, only_entry=false, validate=false, libraries=false)
472+
job, kwargs = static_job(f, tt; name = name_f, target, strip=true, only_entry=false, validate=false, libraries=false, kwargs...)
473+
mod,_ = GPUCompiler.compile(:llvm, job; kwargs...)
474474
if length(funcs) > 1
475475
for func in funcs[2:end]
476476
f,tt = func
477477
name_f = fix_name(f)
478478
if !demangle
479479
name_f = "julia_"*name_f
480480
end
481-
job, kwargs = static_job(f, tt; name = name_f, target, kwargs...)
482-
tmod,_ = GPUCompiler.codegen(:llvm, job; strip=true, only_entry=false, validate=false, libraries=false)
481+
job, kwargs = static_job(f, tt; name = name_f, target, strip=true, only_entry=false, validate=false, libraries=false, kwargs...)
482+
tmod,_ = GPUCompiler.compile(:llvm, job; kwargs...)
483483
link!(mod,tmod)
484484
end
485485
end

src/interpreter.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ function Core.Compiler.InferenceState(result::InferenceResult, cache::Symbol, in
9393
mi = result.linfo
9494
src = custom_pass!(interp, result, mi, src)
9595
src === nothing && return @static if VERSION < v"1.11"
96-
Core.Compiler.maybe_validate_code(result.linfo, src, "lowered")
97-
else
9896
Core.Compiler.validate_code_in_debug_mode(result.linfo, src, "lowered")
97+
else
98+
Core.Compiler.maybe_validate_code(result.linfo, src, "lowered")
9999
end
100100
return InferenceState(result, src, cache, interp)
101101
end

src/target.jl

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,6 @@ end
102102
GPUCompiler.method_table(@nospecialize(job::GPUCompiler.CompilerJob{<:StaticCompilerTarget})) = job.config.target.method_table
103103

104104

105-
function static_job(@nospecialize(func::Function), @nospecialize(types::Type);
106-
name = fix_name(func),
107-
kernel::Bool = false,
108-
target::StaticTarget = StaticTarget(),
109-
method_table=method_table,
110-
kwargs...
111-
)
112-
source = methodinstance(typeof(func), Base.to_tuple_type(types))
113-
tm = target.tm
114-
gputarget = StaticCompilerTarget(LLVM.triple(tm), LLVM.cpu(tm), LLVM.features(tm), target.julia_runtime, method_table)
115-
params = StaticCompilerParams()
116-
config = GPUCompiler.CompilerConfig(gputarget, params, name = name, kernel = kernel)
117-
StaticCompiler.CompilerJob(source, config), kwargs
118-
end
119105
function static_job(@nospecialize(func), @nospecialize(types);
120106
name = fix_name(func),
121107
kernel::Bool = false,
@@ -127,6 +113,11 @@ function static_job(@nospecialize(func), @nospecialize(types);
127113
tm = target.tm
128114
gputarget = StaticCompilerTarget(LLVM.triple(tm), LLVM.cpu(tm), LLVM.features(tm), target.julia_runtime, method_table)
129115
params = StaticCompilerParams()
130-
config = GPUCompiler.CompilerConfig(gputarget, params, name = name, kernel = kernel)
131-
StaticCompiler.CompilerJob(source, config), kwargs
116+
@static if pkgversion(GPUCompiler) < v"1"
117+
config = GPUCompiler.CompilerConfig(gputarget, params; name = name, kernel = kernel)
118+
return StaticCompiler.CompilerJob(source, config), kwargs
119+
else
120+
config = GPUCompiler.CompilerConfig(gputarget, params; name = name, kernel = kernel, kwargs...)
121+
return StaticCompiler.CompilerJob(source, config), Dict{}()
122+
end
132123
end

0 commit comments

Comments
 (0)