Index: cfe/trunk/lib/Basic/Targets.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets.cpp +++ cfe/trunk/lib/Basic/Targets.cpp @@ -1701,11 +1701,15 @@ 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 @@ 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 @@ .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; Index: cfe/trunk/lib/Driver/Action.cpp =================================================================== --- cfe/trunk/lib/Driver/Action.cpp +++ cfe/trunk/lib/Driver/Action.cpp @@ -66,6 +66,9 @@ .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); } Index: cfe/trunk/lib/Driver/ToolChains.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains.cpp +++ cfe/trunk/lib/Driver/ToolChains.cpp @@ -1715,6 +1715,8 @@ 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 @@ CudaLibDeviceMap["sm_50"] = FilePath; CudaLibDeviceMap["sm_52"] = FilePath; CudaLibDeviceMap["sm_53"] = FilePath; + CudaLibDeviceMap["sm_60"] = FilePath; + CudaLibDeviceMap["sm_61"] = FilePath; + CudaLibDeviceMap["sm_62"] = FilePath; } }