Skip to content

Commit

Permalink
[CUDA] Enable CUDA compilation with CUDA-9.2
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D45827

llvm-svn: 330753
  • Loading branch information
Artem-B committed Apr 24, 2018
1 parent a4bfb3c commit 3cce307
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion clang/include/clang/Basic/Cuda.h
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Basic/Cuda.cpp
Expand Up @@ -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");
}
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/Cuda.cpp
Expand Up @@ -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;
}

Expand Down
7 changes: 6 additions & 1 deletion clang/lib/Headers/__clang_cuda_runtime_wrapper.h
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 3cce307

Please sign in to comment.