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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits