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 CUDA_91, 26 CUDA_92, 27 LATEST = CUDA_92, 28 }; 29 const char *CudaVersionToString(CudaVersion V); 30 31 // No string -> CudaVersion conversion function because there's no canonical 32 // spelling of the various CUDA versions. 33 34 enum class CudaArch { 35 UNKNOWN, 36 SM_20, 37 SM_21, 38 SM_30, 39 SM_32, 40 SM_35, 41 SM_37, 42 SM_50, 43 SM_52, 44 SM_53, 45 SM_60, 46 SM_61, 47 SM_62, 48 SM_70, 49 SM_72, 50 GFX600, 51 GFX601, 52 GFX700, 53 GFX701, 54 GFX702, 55 GFX703, 56 GFX704, 57 GFX801, 58 GFX802, 59 GFX803, 60 GFX810, 61 GFX900, 62 GFX902, 63 LAST, 64 }; 65 const char *CudaArchToString(CudaArch A); 66 67 // The input should have the form "sm_20". 68 CudaArch StringToCudaArch(llvm::StringRef S); 69 70 enum class CudaVirtualArch { 71 UNKNOWN, 72 COMPUTE_20, 73 COMPUTE_30, 74 COMPUTE_32, 75 COMPUTE_35, 76 COMPUTE_37, 77 COMPUTE_50, 78 COMPUTE_52, 79 COMPUTE_53, 80 COMPUTE_60, 81 COMPUTE_61, 82 COMPUTE_62, 83 COMPUTE_70, 84 COMPUTE_72, 85 COMPUTE_AMDGCN, 86 }; 87 const char *CudaVirtualArchToString(CudaVirtualArch A); 88 89 // The input should have the form "compute_20". 90 CudaVirtualArch StringToCudaVirtualArch(llvm::StringRef S); 91 92 /// Get the compute_xx corresponding to an sm_yy. 93 CudaVirtualArch VirtualArchForCudaArch(CudaArch A); 94 95 /// Get the earliest CudaVersion that supports the given CudaArch. 96 CudaVersion MinVersionForCudaArch(CudaArch A); 97 98 /// Get the latest CudaVersion that supports the given CudaArch. 99 CudaVersion MaxVersionForCudaArch(CudaArch A); 100 101 } // namespace clang 102 103 #endif 104