diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -158,7 +158,7 @@ CUDA Language Changes in Clang ------------------------------ -- Clang now supports CUDA versions up to 11.4. +- Clang now supports CUDA versions up to 11.5. - Default GPU architecture has been changed from sm_20 to sm_35. Objective-C Language Changes in Clang diff --git a/clang/include/clang/Basic/BuiltinsNVPTX.def b/clang/include/clang/Basic/BuiltinsNVPTX.def --- a/clang/include/clang/Basic/BuiltinsNVPTX.def +++ b/clang/include/clang/Basic/BuiltinsNVPTX.def @@ -41,7 +41,9 @@ #pragma push_macro("PTX72") #pragma push_macro("PTX73") #pragma push_macro("PTX74") -#define PTX74 "ptx74" +#pragma push_macro("PTX75") +#define PTX75 "ptx75" +#define PTX74 "ptx74|" PTX75 #define PTX73 "ptx73|" PTX74 #define PTX72 "ptx72|" PTX73 #define PTX71 "ptx71|" PTX72 @@ -827,3 +829,4 @@ #pragma pop_macro("PTX72") #pragma pop_macro("PTX73") #pragma pop_macro("PTX74") +#pragma pop_macro("PTX75") diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h --- a/clang/include/clang/Basic/Cuda.h +++ b/clang/include/clang/Basic/Cuda.h @@ -33,9 +33,10 @@ CUDA_112, CUDA_113, CUDA_114, - FULLY_SUPPORTED = CUDA_114, + CUDA_115, + FULLY_SUPPORTED = CUDA_115, PARTIALLY_SUPPORTED = - CUDA_114, // Partially supported. Proceed with a warning. + CUDA_115, // Partially supported. Proceed with a warning. NEW = 10000, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp --- a/clang/lib/Basic/Cuda.cpp +++ b/clang/lib/Basic/Cuda.cpp @@ -40,6 +40,8 @@ return "11.3"; case CudaVersion::CUDA_114: return "11.4"; + case CudaVersion::CUDA_115: + return "11.5"; case CudaVersion::NEW: return ""; } @@ -62,6 +64,7 @@ .Case("11.2", CudaVersion::CUDA_112) .Case("11.3", CudaVersion::CUDA_113) .Case("11.4", CudaVersion::CUDA_114) + .Case("11.5", CudaVersion::CUDA_115) .Default(CudaVersion::UNKNOWN); } @@ -241,6 +244,8 @@ return CudaVersion::CUDA_113; case 114: return CudaVersion::CUDA_114; + case 115: + return CudaVersion::CUDA_115; default: return CudaVersion::UNKNOWN; } diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp --- a/clang/lib/Basic/Targets/NVPTX.cpp +++ b/clang/lib/Basic/Targets/NVPTX.cpp @@ -44,6 +44,7 @@ if (!Feature.startswith("+ptx")) continue; PTXVersion = llvm::StringSwitch(Feature) + .Case("+ptx75", 75) .Case("+ptx74", 74) .Case("+ptx73", 73) .Case("+ptx72", 72) diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -65,6 +65,8 @@ return CudaVersion::CUDA_113; if (raw_version < 11050) return CudaVersion::CUDA_114; + if (raw_version < 11060) + return CudaVersion::CUDA_115; return CudaVersion::NEW; } @@ -707,6 +709,7 @@ case CudaVersion::CUDA_##CUDA_VER: \ PtxFeature = "+ptx" #PTX_VER; \ break; + CASE_CUDA_VERSION(115, 75); CASE_CUDA_VERSION(114, 74); CASE_CUDA_VERSION(113, 73); CASE_CUDA_VERSION(112, 72); diff --git a/llvm/docs/CompileCudaWithLLVM.rst b/llvm/docs/CompileCudaWithLLVM.rst --- a/llvm/docs/CompileCudaWithLLVM.rst +++ b/llvm/docs/CompileCudaWithLLVM.rst @@ -23,8 +23,8 @@ ------------- CUDA is supported since llvm 3.9. Clang currently supports CUDA 7.0 through -10.1. If clang detects a newer CUDA version, it will issue a warning and will -attempt to use detected CUDA SDK it as if it were CUDA-10.1. +11.5. If clang detects a newer CUDA version, it will issue a warning and will +attempt to use detected CUDA SDK it as if it were CUDA 11.5. Before you build CUDA code, you'll need to have installed the CUDA SDK. See `NVIDIA's CUDA installation guide diff --git a/llvm/lib/Target/NVPTX/NVPTX.td b/llvm/lib/Target/NVPTX/NVPTX.td --- a/llvm/lib/Target/NVPTX/NVPTX.td +++ b/llvm/lib/Target/NVPTX/NVPTX.td @@ -93,6 +93,8 @@ "Use PTX version 7.3">; def PTX74 : SubtargetFeature<"ptx74", "PTXVersion", "74", "Use PTX version 7.4">; +def PTX75 : SubtargetFeature<"ptx75", "PTXVersion", "75", + "Use PTX version 7.5">; //===----------------------------------------------------------------------===// // NVPTX supported processors.