[clang] 92d8ad0 - [HIP] Fix rocm not found on rocm3.5
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 18 05:40:35 PDT 2020
Author: Yaxun (Sam) Liu
Date: 2020-06-18T08:40:09-04:00
New Revision: 92d8ad02e92fed3884169ba5d98056fe4fa5660d
URL: https://github.com/llvm/llvm-project/commit/92d8ad02e92fed3884169ba5d98056fe4fa5660d
DIFF: https://github.com/llvm/llvm-project/commit/92d8ad02e92fed3884169ba5d98056fe4fa5660d.diff
LOG: [HIP] Fix rocm not found on rocm3.5
Currently rocm detector expects device library bitcodes named as *.bc
instead of *.amdgcn.bc. However in rocm3.5 the device library bitcodes
are named as *.amdgcn.bc, which causes rocm3.5 not detected.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D81713
Added:
Modified:
clang/lib/Driver/ToolChains/AMDGPU.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index adb659e3b229..edc52b86e45a 100644
--- a/clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -25,6 +25,7 @@ void RocmInstallationDetector::scanLibDevicePath() {
assert(!LibDevicePath.empty());
const StringRef Suffix(".bc");
+ const StringRef Suffix2(".amdgcn.bc");
std::error_code EC;
for (llvm::vfs::directory_iterator
@@ -36,7 +37,11 @@ void RocmInstallationDetector::scanLibDevicePath() {
if (!FileName.endswith(Suffix))
continue;
- StringRef BaseName = FileName.drop_back(Suffix.size());
+ StringRef BaseName;
+ if (FileName.endswith(Suffix2))
+ BaseName = FileName.drop_back(Suffix2.size());
+ else if (FileName.endswith(Suffix))
+ BaseName = FileName.drop_back(Suffix.size());
if (BaseName == "ocml") {
OCML = FilePath;
More information about the cfe-commits
mailing list