1//===--- Cuda.h - Utilities for compiling CUDA code ------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef LLVM_CLANG_BASIC_CUDA_H 11#define LLVM_CLANG_BASIC_CUDA_H 12 13namespace llvm { 14class StringRef; 15} // namespace llvm 16 17namespace clang { 18 19enum class CudaVersion { 20 UNKNOWN, 21 CUDA_70, 22 CUDA_75, 23 CUDA_80, 24}; 25const char *CudaVersionToString(CudaVersion V); 26 27// No string -> CudaVersion conversion function because there's no canonical 28// spelling of the various CUDA versions. 29 30enum class CudaArch { 31 UNKNOWN, 32 SM_20, 33 SM_21, 34 SM_30, 35 SM_32, 36 SM_35, 37 SM_37, 38 SM_50, 39 SM_52, 40 SM_53, 41 SM_60, 42 SM_61, 43 SM_62, 44}; 45const char *CudaArchToString(CudaArch A); 46 47// The input should have the form "sm_20". 48CudaArch StringToCudaArch(llvm::StringRef S); 49 50enum class CudaVirtualArch { 51 UNKNOWN, 52 COMPUTE_20, 53 COMPUTE_30, 54 COMPUTE_32, 55 COMPUTE_35, 56 COMPUTE_37, 57 COMPUTE_50, 58 COMPUTE_52, 59 COMPUTE_53, 60 COMPUTE_60, 61 COMPUTE_61, 62 COMPUTE_62, 63}; 64const char *CudaVirtualArchToString(CudaVirtualArch A); 65 66// The input should have the form "compute_20". 67CudaVirtualArch StringToCudaVirtualArch(llvm::StringRef S); 68 69/// Get the compute_xx corresponding to an sm_yy. 70CudaVirtualArch VirtualArchForCudaArch(CudaArch A); 71 72/// Get the earliest CudaVersion that supports the given CudaArch. 73CudaVersion MinVersionForCudaArch(CudaArch A); 74 75} // namespace clang 76 77#endif 78