I think the problem is not really related to Julia or Julia’s LLVM.
I’m also on Fedora 40, and the issue seems to be related to the various calls to dlopen
and dlclose
when AMDGPU.jl looks for the ROCm HIP libraries installed in the system. In Julia, these two functions are called in particular by Libdl.find_library
and Libdl.dlpath
.
This can be verified with the following C code:
// test_libamdhip.c
#include <dlfcn.h>
int main(int argc, char *argv[])
{
int flags = RTLD_LAZY;
const char *libpath = "/usr/lib64/libamdhip64.so"; // path to HIP library installed from F40 repos
void *lib;
lib = dlopen(libpath, flags);
dlclose(lib);
lib = dlopen(libpath, flags);
dlclose(lib);
return 0;
}
Running this code fails with the same obscure error as above:
gcc -o test_libamdhip test_libamdhip.c && ./test_libamdhip
: CommandLine Error: Option 'disassemble' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
I’m not sure what this error means. Perhaps it’s a packaging issue, and I guess it should be submitted to Fedora.
In any case, I managed to find a workaround allowing to load AMDGPU.jl, by avoiding the calls to Libdl.find_library
and Libdl.dlpath
if the ROCm libraries are found in /usr/lib64
. This requires modifying the find_rocm_library
function by adding this at the beginning:
function find_rocm_library(lib::String, rocm_path::String, ext::String = dlext)
# Try standard library path in Fedora installation
path = joinpath("/usr", "lib64", lib * ".$ext")
isfile(path) && return path
[...]
end