From d2dea65f1239a6cfda6771f3d1c626f687f0a4f5 Mon Sep 17 00:00:00 2001 From: Julian P Samaroo Date: Mon, 30 Sep 2024 13:10:20 -0500 Subject: [PATCH] ROCmDiscovery: Ensure all globals are defined --- src/discovery/discovery.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/discovery/discovery.jl b/src/discovery/discovery.jl index adabc01d0..18efe9fd7 100644 --- a/src/discovery/discovery.jl +++ b/src/discovery/discovery.jl @@ -34,6 +34,15 @@ function get_device_libs(from_artifact::Bool; rocm_path::String) end end +macro _ensure_defined(var) + mod = @__MODULE__ + esc(quote + if !isdefined($mod, $(QuoteNode(Symbol(var)))) + global $(Symbol(var)) = "" + end + end) +end + export lld_artifact, lld_path, libhsaruntime, libdevice_libs, libhip export librocblas, librocsparse, librocsolver, librocalution export librocrand, librocfft, libMIOpen_path @@ -115,6 +124,19 @@ function __init__() Use `ROCM_PATH` env variable to specify ROCm directory. """ exception=(err, catch_backtrace()) + + @_ensure_defined(libhsaruntime) + @_ensure_defined(lld_path) + @_ensure_defined(lld_artifact) + @_ensure_defined(libhip) + @_ensure_defined(libdevice_libs) + @_ensure_defined(librocblas) + @_ensure_defined(librocsparse) + @_ensure_defined(librocsolver) + @_ensure_defined(librocalution) + @_ensure_defined(librocrand) + @_ensure_defined(librocfft) + @_ensure_defined(libMIOpen_path) end end