Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 623928 Details for
Bug 713530
sys-devel/llvm-10.0.0_rc4 does not build with clang-10.0.0_rc4 when CUDA dev-util/nvidia-cuda-toolkit-10.2 is installed
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
0001-CUDA-Warn-about-unsupported-CUDA-SDK-version-only-if.patch
0001-CUDA-Warn-about-unsupported-CUDA-SDK-version-only-if.patch (text/plain), 5.19 KB, created by
Michał Górny
on 2020-03-21 16:35:46 UTC
(
hide
)
Description:
0001-CUDA-Warn-about-unsupported-CUDA-SDK-version-only-if.patch
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2020-03-21 16:35:46 UTC
Size:
5.19 KB
patch
obsolete
>From 72bfce32a67cf96d3d4c524fbae451f92631a807 Mon Sep 17 00:00:00 2001 >From: Artem Belevich <tra@google.com> >Date: Wed, 11 Mar 2020 14:53:03 -0700 >Subject: [PATCH] [CUDA] Warn about unsupported CUDA SDK version only if it's > used. > >This fixes an issue with clang issuing a warning about unknown CUDA SDK if it's >detected during non-CUDA compilation. > >Differential Revision: https://reviews.llvm.org/D76030 >--- > clang/lib/Driver/ToolChains/Cuda.cpp | 32 +++++++++++++++---------- > clang/lib/Driver/ToolChains/Cuda.h | 6 +++++ > clang/test/Driver/cuda-version-check.cu | 5 ++++ > 3 files changed, 30 insertions(+), 13 deletions(-) > >diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp >index 8a7da4f86b3..50d22a2a8ea 100644 >--- a/clang/lib/Driver/ToolChains/Cuda.cpp >+++ b/clang/lib/Driver/ToolChains/Cuda.cpp >@@ -32,24 +32,28 @@ using namespace llvm::opt; > > // Parses the contents of version.txt in an CUDA installation. It should > // contain one line of the from e.g. "CUDA Version 7.5.2". >-static CudaVersion ParseCudaVersionFile(const Driver &D, llvm::StringRef V) { >+void CudaInstallationDetector::ParseCudaVersionFile(llvm::StringRef V) { >+ Version = CudaVersion::UNKNOWN; > if (!V.startswith("CUDA Version ")) >- return CudaVersion::UNKNOWN; >+ return; > V = V.substr(strlen("CUDA Version ")); > SmallVector<StringRef,4> VersionParts; > V.split(VersionParts, '.'); > if (VersionParts.size() < 2) >- return CudaVersion::UNKNOWN; >- std::string MajorMinor = join_items(".", VersionParts[0], VersionParts[1]); >- CudaVersion Version = CudaStringToVersion(MajorMinor); >+ return; >+ DetectedVersion = join_items(".", VersionParts[0], VersionParts[1]); >+ Version = CudaStringToVersion(DetectedVersion); > if (Version != CudaVersion::UNKNOWN) >- return Version; >+ return; > >- // Issue a warning and assume that the version we've found is compatible with >- // the latest version we support. >- D.Diag(diag::warn_drv_unknown_cuda_version) >- << MajorMinor << CudaVersionToString(CudaVersion::LATEST); >- return CudaVersion::LATEST; >+ Version = CudaVersion::LATEST; >+ DetectedVersionIsNotSupported = true; >+} >+ >+void CudaInstallationDetector::WarnIfUnsupportedVersion() { >+ if (DetectedVersionIsNotSupported) >+ D.Diag(diag::warn_drv_unknown_cuda_version) >+ << DetectedVersion << CudaVersionToString(Version); > } > > CudaInstallationDetector::CudaInstallationDetector( >@@ -147,7 +151,7 @@ CudaInstallationDetector::CudaInstallationDetector( > // version.txt isn't present. > Version = CudaVersion::CUDA_70; > } else { >- Version = ParseCudaVersionFile(D, (*VersionFile)->getBuffer()); >+ ParseCudaVersionFile((*VersionFile)->getBuffer()); > } > > if (Version >= CudaVersion::CUDA_90) { >@@ -565,8 +569,10 @@ CudaToolChain::CudaToolChain(const Driver &D, const llvm::Triple &Triple, > const Action::OffloadKind OK) > : ToolChain(D, Triple, Args), HostTC(HostTC), > CudaInstallation(D, HostTC.getTriple(), Args), OK(OK) { >- if (CudaInstallation.isValid()) >+ if (CudaInstallation.isValid()) { >+ CudaInstallation.WarnIfUnsupportedVersion(); > getProgramPaths().push_back(CudaInstallation.getBinPath()); >+ } > // Lookup binaries into the driver directory, this is used to > // discover the clang-offload-bundler executable. > getProgramPaths().push_back(getDriver().Dir); >diff --git a/clang/lib/Driver/ToolChains/Cuda.h b/clang/lib/Driver/ToolChains/Cuda.h >index 4ee8b6f1fea..d1e066f93df 100644 >--- a/clang/lib/Driver/ToolChains/Cuda.h >+++ b/clang/lib/Driver/ToolChains/Cuda.h >@@ -30,6 +30,8 @@ private: > const Driver &D; > bool IsValid = false; > CudaVersion Version = CudaVersion::UNKNOWN; >+ std::string DetectedVersion; >+ bool DetectedVersionIsNotSupported = false; > std::string InstallPath; > std::string BinPath; > std::string LibPath; >@@ -75,6 +77,10 @@ public: > std::string getLibDeviceFile(StringRef Gpu) const { > return LibDeviceMap.lookup(Gpu); > } >+ void WarnIfUnsupportedVersion(); >+ >+private: >+ void ParseCudaVersionFile(llvm::StringRef V); > }; > > namespace tools { >diff --git a/clang/test/Driver/cuda-version-check.cu b/clang/test/Driver/cuda-version-check.cu >index 5654d4cb7f7..a09b248304f 100644 >--- a/clang/test/Driver/cuda-version-check.cu >+++ b/clang/test/Driver/cuda-version-check.cu >@@ -10,6 +10,10 @@ > // RUN: FileCheck %s --check-prefix=OK > // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \ > // RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION >+// Make sure that we don't warn about CUDA version during C++ compilation. >+// RUN: %clang --target=x86_64-linux -v -### -x c++ --cuda-gpu-arch=sm_60 \ >+// RUN: --cuda-path=%S/Inputs/CUDA-unknown/usr/local/cuda 2>&1 %s | \ >+// RUN: FileCheck %s --check-prefix=UNKNOWN_VERSION_CXX > > // The installation at Inputs/CUDA is CUDA 7.0, which doesn't support sm_60. > // RUN: %clang --target=x86_64-linux -v -### --cuda-gpu-arch=sm_60 --cuda-path=%S/Inputs/CUDA/usr/local/cuda 2>&1 %s | \ >@@ -62,3 +66,4 @@ > // ERR_SM61-NOT: error: GPU arch sm_61 > > // UNKNOWN_VERSION: Unknown CUDA version 999.999. Assuming the latest supported version >+// UNKNOWN_VERSION_CXX-NOT: Unknown CUDA version >-- >2.25.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 713530
:
622854
| 623928