Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality to precompile the runtime library. #465

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/device/runtime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
GPUCompiler.reset_runtime()

# load or build the runtime for the most likely compilation job given a compute capability
function load_runtime(cap::VersionNumber)
target = PTXCompilerTarget(; cap=cap)
function precompile_runtime(caps=llvm_cap_support(LLVM.version()))
dummy_source = FunctionSpec(()->return, Tuple{})
params = CUDACompilerParams()
job = CompilerJob(target, dummy_source, params)
GPUCompiler.load_runtime(job)
JuliaContext() do ctx
for cap in caps
target = PTXCompilerTarget(; cap=cap)
job = CompilerJob(target, dummy_source, params)
GPUCompiler.load_runtime(job, ctx)
end
end
return
end

@inline exception_flag() = ccall("extern julia_exception_flag", llvmcall, Ptr{Cvoid}, ())
Expand Down
3 changes: 3 additions & 0 deletions test/setup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ using Random
# detect cuda-memcheck
const memcheck = haskey(ENV, "CUDA_MEMCHECK")

# precompile the runtime library
CUDA.precompile_runtime()


## entry point

Expand Down