clang  10.0.0svn
Cuda.h
Go to the documentation of this file.
1 //===--- Cuda.h - Utilities for compiling CUDA code ------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_BASIC_CUDA_H
10 #define LLVM_CLANG_BASIC_CUDA_H
11 
12 namespace llvm {
13 class StringRef;
14 class VersionTuple;
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  CUDA_100,
28  CUDA_101,
29  LATEST = CUDA_101,
30 };
31 const char *CudaVersionToString(CudaVersion V);
32 // Input is "Major.Minor"
33 CudaVersion CudaStringToVersion(llvm::StringRef S);
34 
35 enum class CudaArch {
36  UNKNOWN,
37  SM_20,
38  SM_21,
39  SM_30,
40  SM_32,
41  SM_35,
42  SM_37,
43  SM_50,
44  SM_52,
45  SM_53,
46  SM_60,
47  SM_61,
48  SM_62,
49  SM_70,
50  SM_72,
51  SM_75,
52  GFX600,
53  GFX601,
54  GFX700,
55  GFX701,
56  GFX702,
57  GFX703,
58  GFX704,
59  GFX801,
60  GFX802,
61  GFX803,
62  GFX810,
63  GFX900,
64  GFX902,
65  GFX904,
66  GFX906,
67  GFX908,
68  GFX909,
69  GFX1010,
70  GFX1011,
71  GFX1012,
72  LAST,
73 };
74 const char *CudaArchToString(CudaArch A);
75 
76 // The input should have the form "sm_20".
77 CudaArch StringToCudaArch(llvm::StringRef S);
78 
79 enum class CudaVirtualArch {
80  UNKNOWN,
81  COMPUTE_20,
82  COMPUTE_30,
83  COMPUTE_32,
84  COMPUTE_35,
85  COMPUTE_37,
86  COMPUTE_50,
87  COMPUTE_52,
88  COMPUTE_53,
89  COMPUTE_60,
90  COMPUTE_61,
91  COMPUTE_62,
92  COMPUTE_70,
93  COMPUTE_72,
94  COMPUTE_75,
96 };
98 
99 // The input should have the form "compute_20".
100 CudaVirtualArch StringToCudaVirtualArch(llvm::StringRef S);
101 
102 /// Get the compute_xx corresponding to an sm_yy.
104 
105 /// Get the earliest CudaVersion that supports the given CudaArch.
107 
108 /// Get the latest CudaVersion that supports the given CudaArch.
110 
111 // Various SDK-dependent features that affect CUDA compilation
112 enum class CudaFeature {
113  // CUDA-9.2+ uses a new API for launching kernels.
115  // CUDA-10.1+ needs explicit end of GPU binary registration.
117 };
118 
119 bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature);
121 
122 } // namespace clang
123 
124 #endif
CudaVirtualArch StringToCudaVirtualArch(llvm::StringRef S)
Definition: Cuda.cpp:204
CudaArch
Definition: Cuda.h:35
const char * CudaArchToString(CudaArch A)
Definition: Cuda.cpp:46
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
CudaArch StringToCudaArch(llvm::StringRef S)
Definition: Cuda.cpp:126
const char * CudaVersionToString(CudaVersion V)
Definition: Cuda.cpp:10
#define V(N, I)
Definition: ASTContext.h:2921
const char * CudaVirtualArchToString(CudaVirtualArch A)
Definition: Cuda.cpp:166
CudaFeature
Definition: Cuda.h:112
CudaVersion MaxVersionForCudaArch(CudaArch A)
Get the latest CudaVersion that supports the given CudaArch.
Definition: Cuda.cpp:335
CudaVersion
Definition: Cuda.h:19
CudaVirtualArch
Definition: Cuda.h:79
CudaVersion MinVersionForCudaArch(CudaArch A)
Get the earliest CudaVersion that supports the given CudaArch.
Definition: Cuda.cpp:284
Dataflow Directional Tag Classes.
CudaVersion CudaStringToVersion(llvm::StringRef S)
Definition: Cuda.cpp:34
CudaVirtualArch VirtualArchForCudaArch(CudaArch A)
Get the compute_xx corresponding to an sm_yy.
Definition: Cuda.cpp:224
bool CudaFeatureEnabled(CudaVersion, CudaFeature)
Definition: Cuda.cpp:392