https://bugzilla.redhat.com/show_bug.cgi?id=2209759
--- Comment #14 from Tom Rix trix@redhat.com --- with rocm-device-libs rpm installed My simple test is touch t.hip clang t.hip error: cannot find ROCm device library; provide its path via '--rocm-path' or '--rocm-device-lib-path', or pass '-nogpulib' to build without ROCm device library
To work correctly is necessary to do clang --rocm-device-lib-path=/usr/lib64/amdgcn/bitcode t.hip
From this print out clang -print-rocm-search-dirs ROCm installation search path: /usr ROCm installation search path: /usr ROCm installation search path: /usr/lib64/clang/16 ROCm installation search path: /opt/rocm ROCm installation search path: /usr/local ROCm installation search path: /usr
Because we could have different clangs installed, the best search path is /usr/lib64/clang/16
From comments in clang/lib/Driver/ToolChains/AMDGPU.cpp, detectDeviceLibrary() // Find device libraries in <LLVM_DIR>/lib/clang/<ver>/lib/amdgcn/bitcode LibDevicePath = D.ResourceDir; llvm::sys::path::append(LibDevicePath, CLANG_INSTALL_LIBDIR_BASENAME, "amdgcn", "bitcode"); HasDeviceLibrary = CheckDeviceLib(LibDevicePath, true); if (HasDeviceLibrary) return;
simply copying the directory there does not work, so i suspect this will need to with 2 changes.
1. rocm-device-libs follow what libomp does and use Requires: clang-resource-filesystem%{?isa} = %{version} to install amdgcn/bitcode into clang's resource dir lib/
2. clang have a default to look there