Skip to content

[Experiment] use GPUCompiler instead of OpaqueClosures in call_with_reactant #1505

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527"
GPUCompiler = "61eb1bfa-7361-4325-ad38-22787b887f55"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
LLVMOpenMP_jll = "1d63c593-3942-5779-bab2-d838dc0a180e"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Expand All @@ -33,7 +34,6 @@ ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
DLFP8Types = "f4c16678-4a16-415b-82ef-ed337c5d6c7c"
Float8s = "81dfefd7-55b0-40c6-a251-db853704e186"
GPUCompiler = "61eb1bfa-7361-4325-ad38-22787b887f55"
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
LLVM = "929cbde3-209d-540e-8aea-75f648917ca0"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
Expand Down Expand Up @@ -103,9 +103,9 @@ Scratch = "1.2"
Sockets = "1.10"
SpecialFunctions = "2.4"
Statistics = "1.10"
unzip_jll = "6"
YaoBlocks = "0.13, 0.14"
julia = "1.10"
unzip_jll = "6"

[extras]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
1 change: 0 additions & 1 deletion ext/ReactantCUDAExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,6 @@ end
Reactant.XLA.free_client(client)
client.client = C_NULL
Reactant.deinitialize_dialect()
Reactant.clear_oc_cache()
end
end

Expand Down
14 changes: 0 additions & 14 deletions src/Precompile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,6 @@ function infer_sig(sig)
end
end

function clear_oc_cache()
# Opaque closures capture the worldage of their compilation and thus are not relocatable
# Therefore we explicitly purge all OC's we have created here
for v in oc_capture_vec
if v isa Base.RefValue
p = Ptr{Ptr{Cvoid}}(pointer_from_objref(v))
Base.atomic_pointerset(p, C_NULL, :monotonic)
else
empty!(v)
end
end
end

# Precompilation on 1.10 hits an apparent bug: https://github.com/JuliaLang/julia/issues/56947
function precompilation_supported()
return VERSION >= v"1.11" || VERSION >= v"1.10.8"
Expand Down Expand Up @@ -78,6 +65,5 @@ if Reactant_jll.is_available()
XLA.free_client(client)
client.client = C_NULL
deinitialize_dialect()
clear_oc_cache()
end
end
Loading
Loading