Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
clang 20.0.0git
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
12namespace llvm {
13class StringRef;
14class Twine;
15class VersionTuple;
16} // namespace llvm
17
18namespace clang {
19
20enum class CudaVersion {
21 UNKNOWN,
22 CUDA_70,
23 CUDA_75,
24 CUDA_80,
25 CUDA_90,
26 CUDA_91,
27 CUDA_92,
52 CUDA_129, // Partially supported. Proceed with a warning.
53 NEW = 10000, // Too new. Issue a warning, but allow using it.
54};
56// Input is "Major.Minor"
57CudaVersion CudaStringToVersion(const llvm::Twine &S);
58
59enum class OffloadArch {
60 UNUSED,
61 UNKNOWN,
62 // TODO: Deprecate and remove GPU architectures older than sm_52.
63 SM_20,
64 SM_21,
65 SM_30,
66 // This has a name conflict with sys/mac.h on AIX, rename it as a workaround.
67 SM_32_,
68 SM_35,
69 SM_37,
70 SM_50,
71 SM_52,
72 SM_53,
73 SM_60,
74 SM_61,
75 SM_62,
76 SM_70,
77 SM_72,
78 SM_75,
79 SM_80,
80 SM_86,
81 SM_87,
82 SM_89,
83 SM_90,
84 SM_90a,
85 SM_100,
86 SM_100a,
87 GFX600,
88 GFX601,
89 GFX602,
90 GFX700,
91 GFX701,
92 GFX702,
93 GFX703,
94 GFX704,
95 GFX705,
96 GFX801,
97 GFX802,
98 GFX803,
99 GFX805,
100 GFX810,
102 GFX900,
103 GFX902,
104 GFX904,
105 GFX906,
106 GFX908,
107 GFX909,
108 GFX90a,
109 GFX90c,
111 GFX940,
112 GFX941,
113 GFX942,
114 GFX950,
116 GFX1010,
117 GFX1011,
118 GFX1012,
119 GFX1013,
121 GFX1030,
122 GFX1031,
123 GFX1032,
124 GFX1033,
125 GFX1034,
126 GFX1035,
127 GFX1036,
129 GFX1100,
130 GFX1101,
131 GFX1102,
132 GFX1103,
133 GFX1150,
134 GFX1151,
135 GFX1152,
136 GFX1153,
138 GFX1200,
139 GFX1201,
141 Generic, // A processor model named 'generic' if the target backend defines a
142 // public one.
143 LAST,
144
147};
148
150 Device,
151 Global,
152 Host,
155};
156
157static inline bool IsNVIDIAOffloadArch(OffloadArch A) {
158 return A >= OffloadArch::SM_20 && A < OffloadArch::GFX600;
159}
160
161static inline bool IsAMDOffloadArch(OffloadArch A) {
162 // Generic processor model is for testing only.
163 return A >= OffloadArch::GFX600 && A < OffloadArch::Generic;
164}
165
166const char *OffloadArchToString(OffloadArch A);
168
169// The input should have the form "sm_20".
170OffloadArch StringToOffloadArch(llvm::StringRef S);
171
172/// Get the earliest CudaVersion that supports the given OffloadArch.
174
175/// Get the latest CudaVersion that supports the given OffloadArch.
177
178// Various SDK-dependent features that affect CUDA compilation
179enum class CudaFeature {
180 // CUDA-9.2+ uses a new API for launching kernels.
182 // CUDA-10.1+ needs explicit end of GPU binary registration.
184};
185
186CudaVersion ToCudaVersion(llvm::VersionTuple);
187bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature);
189
190} // namespace clang
191
192#endif
#define V(N, I)
Definition: ASTContext.h:3460
The JSON file list parser is used to communicate input to InstallAPI.
CudaVersion MaxVersionForOffloadArch(OffloadArch A)
Get the latest CudaVersion that supports the given OffloadArch.
Definition: Cuda.cpp:241
CUDAFunctionTarget
Definition: Cuda.h:149
static bool IsAMDOffloadArch(OffloadArch A)
Definition: Cuda.h:161
OffloadArch
Definition: Cuda.h:59
CudaVersion ToCudaVersion(llvm::VersionTuple)
Definition: Cuda.cpp:71
CudaVersion CudaStringToVersion(const llvm::Twine &S)
Definition: Cuda.cpp:63
bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature)
Definition: Cuda.cpp:263
static bool IsNVIDIAOffloadArch(OffloadArch A)
Definition: Cuda.h:157
const char * CudaVersionToString(CudaVersion V)
Definition: Cuda.cpp:55
const char * OffloadArchToVirtualArchString(OffloadArch A)
Definition: Cuda.cpp:175
OffloadArch StringToOffloadArch(llvm::StringRef S)
Definition: Cuda.cpp:184
CudaVersion
Definition: Cuda.h:20
CudaFeature
Definition: Cuda.h:179
const char * OffloadArchToString(OffloadArch A)
Definition: Cuda.cpp:166
CudaVersion MinVersionForOffloadArch(OffloadArch A)
Get the earliest CudaVersion that supports the given OffloadArch.
Definition: Cuda.cpp:193
@ Generic
not a target-specific vector type
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30