[clang] 49d982d - [CUDA] Add support for CUDA-11.4
Artem Belevich via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 23 13:26:44 PDT 2021
Author: Artem Belevich
Date: 2021-08-23T13:24:46-07:00
New Revision: 49d982d8cbbbb6e01b6f8e4f173ed6325beab08b
URL: https://github.com/llvm/llvm-project/commit/49d982d8cbbbb6e01b6f8e4f173ed6325beab08b
DIFF: https://github.com/llvm/llvm-project/commit/49d982d8cbbbb6e01b6f8e4f173ed6325beab08b.diff
LOG: [CUDA] Add support for CUDA-11.4
Differential Revision: https://reviews.llvm.org/D108239
Added:
Modified:
clang/include/clang/Basic/Cuda.h
clang/lib/Basic/Cuda.cpp
clang/lib/Basic/Targets/NVPTX.cpp
clang/lib/Driver/ToolChains/Cuda.cpp
llvm/lib/Target/NVPTX/NVPTX.td
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h
index aa12724cbf0c..1bdb0077b8ef 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 766135bcb376..2e34da7fa867 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 c245753c93f4..0461a91d0add 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<unsigned>(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 37a4da80c03c..0d94ad0e66d7 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 2b0972b8531e..ecbf1e0aa4b4 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.
More information about the cfe-commits
mailing list