[CUDA] Add support for CUDA-11.4

Differential Revision: https://reviews.llvm.org/D108239
This commit is contained in:
Artem Belevich 2021-08-17 12:27:37 -07:00
parent 0060fffc82
commit 49d982d8cb
5 changed files with 29 additions and 1 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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)

View File

@ -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);

View File

@ -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.