Skip to content

Commit fe5df66

Browse files
committed
refine to llvmcall instead
1 parent e7f77dd commit fe5df66

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/driver.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ function codegen(output::Symbol, @nospecialize(job::CompilerJob);
163163
error("Unknown compilation output $output")
164164
end
165165

166-
@noinline function var"gpuc.deferred"(f, args...) end
167-
@noinline function var"gpuc.lookup"(mi, f, args...) end
166+
# GPUCompiler intrinsic that marks deferred compilation
167+
function var"gpuc.deferred" end
168168

169169
# primitive mechanism for deferred compilation, for implementing CUDA dynamic parallelism.
170170
# this could both be generalized (e.g. supporting actual function calls, instead of

src/jlgen.jl

+11-7
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,6 @@ function CC.abstract_call_known(interp::GPUInterpreter, @nospecialize(f),
479479
return CC.CallMeta(Ptr{Cvoid}, Union{}, CC.Effects(), callinfo)
480480
end
481481
end
482-
if f === var"gpuc.lookup"
483-
error("Unimplemented")
484-
end
485482
return @invoke CC.abstract_call_known(interp::CC.AbstractInterpreter, f,
486483
arginfo::CC.ArgInfo, si::CC.StmtInfo, sv::CC.AbsIntState,
487484
max_methods::Int)
@@ -504,10 +501,17 @@ function CC.handle_call!(todo::Vector{Pair{Int,Any}},
504501
@assert case isa CC.InvokeCase
505502
@assert stmt.head === :call
506503

507-
# rewrite the marker function
508-
stmt.args[1] = var"gpuc.lookup"
509-
# insert the mi
510-
insert!(stmt.args, 2, case.invoke)
504+
args = Any[
505+
"extern gpuc.lookup",
506+
Ptr{Cvoid},
507+
Core.svec(Any, Any, match.spec_types.parameters[2:end]...), # Must use Any for MethodInstance or ftype
508+
0,
509+
QuoteNode(:llvmcall),
510+
case.invoke,
511+
stmt.args[2:end]...
512+
]
513+
stmt.head = :foreigncall
514+
stmt.args = args
511515
return nothing
512516
end
513517

0 commit comments

Comments
 (0)