comparison clang/lib/Basic/Cuda.cpp @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 0572611fdcc8
children 5f17cb93ff66
comparison
equal deleted inserted replaced
220:42394fc6a535 221:79ff65ed7e25
30 return "10.1"; 30 return "10.1";
31 case CudaVersion::CUDA_102: 31 case CudaVersion::CUDA_102:
32 return "10.2"; 32 return "10.2";
33 case CudaVersion::CUDA_110: 33 case CudaVersion::CUDA_110:
34 return "11.0"; 34 return "11.0";
35 case CudaVersion::CUDA_111:
36 return "11.1";
37 case CudaVersion::CUDA_112:
38 return "11.2";
35 } 39 }
36 llvm_unreachable("invalid enum"); 40 llvm_unreachable("invalid enum");
37 } 41 }
38 42
39 CudaVersion CudaStringToVersion(const llvm::Twine &S) { 43 CudaVersion CudaStringToVersion(const llvm::Twine &S) {
46 .Case("9.2", CudaVersion::CUDA_92) 50 .Case("9.2", CudaVersion::CUDA_92)
47 .Case("10.0", CudaVersion::CUDA_100) 51 .Case("10.0", CudaVersion::CUDA_100)
48 .Case("10.1", CudaVersion::CUDA_101) 52 .Case("10.1", CudaVersion::CUDA_101)
49 .Case("10.2", CudaVersion::CUDA_102) 53 .Case("10.2", CudaVersion::CUDA_102)
50 .Case("11.0", CudaVersion::CUDA_110) 54 .Case("11.0", CudaVersion::CUDA_110)
55 .Case("11.1", CudaVersion::CUDA_111)
56 .Case("11.2", CudaVersion::CUDA_112)
51 .Default(CudaVersion::UNKNOWN); 57 .Default(CudaVersion::UNKNOWN);
52 } 58 }
53 59
60 namespace {
54 struct CudaArchToStringMap { 61 struct CudaArchToStringMap {
55 CudaArch arch; 62 CudaArch arch;
56 const char *arch_name; 63 const char *arch_name;
57 const char *virtual_arch_name; 64 const char *virtual_arch_name;
58 }; 65 };
66 } // namespace
59 67
60 #define SM2(sm, ca) \ 68 #define SM2(sm, ca) \
61 { CudaArch::SM_##sm, "sm_" #sm, ca } 69 { CudaArch::SM_##sm, "sm_" #sm, ca }
62 #define SM(sm) SM2(sm, "compute_" #sm) 70 #define SM(sm) SM2(sm, "compute_" #sm)
63 #define GFX(gpu) \ 71 #define GFX(gpu) \
64 { CudaArch::GFX##gpu, "gfx" #gpu, "compute_amdgcn" } 72 { CudaArch::GFX##gpu, "gfx" #gpu, "compute_amdgcn" }
65 CudaArchToStringMap arch_names[] = { 73 static const CudaArchToStringMap arch_names[] = {
66 // clang-format off 74 // clang-format off
75 {CudaArch::UNUSED, "", ""},
67 SM2(20, "compute_20"), SM2(21, "compute_20"), // Fermi 76 SM2(20, "compute_20"), SM2(21, "compute_20"), // Fermi
68 SM(30), SM(32), SM(35), SM(37), // Kepler 77 SM(30), SM(32), SM(35), SM(37), // Kepler
69 SM(50), SM(52), SM(53), // Maxwell 78 SM(50), SM(52), SM(53), // Maxwell
70 SM(60), SM(61), SM(62), // Pascal 79 SM(60), SM(61), SM(62), // Pascal
71 SM(70), SM(72), // Volta 80 SM(70), SM(72), // Volta
72 SM(75), // Turing 81 SM(75), // Turing
73 SM(80), // Ampere 82 SM(80), SM(86), // Ampere
74 GFX(600), // tahiti 83 GFX(600), // gfx600
75 GFX(601), // pitcairn, verde, oland,hainan 84 GFX(601), // gfx601
76 GFX(700), // kaveri 85 GFX(602), // gfx602
77 GFX(701), // hawaii 86 GFX(700), // gfx700
78 GFX(702), // 290,290x,R390,R390x 87 GFX(701), // gfx701
79 GFX(703), // kabini mullins 88 GFX(702), // gfx702
80 GFX(704), // bonaire 89 GFX(703), // gfx703
81 GFX(801), // carrizo 90 GFX(704), // gfx704
82 GFX(802), // tonga,iceland 91 GFX(705), // gfx705
83 GFX(803), // fiji,polaris10 92 GFX(801), // gfx801
84 GFX(810), // stoney 93 GFX(802), // gfx802
85 GFX(900), // vega, instinct 94 GFX(803), // gfx803
86 GFX(902), GFX(904), GFX(906), GFX(908), GFX(909), 95 GFX(805), // gfx805
87 GFX(1010), GFX(1011), GFX(1012), 96 GFX(810), // gfx810
97 GFX(900), // gfx900
98 GFX(902), // gfx902
99 GFX(904), // gfx903
100 GFX(906), // gfx906
101 GFX(908), // gfx908
102 GFX(909), // gfx909
103 GFX(90a), // gfx90a
104 GFX(90c), // gfx90c
105 GFX(1010), // gfx1010
106 GFX(1011), // gfx1011
107 GFX(1012), // gfx1012
108 GFX(1030), // gfx1030
109 GFX(1031), // gfx1031
110 GFX(1032), // gfx1032
111 GFX(1033), // gfx1033
112 GFX(1034), // gfx1034
88 // clang-format on 113 // clang-format on
89 }; 114 };
90 #undef SM 115 #undef SM
91 #undef SM2 116 #undef SM2
92 #undef GFX 117 #undef GFX
147 return CudaVersion::CUDA_91; 172 return CudaVersion::CUDA_91;
148 case CudaArch::SM_75: 173 case CudaArch::SM_75:
149 return CudaVersion::CUDA_100; 174 return CudaVersion::CUDA_100;
150 case CudaArch::SM_80: 175 case CudaArch::SM_80:
151 return CudaVersion::CUDA_110; 176 return CudaVersion::CUDA_110;
177 case CudaArch::SM_86:
178 return CudaVersion::CUDA_111;
152 default: 179 default:
153 llvm_unreachable("invalid enum"); 180 llvm_unreachable("invalid enum");
154 } 181 }
155 } 182 }
156 183
192 return CudaVersion::CUDA_101; 219 return CudaVersion::CUDA_101;
193 case 102: 220 case 102:
194 return CudaVersion::CUDA_102; 221 return CudaVersion::CUDA_102;
195 case 110: 222 case 110:
196 return CudaVersion::CUDA_110; 223 return CudaVersion::CUDA_110;
224 case 111:
225 return CudaVersion::CUDA_111;
226 case 112:
227 return CudaVersion::CUDA_112;
197 default: 228 default:
198 return CudaVersion::UNKNOWN; 229 return CudaVersion::UNKNOWN;
199 } 230 }
200 } 231 }
201 232