Index: clang/include/clang/Basic/BuiltinsNVPTX.def =================================================================== --- clang/include/clang/Basic/BuiltinsNVPTX.def +++ clang/include/clang/Basic/BuiltinsNVPTX.def @@ -39,7 +39,11 @@ #pragma push_macro("PTX70") #pragma push_macro("PTX71") #pragma push_macro("PTX72") -#define PTX72 "ptx72" +#pragma push_macro("PTX73") +#pragma push_macro("PTX74") +#define PTX74 "ptx74" +#define PTX73 "ptx73|" PTX74 +#define PTX72 "ptx72|" PTX73 #define PTX71 "ptx71|" PTX72 #define PTX70 "ptx70|" PTX71 #define PTX65 "ptx65|" PTX70 @@ -815,3 +819,5 @@ #pragma pop_macro("PTX70") #pragma pop_macro("PTX71") #pragma pop_macro("PTX72") +#pragma pop_macro("PTX73") +#pragma pop_macro("PTX74") Index: clang/include/clang/Basic/Cuda.h =================================================================== --- clang/include/clang/Basic/Cuda.h +++ clang/include/clang/Basic/Cuda.h @@ -31,7 +31,9 @@ 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); Index: clang/lib/Basic/Cuda.cpp =================================================================== --- clang/lib/Basic/Cuda.cpp +++ clang/lib/Basic/Cuda.cpp @@ -36,6 +36,10 @@ 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 @@ .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); } @@ -227,6 +233,10 @@ 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; } Index: clang/lib/Basic/Targets/NVPTX.cpp =================================================================== --- clang/lib/Basic/Targets/NVPTX.cpp +++ clang/lib/Basic/Targets/NVPTX.cpp @@ -45,6 +45,8 @@ if (!Feature.startswith("+ptx")) continue; PTXVersion = llvm::StringSwitch(Feature) + .Case("+ptx74", 74) + .Case("+ptx73", 73) .Case("+ptx72", 72) .Case("+ptx71", 71) .Case("+ptx70", 70) Index: clang/lib/Driver/ToolChains/Cuda.cpp =================================================================== --- clang/lib/Driver/ToolChains/Cuda.cpp +++ clang/lib/Driver/ToolChains/Cuda.cpp @@ -77,6 +77,12 @@ 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; } @@ -131,7 +137,9 @@ SmallVector Candidates; // In decreasing order so we prefer newer versions to older versions. - std::initializer_list Versions = {"8.0", "7.5", "7.0"}; + std::initializer_list Versions = { + "11.4", "11.3", "11.2", "11.1", "10.2", "10.1", "10.0", + "9.2", "9.1", "9.0", "8.0", "7.5", "7.0"}; auto &FS = D.getVFS(); if (Args.hasArg(clang::driver::options::OPT_cuda_path_EQ)) { @@ -720,6 +728,8 @@ 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); Index: llvm/lib/Target/NVPTX/NVPTX.td =================================================================== --- llvm/lib/Target/NVPTX/NVPTX.td +++ llvm/lib/Target/NVPTX/NVPTX.td @@ -89,6 +89,10 @@ "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. Index: llvm/lib/Target/NVPTX/NVPTXInstrInfo.td =================================================================== --- llvm/lib/Target/NVPTX/NVPTXInstrInfo.td +++ llvm/lib/Target/NVPTX/NVPTXInstrInfo.td @@ -147,6 +147,9 @@ def hasPTX65 : Predicate<"Subtarget->getPTXVersion() >= 65">; def hasPTX70 : Predicate<"Subtarget->getPTXVersion() >= 70">; def hasPTX71 : Predicate<"Subtarget->getPTXVersion() >= 71">; +def hasPTX72 : Predicate<"Subtarget->getPTXVersion() >= 72">; +def hasPTX73 : Predicate<"Subtarget->getPTXVersion() >= 73">; +def hasPTX74 : Predicate<"Subtarget->getPTXVersion() >= 74">; def hasSM30 : Predicate<"Subtarget->getSmVersion() >= 30">; def hasSM70 : Predicate<"Subtarget->getSmVersion() >= 70">;