r330753 - [CUDA] Enable CUDA compilation with CUDA-9.2

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 24 11:23:19 PDT 2018


Author: tra
Date: Tue Apr 24 11:23:19 2018
New Revision: 330753

URL: http://llvm.org/viewvc/llvm-project?rev=330753&view=rev
Log:
[CUDA] Enable CUDA compilation with CUDA-9.2

Differential Revision: https://reviews.llvm.org/D45827

Modified:
    cfe/trunk/include/clang/Basic/Cuda.h
    cfe/trunk/lib/Basic/Cuda.cpp
    cfe/trunk/lib/Driver/ToolChains/Cuda.cpp
    cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h

Modified: cfe/trunk/include/clang/Basic/Cuda.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Cuda.h?rev=330753&r1=330752&r2=330753&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Cuda.h (original)
+++ cfe/trunk/include/clang/Basic/Cuda.h Tue Apr 24 11:23:19 2018
@@ -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);
 

Modified: cfe/trunk/lib/Basic/Cuda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Cuda.cpp?rev=330753&r1=330752&r2=330753&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Cuda.cpp (original)
+++ cfe/trunk/lib/Basic/Cuda.cpp Tue Apr 24 11:23:19 2018
@@ -20,6 +20,8 @@ const char *CudaVersionToString(CudaVers
     return "9.0";
   case CudaVersion::CUDA_91:
     return "9.1";
+  case CudaVersion::CUDA_92:
+    return "9.2";
   }
   llvm_unreachable("invalid enum");
 }

Modified: cfe/trunk/lib/Driver/ToolChains/Cuda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Cuda.cpp?rev=330753&r1=330752&r2=330753&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Cuda.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Cuda.cpp Tue Apr 24 11:23:19 2018
@@ -57,6 +57,8 @@ static CudaVersion ParseCudaVersionFile(
     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;
 }
 

Modified: cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h?rev=330753&r1=330752&r2=330753&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h (original)
+++ cfe/trunk/lib/Headers/__clang_cuda_runtime_wrapper.h Tue Apr 24 11:23:19 2018
@@ -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
 #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"




More information about the cfe-commits mailing list