diff --git a/debian/changelog b/debian/changelog index 1a4c0843..daadbcc8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -14,7 +14,8 @@ llvm-toolchain-15 (1:15.0.7-2) UNRELEASED; urgency=medium * Don't run chrpath for libclang on powerpc and powerpcspe [ Cordell Bloor ] - * Backport support for HIP in /usr + * Backport support for HIP in /usr and add Debian paths + for rocm-device-libs to search list (Closes: #1031808) -- Sylvestre Ledru Sun, 15 Jan 2023 10:54:41 +0100 diff --git a/debian/patches/amdgpu-bitcode-multiarch.patch b/debian/patches/amdgpu-bitcode-multiarch.patch new file mode 100644 index 00000000..b2a1cd06 --- /dev/null +++ b/debian/patches/amdgpu-bitcode-multiarch.patch @@ -0,0 +1,60 @@ +From efa9394d72968e0c84c2c9283476c70807f60b80 Mon Sep 17 00:00:00 2001 +From: Cordell Bloor +Date: Wed, 8 Mar 2023 02:57:51 -0700 +Subject: [PATCH] Search for the bitcode libraries in a multiarch directory + +The Debian path for the rocm-device-libs is +/usr/lib/$(DEB_HOST_MULTIARCH)/amdgcn/bitcode + +Forwarded: not-needed +--- + clang/lib/Driver/ToolChains/AMDGPU.cpp | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp +index f20b28a66c67..2e8e56b39ff6 100644 +--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp ++++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp +@@ -14,9 +14,11 @@ + #include "clang/Driver/DriverDiagnostic.h" + #include "clang/Driver/InputInfo.h" + #include "clang/Driver/Options.h" ++#include "llvm/ADT/Triple.h" + #include "llvm/Option/ArgList.h" + #include "llvm/Support/Error.h" + #include "llvm/Support/FileUtilities.h" ++#include "llvm/Support/Host.h" + #include "llvm/Support/LineIterator.h" + #include "llvm/Support/Path.h" + #include "llvm/Support/VirtualFileSystem.h" +@@ -422,16 +424,21 @@ void RocmInstallationDetector::detectDeviceLibrary() { + // The possible structures are: + // - ${ROCM_ROOT}/amdgcn/bitcode/* + // - ${ROCM_ROOT}/lib/* ++ // - ${ROCM_ROOT}/lib//amdgcn/bitcode/* + // - ${ROCM_ROOT}/lib/bitcode/* +- // so try to detect these layouts. +- static constexpr std::array SubDirsList[] = { +- {"amdgcn", "bitcode"}, +- {"lib", ""}, +- {"lib", "bitcode"}, ++ // so try to detect these layouts. Note that bitcode is associated with the ++ // compiler that built it (not the target architecture). ++ llvm::Triple HostTriple(llvm::sys::getProcessTriple()); ++ std::string Multiarch = Twine(HostTriple.getArchName() + "-linux-gnu").str(); ++ static const std::array SubDirsList[] = { ++ {"amdgcn", "bitcode", "", ""}, ++ {"lib", "", "", ""}, ++ {"lib", Multiarch, "amdgcn", "bitcode"}, ++ {"lib", "bitcode", "", ""}, + }; + + // Make a path by appending sub-directories to InstallPath. +- auto MakePath = [&](const llvm::ArrayRef &SubDirs) { ++ auto MakePath = [&](const llvm::ArrayRef &SubDirs) { + auto Path = CandidatePath; + for (auto SubDir : SubDirs) + llvm::sys::path::append(Path, SubDir); +-- +2.39.2 + diff --git a/debian/patches/series b/debian/patches/series index 7961162d..52067f5f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -161,3 +161,4 @@ link-grpc.diff amdgpu-nonlinux.patch amdgpu-usr-search-paths.patch +amdgpu-bitcode-multiarch.patch