From 573ab890d039feaa3c29dc2c9c7a243353b08c03 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Sat, 16 Mar 2024 20:33:24 -0400 Subject: [PATCH] Define `compiler_job_from_backend` (#1328) --- lib/EnzymeCore/Project.toml | 2 +- lib/EnzymeCore/src/EnzymeCore.jl | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/EnzymeCore/Project.toml b/lib/EnzymeCore/Project.toml index ad6e42e371..f8f3721aad 100644 --- a/lib/EnzymeCore/Project.toml +++ b/lib/EnzymeCore/Project.toml @@ -1,7 +1,7 @@ name = "EnzymeCore" uuid = "f151be2c-9106-41f4-ab19-57ee4f262869" authors = ["William Moses ", "Valentin Churavy "] -version = "0.7.0" +version = "0.7.1" [compat] Adapt = "3, 4" diff --git a/lib/EnzymeCore/src/EnzymeCore.jl b/lib/EnzymeCore/src/EnzymeCore.jl index 56c200cd61..680e9e42d3 100644 --- a/lib/EnzymeCore/src/EnzymeCore.jl +++ b/lib/EnzymeCore/src/EnzymeCore.jl @@ -239,6 +239,22 @@ end function tape_type end +""" + compiler_job_from_backend(::KernelAbstractions.Backend, F::Type, TT:Type)::GPUCompiler.CompilerJob + +Returns a GPUCompiler CompilerJob from a backend as specified by the first argument to the function. + +For example, in CUDA one would do: + +```julia +function EnzymeCore.compiler_job_from_backend(::CUDABackend, @nospecialize(F::Type), @nospecialize(TT::Type)) + mi = GPUCompiler.methodinstance(F, TT) + return GPUCompiler.CompilerJob(mi, CUDA.compiler_config(CUDA.device())) +end +``` +""" +function compiler_job_from_backend end + include("rules.jl") end # module EnzymeCore