Coverage Report

Created: 2021-08-24 07:12

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Basic/Cuda.h
Line
Count
Source (jump to first uncovered line)
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 Twine;
15
class VersionTuple;
16
} // namespace llvm
17
18
namespace clang {
19
20
enum class CudaVersion {
21
  UNKNOWN,
22
  CUDA_70,
23
  CUDA_75,
24
  CUDA_80,
25
  CUDA_90,
26
  CUDA_91,
27
  CUDA_92,
28
  CUDA_100,
29
  CUDA_101,
30
  CUDA_102,
31
  CUDA_110,
32
  CUDA_111,
33
  CUDA_112,
34
  CUDA_113,
35
  CUDA_114,
36
  FULLY_SUPPORTED = CUDA_114,
37
  PARTIALLY_SUPPORTED =
38
      CUDA_114, // Partially supported. Proceed with a warning.
39
  NEW = 10000,  // Too new. Issue a warning, but allow using it.
40
};
41
const char *CudaVersionToString(CudaVersion V);
42
// Input is "Major.Minor"
43
CudaVersion CudaStringToVersion(const llvm::Twine &S);
44
45
enum class CudaArch {
46
  UNUSED,
47
  UNKNOWN,
48
  SM_20,
49
  SM_21,
50
  SM_30,
51
  SM_32,
52
  SM_35,
53
  SM_37,
54
  SM_50,
55
  SM_52,
56
  SM_53,
57
  SM_60,
58
  SM_61,
59
  SM_62,
60
  SM_70,
61
  SM_72,
62
  SM_75,
63
  SM_80,
64
  SM_86,
65
  GFX600,
66
  GFX601,
67
  GFX602,
68
  GFX700,
69
  GFX701,
70
  GFX702,
71
  GFX703,
72
  GFX704,
73
  GFX705,
74
  GFX801,
75
  GFX802,
76
  GFX803,
77
  GFX805,
78
  GFX810,
79
  GFX900,
80
  GFX902,
81
  GFX904,
82
  GFX906,
83
  GFX908,
84
  GFX909,
85
  GFX90a,
86
  GFX90c,
87
  GFX1010,
88
  GFX1011,
89
  GFX1012,
90
  GFX1013,
91
  GFX1030,
92
  GFX1031,
93
  GFX1032,
94
  GFX1033,
95
  GFX1034,
96
  GFX1035,
97
  LAST,
98
};
99
100
1.38k
static inline bool IsNVIDIAGpuArch(CudaArch A) {
101
1.38k
  return A >= CudaArch::SM_20 && A < CudaArch::GFX600;
102
1.38k
}
Cuda.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Line
Count
Source
100
1.17k
static inline bool IsNVIDIAGpuArch(CudaArch A) {
101
1.17k
  return A >= CudaArch::SM_20 && A < CudaArch::GFX600;
102
1.17k
}
Unexecuted instantiation: Targets.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: NVPTX.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Driver.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Line
Count
Source
100
214
static inline bool IsNVIDIAGpuArch(CudaArch A) {
101
214
  return A >= CudaArch::SM_20 && A < CudaArch::GFX600;
102
214
}
Unexecuted instantiation: ToolChain.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Ananas.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: AMDGPU.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: AMDGPUOpenMP.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: AVR.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: BareMetal.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Clang.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: CloudABI.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: CommonArgs.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Contiki.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: CrossWindows.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Darwin.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: DragonFly.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: FreeBSD.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Fuchsia.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Gnu.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Haiku.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: HIP.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Hexagon.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Hurd.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Linux.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: MipsLinux.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: MinGW.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Minix.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: MSP430.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: MSVC.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Myriad.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: NaCl.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: NetBSD.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: OpenBSD.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: PS4CPU.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: RISCVToolchain.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Solaris.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: VEToolchain.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: WebAssembly.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: PPCLinux.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: SemaCUDA.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: CGCUDANV.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: CGOpenMPRuntimeAMDGCN.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: CGOpenMPRuntimeGPU.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: CGOpenMPRuntimeNVPTX.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
103
104
246
static inline bool IsAMDGpuArch(CudaArch A) {
105
246
  return A >= CudaArch::GFX600 && 
A < CudaArch::LAST0
;
106
246
}
Cuda.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Line
Count
Source
104
246
static inline bool IsAMDGpuArch(CudaArch A) {
105
246
  return A >= CudaArch::GFX600 && 
A < CudaArch::LAST0
;
106
246
}
Unexecuted instantiation: Targets.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: NVPTX.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Driver.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: ToolChain.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Ananas.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: AMDGPU.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: AMDGPUOpenMP.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: AVR.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: BareMetal.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Clang.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: CloudABI.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: CommonArgs.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Contiki.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: CrossWindows.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Darwin.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: DragonFly.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: FreeBSD.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Fuchsia.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Gnu.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Haiku.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: HIP.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Hexagon.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Hurd.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Linux.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: MipsLinux.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: MinGW.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Minix.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: MSP430.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: MSVC.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Myriad.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: NaCl.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: NetBSD.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: OpenBSD.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: PS4CPU.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: RISCVToolchain.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: Solaris.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: VEToolchain.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: WebAssembly.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: PPCLinux.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: SemaCUDA.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: CGCUDANV.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: CGOpenMPRuntimeAMDGCN.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: CGOpenMPRuntimeGPU.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Unexecuted instantiation: CGOpenMPRuntimeNVPTX.cpp:clang::IsAMDGpuArch(clang::CudaArch)
107
108
const char *CudaArchToString(CudaArch A);
109
const char *CudaArchToVirtualArchString(CudaArch A);
110
111
// The input should have the form "sm_20".
112
CudaArch StringToCudaArch(llvm::StringRef S);
113
114
/// Get the earliest CudaVersion that supports the given CudaArch.
115
CudaVersion MinVersionForCudaArch(CudaArch A);
116
117
/// Get the latest CudaVersion that supports the given CudaArch.
118
CudaVersion MaxVersionForCudaArch(CudaArch A);
119
120
//  Various SDK-dependent features that affect CUDA compilation
121
enum class CudaFeature {
122
  // CUDA-9.2+ uses a new API for launching kernels.
123
  CUDA_USES_NEW_LAUNCH,
124
  // CUDA-10.1+ needs explicit end of GPU binary registration.
125
  CUDA_USES_FATBIN_REGISTER_END,
126
};
127
128
CudaVersion ToCudaVersion(llvm::VersionTuple);
129
bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature);
130
bool CudaFeatureEnabled(CudaVersion, CudaFeature);
131
132
} // namespace clang
133
134
#endif