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 13 namespace llvm { 14 class StringRef; 15 } // namespace llvm 16 17 namespace clang { 18 19 enum class CudaVersion { 20 UNKNOWN, 21 CUDA_70, 22 CUDA_75, 23 CUDA_80, 24 CUDA_90, 25 }; 26 const char *CudaVersionToString(CudaVersion V); 27 28 // No string -> CudaVersion conversion function because there's no canonical 29 // spelling of the various CUDA versions. 30 31 enum class CudaArch { 32 UNKNOWN, 33 SM_20, 34 SM_21, 35 SM_30, 36 SM_32, 37 SM_35, 38 SM_37, 39 SM_50, 40 SM_52, 41 SM_53, 42 SM_60, 43 SM_61, 44 SM_62, 45 SM_70, 46 }; 47 const char *CudaArchToString(CudaArch A); 48 49 // The input should have the form "sm_20". 50 CudaArch StringToCudaArch(llvm::StringRef S); 51 52 enum class CudaVirtualArch { 53 UNKNOWN, 54 COMPUTE_20, 55 COMPUTE_30, 56 COMPUTE_32, 57 COMPUTE_35, 58 COMPUTE_37, 59 COMPUTE_50, 60 COMPUTE_52, 61 COMPUTE_53, 62 COMPUTE_60, 63 COMPUTE_61, 64 COMPUTE_62, 65 COMPUTE_70, 66 }; 67 const char *CudaVirtualArchToString(CudaVirtualArch A); 68 69 // The input should have the form "compute_20". 70 CudaVirtualArch StringToCudaVirtualArch(llvm::StringRef S); 71 72 /// Get the compute_xx corresponding to an sm_yy. 73 CudaVirtualArch VirtualArchForCudaArch(CudaArch A); 74 75 /// Get the earliest CudaVersion that supports the given CudaArch. 76 CudaVersion MinVersionForCudaArch(CudaArch A); 77 78 } // namespace clang 79 80 #endif 81