[CUDA] Enable CUDA compilation with CUDA-9.2
authorArtem Belevich <tra@google.com>
Tue, 24 Apr 2018 18:23:19 +0000 (18:23 +0000)
committerArtem Belevich <tra@google.com>
Tue, 24 Apr 2018 18:23:19 +0000 (18:23 +0000)
Differential Revision: https://reviews.llvm.org/D45827

llvm-svn: 330753

clang/include/clang/Basic/Cuda.h
clang/lib/Basic/Cuda.cpp
clang/lib/Driver/ToolChains/Cuda.cpp
clang/lib/Headers/__clang_cuda_runtime_wrapper.h

index 9981cf9..24159e1 100644 (file)
@@ -23,7 +23,8 @@ enum class CudaVersion {
   CUDA_80,
   CUDA_90,
   CUDA_91,
-  LATEST = CUDA_91,
+  CUDA_92,
+  LATEST = CUDA_92,
 };
 const char *CudaVersionToString(CudaVersion V);
 
index 970c060..dc7e61c 100644 (file)
@@ -20,6 +20,8 @@ const char *CudaVersionToString(CudaVersion V) {
     return "9.0";
   case CudaVersion::CUDA_91:
     return "9.1";
+  case CudaVersion::CUDA_92:
+    return "9.2";
   }
   llvm_unreachable("invalid enum");
 }
index fdd62fe..3978cb2 100644 (file)
@@ -57,6 +57,8 @@ static CudaVersion ParseCudaVersionFile(llvm::StringRef V) {
     return CudaVersion::CUDA_90;
   if (Major == 9 && Minor == 1)
     return CudaVersion::CUDA_91;
+  if (Major == 9 && Minor == 2)
+    return CudaVersion::CUDA_92;
   return CudaVersion::UNKNOWN;
 }
 
index a5eb4bd..ed6cefb 100644 (file)
@@ -62,7 +62,7 @@
 #include "cuda.h"
 #if !defined(CUDA_VERSION)
 #error "cuda.h did not define CUDA_VERSION"
-#elif CUDA_VERSION < 7000 || CUDA_VERSION > 9010
+#elif CUDA_VERSION < 7000 || CUDA_VERSION > 9020
 #error "Unsupported CUDA version!"
 #endif
 
@@ -199,6 +199,11 @@ inline __host__ double __signbitd(double x) {
 #endif
 
 #if CUDA_VERSION >= 9000
+// CUDA-9.2 needs host-side memcpy for some host functions in
+// device_functions.hpp
+#if CUDA_VERSION >= 9020
+#include <string.h>
+#endif
 #include "crt/math_functions.hpp"
 #else
 #include "math_functions.hpp"