r274680 - [CUDA] Add support for CUDA 8 and sm_60-62.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 6 14:21:14 PDT 2016
Author: jlebar
Date: Wed Jul 6 16:21:14 2016
New Revision: 274680
URL: http://llvm.org/viewvc/llvm-project?rev=274680&view=rev
Log:
[CUDA] Add support for CUDA 8 and sm_60-62.
Summary: Also add sm_32, which was missing.
Reviewers: tra
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D21778
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/Action.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=274680&r1=274679&r2=274680&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Jul 6 16:21:14 2016
@@ -1701,11 +1701,15 @@ class NVPTXTargetInfo : public TargetInf
GK_SM20,
GK_SM21,
GK_SM30,
+ GK_SM32,
GK_SM35,
GK_SM37,
GK_SM50,
GK_SM52,
GK_SM53,
+ GK_SM60,
+ GK_SM61,
+ GK_SM62,
} GPU;
public:
@@ -1787,35 +1791,37 @@ public:
Builder.defineMacro("__NVPTX__");
if (Opts.CUDAIsDevice) {
// Set __CUDA_ARCH__ for the GPU specified.
- std::string CUDAArchCode;
- switch (GPU) {
- case GK_SM20:
- CUDAArchCode = "200";
- break;
- case GK_SM21:
- CUDAArchCode = "210";
- break;
- case GK_SM30:
- CUDAArchCode = "300";
- break;
- case GK_SM35:
- CUDAArchCode = "350";
- break;
- case GK_SM37:
- CUDAArchCode = "370";
- break;
- case GK_SM50:
- CUDAArchCode = "500";
- break;
- case GK_SM52:
- CUDAArchCode = "520";
- break;
- case GK_SM53:
- CUDAArchCode = "530";
- break;
- default:
- llvm_unreachable("Unhandled target CPU");
- }
+ std::string CUDAArchCode = [this] {
+ switch (GPU) {
+ case GK_NONE:
+ assert(false && "No GPU arch when compiling CUDA device code.");
+ return "";
+ case GK_SM20:
+ return "200";
+ case GK_SM21:
+ return "210";
+ case GK_SM30:
+ return "300";
+ case GK_SM32:
+ return "320";
+ case GK_SM35:
+ return "350";
+ case GK_SM37:
+ return "370";
+ case GK_SM50:
+ return "500";
+ case GK_SM52:
+ return "520";
+ case GK_SM53:
+ return "530";
+ case GK_SM60:
+ return "600";
+ case GK_SM61:
+ return "610";
+ case GK_SM62:
+ return "620";
+ }
+ }();
Builder.defineMacro("__CUDA_ARCH__", CUDAArchCode);
}
}
@@ -1860,11 +1866,15 @@ public:
.Case("sm_20", GK_SM20)
.Case("sm_21", GK_SM21)
.Case("sm_30", GK_SM30)
+ .Case("sm_32", GK_SM32)
.Case("sm_35", GK_SM35)
.Case("sm_37", GK_SM37)
.Case("sm_50", GK_SM50)
.Case("sm_52", GK_SM52)
.Case("sm_53", GK_SM53)
+ .Case("sm_60", GK_SM60)
+ .Case("sm_61", GK_SM61)
+ .Case("sm_62", GK_SM62)
.Default(GK_NONE);
return GPU != GK_NONE;
Modified: cfe/trunk/lib/Driver/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=274680&r1=274679&r2=274680&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Wed Jul 6 16:21:14 2016
@@ -66,6 +66,9 @@ static const char* GpuArchToComputeName(
.Case("sm_50", "compute_50")
.Case("sm_52", "compute_52")
.Case("sm_53", "compute_53")
+ .Case("sm_60", "compute_60")
+ .Case("sm_61", "compute_61")
+ .Case("sm_62", "compute_62")
.Default(nullptr);
}
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=274680&r1=274679&r2=274680&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jul 6 16:21:14 2016
@@ -1715,6 +1715,8 @@ void Generic_GCC::CudaInstallationDetect
Args.getLastArgValue(options::OPT_cuda_path_EQ));
else {
CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda");
+ // FIXME: Uncomment this once we can compile the cuda 8 headers.
+ // CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-8.0");
CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.5");
CudaPathCandidates.push_back(D.SysRoot + "/usr/local/cuda-7.0");
}
@@ -1761,6 +1763,9 @@ void Generic_GCC::CudaInstallationDetect
CudaLibDeviceMap["sm_50"] = FilePath;
CudaLibDeviceMap["sm_52"] = FilePath;
CudaLibDeviceMap["sm_53"] = FilePath;
+ CudaLibDeviceMap["sm_60"] = FilePath;
+ CudaLibDeviceMap["sm_61"] = FilePath;
+ CudaLibDeviceMap["sm_62"] = FilePath;
}
}
More information about the cfe-commits
mailing list