From: Artem Belevich Date: Tue, 17 Aug 2021 19:27:37 +0000 (-0700) Subject: [CUDA] Add support for CUDA-11.4 X-Git-Tag: upstream/15.0.7~33226 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49d982d8cbbbb6e01b6f8e4f173ed6325beab08b;p=platform%2Fupstream%2Fllvm.git [CUDA] Add support for CUDA-11.4 Differential Revision: https://reviews.llvm.org/D108239 --- diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h index aa12724..1bdb007 100644 --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -31,7 +31,9 @@ enum class CudaVersion { CUDA_110, CUDA_111, CUDA_112, - LATEST = CUDA_112, + CUDA_113, + CUDA_114, + LATEST = CUDA_114, LATEST_SUPPORTED = CUDA_101, }; const char *CudaVersionToString(CudaVersion V); diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp index 766135b..2e34da7 100644 --- a/clang/lib/Basic/Cuda.cpp +++ b/clang/lib/Basic/Cuda.cpp @@ -36,6 +36,10 @@ const char *CudaVersionToString(CudaVersion V) { return "11.1"; case CudaVersion::CUDA_112: return "11.2"; + case CudaVersion::CUDA_113: + return "11.3"; + case CudaVersion::CUDA_114: + return "11.4"; } llvm_unreachable("invalid enum"); } @@ -54,6 +58,8 @@ CudaVersion CudaStringToVersion(const llvm::Twine &S) { .Case("11.0", CudaVersion::CUDA_110) .Case("11.1", CudaVersion::CUDA_111) .Case("11.2", CudaVersion::CUDA_112) + .Case("11.3", CudaVersion::CUDA_113) + .Case("11.4", CudaVersion::CUDA_114) .Default(CudaVersion::UNKNOWN); } @@ -194,6 +200,8 @@ CudaVersion MaxVersionForCudaArch(CudaArch A) { case CudaArch::SM_20: case CudaArch::SM_21: return CudaVersion::CUDA_80; + case CudaArch::SM_30: + return CudaVersion::CUDA_110; default: return CudaVersion::LATEST; } @@ -227,6 +235,10 @@ CudaVersion ToCudaVersion(llvm::VersionTuple Version) { return CudaVersion::CUDA_111; case 112: return CudaVersion::CUDA_112; + case 113: + return CudaVersion::CUDA_113; + case 114: + return CudaVersion::CUDA_114; default: return CudaVersion::UNKNOWN; } diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp index c245753..0461a91 100644 --- a/clang/lib/Basic/Targets/NVPTX.cpp +++ b/clang/lib/Basic/Targets/NVPTX.cpp @@ -44,6 +44,8 @@ NVPTXTargetInfo::NVPTXTargetInfo(const llvm::Triple &Triple, if (!Feature.startswith("+ptx")) continue; PTXVersion = llvm::StringSwitch(Feature) + .Case("+ptx74", 74) + .Case("+ptx73", 73) .Case("+ptx72", 72) .Case("+ptx71", 71) .Case("+ptx70", 70) diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp index 37a4da80..0d94ad0 100644 --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -77,6 +77,12 @@ CudaVersion getCudaVersion(uint32_t raw_version) { return CudaVersion::CUDA_110; if (raw_version < 11020) return CudaVersion::CUDA_111; + if (raw_version < 11030) + return CudaVersion::CUDA_112; + if (raw_version < 11040) + return CudaVersion::CUDA_113; + if (raw_version < 11050) + return CudaVersion::CUDA_114; return CudaVersion::LATEST; } @@ -720,6 +726,8 @@ void CudaToolChain::addClangTargetOptions( case CudaVersion::CUDA_##CUDA_VER: \ PtxFeature = "+ptx" #PTX_VER; \ break; + CASE_CUDA_VERSION(114, 74); + CASE_CUDA_VERSION(113, 73); CASE_CUDA_VERSION(112, 72); CASE_CUDA_VERSION(111, 71); CASE_CUDA_VERSION(110, 70); diff --git a/llvm/lib/Target/NVPTX/NVPTX.td b/llvm/lib/Target/NVPTX/NVPTX.td index 2b0972b..ecbf1e0 100644 --- a/llvm/lib/Target/NVPTX/NVPTX.td +++ b/llvm/lib/Target/NVPTX/NVPTX.td @@ -89,6 +89,10 @@ def PTX71 : SubtargetFeature<"ptx71", "PTXVersion", "71", "Use PTX version 7.1">; def PTX72 : SubtargetFeature<"ptx72", "PTXVersion", "72", "Use PTX version 7.2">; +def PTX73 : SubtargetFeature<"ptx73", "PTXVersion", "73", + "Use PTX version 7.3">; +def PTX74 : SubtargetFeature<"ptx74", "PTXVersion", "74", + "Use PTX version 7.4">; //===----------------------------------------------------------------------===// // NVPTX supported processors.