Coverage Report

Created: 2020-10-24 06:27

/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
  LATEST = CUDA_110,
33
  LATEST_SUPPORTED = CUDA_101,
34
};
35
const char *CudaVersionToString(CudaVersion V);
36
// Input is "Major.Minor"
37
CudaVersion CudaStringToVersion(const llvm::Twine &S);
38
39
enum class CudaArch {
40
  UNUSED,
41
  UNKNOWN,
42
  SM_20,
43
  SM_21,
44
  SM_30,
45
  SM_32,
46
  SM_35,
47
  SM_37,
48
  SM_50,
49
  SM_52,
50
  SM_53,
51
  SM_60,
52
  SM_61,
53
  SM_62,
54
  SM_70,
55
  SM_72,
56
  SM_75,
57
  SM_80,
58
  GFX600,
59
  GFX601,
60
  GFX602,
61
  GFX700,
62
  GFX701,
63
  GFX702,
64
  GFX703,
65
  GFX704,
66
  GFX705,
67
  GFX801,
68
  GFX802,
69
  GFX803,
70
  GFX805,
71
  GFX810,
72
  GFX900,
73
  GFX902,
74
  GFX904,
75
  GFX906,
76
  GFX908,
77
  GFX909,
78
  GFX1010,
79
  GFX1011,
80
  GFX1012,
81
  GFX1030,
82
  GFX1031,
83
  GFX1032,
84
  LAST,
85
};
86
87
600
static inline bool IsNVIDIAGpuArch(CudaArch A) {
88
600
  return A >= CudaArch::SM_20 && A < CudaArch::GFX600;
89
600
}
Cuda.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Line
Count
Source
87
600
static inline bool IsNVIDIAGpuArch(CudaArch A) {
88
600
  return A >= CudaArch::SM_20 && A < CudaArch::GFX600;
89
600
}
Unexecuted instantiation: Targets.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: NVPTX.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
Unexecuted instantiation: Driver.cpp:clang::IsNVIDIAGpuArch(clang::CudaArch)
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: 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)
90
91
138
static inline bool IsAMDGpuArch(CudaArch A) {
92
138
  return A >= CudaArch::GFX600 && 
A < CudaArch::LAST0
;
93
138
}
Cuda.cpp:clang::IsAMDGpuArch(clang::CudaArch)
Line
Count
Source
91
138
static inline bool IsAMDGpuArch(CudaArch A) {
92
138
  return A >= CudaArch::GFX600 && 
A < CudaArch::LAST0
;
93
138
}
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: 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)
94
95
const char *CudaArchToString(CudaArch A);
96
const char *CudaArchToVirtualArchString(CudaArch A);
97
98
// The input should have the form "sm_20".
99
CudaArch StringToCudaArch(llvm::StringRef S);
100
101
/// Get the earliest CudaVersion that supports the given CudaArch.
102
CudaVersion MinVersionForCudaArch(CudaArch A);
103
104
/// Get the latest CudaVersion that supports the given CudaArch.
105
CudaVersion MaxVersionForCudaArch(CudaArch A);
106
107
//  Various SDK-dependent features that affect CUDA compilation
108
enum class CudaFeature {
109
  // CUDA-9.2+ uses a new API for launching kernels.
110
  CUDA_USES_NEW_LAUNCH,
111
  // CUDA-10.1+ needs explicit end of GPU binary registration.
112
  CUDA_USES_FATBIN_REGISTER_END,
113
};
114
115
CudaVersion ToCudaVersion(llvm::VersionTuple);
116
bool CudaFeatureEnabled(llvm::VersionTuple, CudaFeature);
117
bool CudaFeatureEnabled(CudaVersion, CudaFeature);
118
119
} // namespace clang
120
121
#endif