Skip to content

Commit 440d6be

Browse files
committed
refine to llvmcall instead
1 parent 01b0444 commit 440d6be

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/driver.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ function codegen(output::Symbol, @nospecialize(job::CompilerJob);
130130
error("Unknown compilation output $output")
131131
end
132132

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

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

src/jlgen.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,6 @@ function CC.abstract_call_known(interp::GPUInterpreter, @nospecialize(f),
454454
return CC.CallMeta(Ptr{Cvoid}, Union{}, CC.Effects(), callinfo)
455455
end
456456
end
457-
if f === var"gpuc.lookup"
458-
error("Unimplemented")
459-
end
460457
return @invoke CC.abstract_call_known(interp::CC.AbstractInterpreter, f,
461458
arginfo::CC.ArgInfo, si::CC.StmtInfo, sv::CC.AbsIntState,
462459
max_methods::Int)
@@ -479,10 +476,17 @@ function CC.handle_call!(todo::Vector{Pair{Int,Any}},
479476
@assert case isa CC.InvokeCase
480477
@assert stmt.head === :call
481478

482-
# rewrite the marker function
483-
stmt.args[1] = var"gpuc.lookup"
484-
# insert the mi
485-
insert!(stmt.args, 2, case.invoke)
479+
args = Any[
480+
"extern gpuc.lookup",
481+
Ptr{Cvoid},
482+
Core.svec(Any, Any, match.spec_types.parameters[2:end]...), # Must use Any for MethodInstance or ftype
483+
0,
484+
QuoteNode(:llvmcall),
485+
case.invoke,
486+
stmt.args[2:end]...
487+
]
488+
stmt.head = :foreigncall
489+
stmt.args = args
486490
return nothing
487491
end
488492

0 commit comments

Comments
 (0)