[PATCH] D81713: [HIP] Fix rocm not found on rocm3.5
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 11 21:25:02 PDT 2020
yaxunl created this revision.
yaxunl added reviewers: tra, arsenm.
Herald added subscribers: kerbowa, nhaehnle, wdng, jvesely.
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. Tested works with rocm3.5.
https://reviews.llvm.org/D81713
Files:
clang/lib/Driver/ToolChains/AMDGPU.cpp
Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -25,6 +25,7 @@
assert(!LibDevicePath.empty());
const StringRef Suffix(".bc");
+ const StringRef Suffix2(".amdgcn.bc");
std::error_code EC;
for (llvm::sys::fs::directory_iterator LI(LibDevicePath, EC), LE;
@@ -34,7 +35,11 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81713.270298.patch
Type: text/x-patch
Size: 828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200612/7546c2ca/attachment-0001.bin>
More information about the cfe-commits
mailing list