LLVM 23.0.0git
AMDGPUTargetParser.cpp
Go to the documentation of this file.
1//===-- AMDGPUTargetParser - Parser for AMDGPU features ---------*- 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// This file implements a target parser to recognise AMDGPU hardware features.
10//
11//===----------------------------------------------------------------------===//
12
18
19using namespace llvm;
20using namespace AMDGPU;
21
23 StringRef ArchName = getArchNameAMDGCN(AK);
25 ArchName.ends_with("-generic") &&
26 "Generic AMDGCN arch not classified correctly!");
28 // Return the part before the first '-', e.g. "gfx9-4-generic" -> "gfx9".
29 return ArchName.take_front(ArchName.find('-'));
30 }
31 return ArchName.empty() ? "" : ArchName.drop_back(2);
32}
33
35 switch (AK) {
36#define AMDGCN_GPU(NAME, ENUM, ISAVERSION, FEATURES) \
37 case ENUM: \
38 return NAME;
39#include "llvm/TargetParser/AMDGPUTargetParser.def"
40 default:
41 return "";
42 }
43}
44
46 switch (AK) {
47#define R600_GPU(NAME, ENUM, FEATURES) \
48 case ENUM: \
49 return NAME;
50#include "llvm/TargetParser/AMDGPUTargetParser.def"
51 default:
52 return "";
53 }
54}
55
58#define AMDGCN_GPU(NAME, ENUM, ISAVERSION, FEATURES) .Case(NAME, ENUM)
59#define AMDGCN_GPU_ALIAS(NAME, ENUM) .Case(NAME, ENUM)
60#include "llvm/TargetParser/AMDGPUTargetParser.def"
62}
63
66#define R600_GPU(NAME, ENUM, FEATURES) .Case(NAME, ENUM)
67#define R600_GPU_ALIAS(NAME, ENUM) .Case(NAME, ENUM)
68#include "llvm/TargetParser/AMDGPUTargetParser.def"
70}
71
73 switch (AK) {
74#define AMDGCN_GPU(NAME, ENUM, ISAVERSION, FEATURES) \
75 case ENUM: \
76 return FEATURES;
77#include "llvm/TargetParser/AMDGPUTargetParser.def"
78 default:
79 return FEATURE_NONE;
80 }
81}
82
84 switch (AK) {
85#define R600_GPU(NAME, ENUM, FEATURES) \
86 case ENUM: \
87 return FEATURES;
88#include "llvm/TargetParser/AMDGPUTargetParser.def"
89 default:
90 return FEATURE_NONE;
91 }
92}
93
95 // XXX: Should this only report unique canonical names?
96 Values.append({
97#define AMDGCN_GPU(NAME, ENUM, ISAVERSION, FEATURES) NAME,
98#define AMDGCN_GPU_ALIAS(NAME, ENUM) NAME,
99#include "llvm/TargetParser/AMDGPUTargetParser.def"
100 });
101}
102
104 Values.append({
105#define R600_GPU(NAME, ENUM, FEATURES) NAME,
106#define R600_GPU_ALIAS(NAME, ENUM) NAME,
107#include "llvm/TargetParser/AMDGPUTargetParser.def"
108 });
109}
110
113 if (AK == AMDGPU::GPUKind::GK_NONE) {
114 if (GPU == "generic-hsa")
115 return {7, 0, 0};
116 if (GPU == "generic")
117 return {6, 0, 0};
118 return {0, 0, 0};
119 }
120
121 switch (AK) {
122#define MAKE_ISAVERSION(A, B, C) {A, B, C}
123#define AMDGCN_GPU(NAME, ENUM, ISAVERSION, FEATURES) \
124 case ENUM: \
125 return MAKE_ISAVERSION ISAVERSION;
126#include "llvm/TargetParser/AMDGPUTargetParser.def"
127#undef MAKE_ISAVERSION
128 default:
129 return {0, 0, 0};
130 }
131}
132
134 assert(T.isAMDGPU());
135 auto ProcKind = T.isAMDGCN() ? parseArchAMDGCN(Arch) : parseArchR600(Arch);
136 if (ProcKind == GK_NONE)
137 return StringRef();
138
139 return T.isAMDGCN() ? getArchNameAMDGCN(ProcKind) : getArchNameR600(ProcKind);
140}
141
142static std::pair<FeatureError, StringRef>
144 const StringMap<bool> &DefaultFeatures,
145 StringMap<bool> &Features) {
146 const bool IsNullGPU = GPU.empty();
147 const bool TargetHasWave32 = DefaultFeatures.count("wavefrontsize32");
148 const bool TargetHasWave64 = DefaultFeatures.count("wavefrontsize64");
149
150 auto Wave32Itr = Features.find("wavefrontsize32");
151 auto Wave64Itr = Features.find("wavefrontsize64");
152 const bool EnableWave32 =
153 Wave32Itr != Features.end() && Wave32Itr->getValue();
154 const bool EnableWave64 =
155 Wave64Itr != Features.end() && Wave64Itr->getValue();
156 const bool DisableWave32 =
157 Wave32Itr != Features.end() && !Wave32Itr->getValue();
158 const bool DisableWave64 =
159 Wave64Itr != Features.end() && !Wave64Itr->getValue();
160
161 if (EnableWave32 && EnableWave64)
163 "'+wavefrontsize32' and '+wavefrontsize64' are mutually exclusive"};
164 if (DisableWave32 && DisableWave64)
166 "'-wavefrontsize32' and '-wavefrontsize64' are mutually exclusive"};
167
168 if (!IsNullGPU) {
169 if (TargetHasWave64) {
170 if (EnableWave32)
171 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "+wavefrontsize32"};
172 if (DisableWave64)
173 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "-wavefrontsize64"};
174 }
175
176 if (TargetHasWave32) {
177 if (EnableWave64)
178 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "+wavefrontsize64"};
179 if (DisableWave32)
180 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "-wavefrontsize32"};
181 }
182 }
183
184 // Don't assume any wavesize with an unknown subtarget.
185 // Default to wave32 if target supports both.
186 if (!IsNullGPU && !EnableWave32 && !EnableWave64 && !TargetHasWave32 &&
187 !TargetHasWave64)
188 Features.insert(std::make_pair("wavefrontsize32", true));
189
190 for (const auto &Entry : DefaultFeatures) {
191 if (!Features.count(Entry.getKey()))
192 Features[Entry.getKey()] = Entry.getValue();
193 }
194
195 return {NO_ERROR, StringRef()};
196}
197
198/// Fills Features map with default values for given target GPU.
199/// \p Features contains overriding target features and this function returns
200/// default target features with entries overridden by \p Features.
201static void fillAMDGCNFeatureMap(StringRef GPU, const Triple &T,
202 StringMap<bool> &Features) {
204 switch (Kind) {
205 case GK_GFX1251:
206 case GK_GFX1250:
207 Features["swmmac-gfx1200-insts"] = true;
208 Features["swmmac-gfx1250-insts"] = true;
209 [[fallthrough]];
210 case GK_GFX1310:
211 Features["cube-insts"] = true;
212 Features["cvt-pknorm-vop2-insts"] = true;
213 Features["lerp-inst"] = true;
214 Features["qsad-insts"] = true;
215 Features["sad-insts"] = true;
216 Features["msad-insts"] = true;
217 Features["mqsad-pk-insts"] = true;
218 Features["mqsad-insts"] = true;
219 [[fallthrough]];
220 case GK_GFX12_5_GENERIC:
221 Features["ci-insts"] = true;
222 Features["dot7-insts"] = true;
223 Features["dot8-insts"] = true;
224 Features["dl-insts"] = true;
225 Features["16-bit-insts"] = true;
226 Features["dpp"] = true;
227 Features["gfx8-insts"] = true;
228 Features["gfx9-insts"] = true;
229 Features["gfx10-insts"] = true;
230 Features["gfx10-3-insts"] = true;
231 Features["gfx11-insts"] = true;
232 Features["gfx12-insts"] = true;
233 Features["gfx1250-insts"] = true;
234 Features["bitop3-insts"] = true;
235 Features["prng-inst"] = true;
236 Features["tanh-insts"] = true;
237 Features["tensor-cvt-lut-insts"] = true;
238 Features["transpose-load-f4f6-insts"] = true;
239 Features["bf16-trans-insts"] = true;
240 Features["bf16-cvt-insts"] = true;
241 Features["bf16-pk-insts"] = true;
242 Features["fp8-conversion-insts"] = true;
243 Features["fp8e5m3-insts"] = true;
244 Features["permlane16-swap"] = true;
245 Features["ashr-pk-insts"] = true;
246 Features["add-min-max-insts"] = true;
247 Features["pk-add-min-max-insts"] = true;
248 Features["atomic-buffer-pk-add-bf16-inst"] = true;
249 Features["vmem-pref-insts"] = true;
250 Features["atomic-fadd-rtn-insts"] = true;
251 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
252 Features["atomic-flat-pk-add-16-insts"] = true;
253 Features["atomic-global-pk-add-bf16-inst"] = true;
254 Features["atomic-ds-pk-add-16-insts"] = true;
255 Features["setprio-inc-wg-inst"] = true;
256 Features["s-wakeup-barrier-inst"] = true;
257 Features["atomic-fmin-fmax-global-f32"] = true;
258 Features["atomic-fmin-fmax-global-f64"] = true;
259 Features["wavefrontsize32"] = true;
260 Features["clusters"] = true;
261 Features["mcast-load-insts"] = true;
262 break;
263 case GK_GFX1201:
264 case GK_GFX1200:
265 case GK_GFX12_GENERIC:
266 Features["ci-insts"] = true;
267 Features["dot7-insts"] = true;
268 Features["dot8-insts"] = true;
269 Features["dot9-insts"] = true;
270 Features["dot10-insts"] = true;
271 Features["dot11-insts"] = true;
272 Features["dot12-insts"] = true;
273 Features["dl-insts"] = true;
274 Features["atomic-ds-pk-add-16-insts"] = true;
275 Features["atomic-flat-pk-add-16-insts"] = true;
276 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
277 Features["atomic-buffer-pk-add-bf16-inst"] = true;
278 Features["atomic-global-pk-add-bf16-inst"] = true;
279 Features["16-bit-insts"] = true;
280 Features["dpp"] = true;
281 Features["gfx8-insts"] = true;
282 Features["gfx9-insts"] = true;
283 Features["gfx10-insts"] = true;
284 Features["gfx10-3-insts"] = true;
285 Features["gfx11-insts"] = true;
286 Features["gfx12-insts"] = true;
287 Features["atomic-fadd-rtn-insts"] = true;
288 Features["image-insts"] = true;
289 Features["cube-insts"] = true;
290 Features["lerp-inst"] = true;
291 Features["sad-insts"] = true;
292 Features["qsad-insts"] = true;
293 Features["msad-insts"] = true;
294 Features["mqsad-pk-insts"] = true;
295 Features["mqsad-insts"] = true;
296 Features["cvt-pknorm-vop2-insts"] = true;
297 Features["fp8-conversion-insts"] = true;
298 Features["wmma-128b-insts"] = true;
299 Features["swmmac-gfx1200-insts"] = true;
300 Features["atomic-fmin-fmax-global-f32"] = true;
301 break;
302 case GK_GFX1170:
303 case GK_GFX1171:
304 case GK_GFX1172:
305 Features["ci-insts"] = true;
306 Features["dot7-insts"] = true;
307 Features["dot8-insts"] = true;
308 Features["dot9-insts"] = true;
309 Features["dot10-insts"] = true;
310 Features["dot12-insts"] = true;
311 Features["dl-insts"] = true;
312 Features["16-bit-insts"] = true;
313 Features["dpp"] = true;
314 Features["gfx8-insts"] = true;
315 Features["gfx9-insts"] = true;
316 Features["gfx10-insts"] = true;
317 Features["gfx10-3-insts"] = true;
318 Features["gfx11-insts"] = true;
319 Features["atomic-fadd-rtn-insts"] = true;
320 Features["image-insts"] = true;
321 Features["cube-insts"] = true;
322 Features["lerp-inst"] = true;
323 Features["sad-insts"] = true;
324 Features["qsad-insts"] = true;
325 Features["msad-insts"] = true;
326 Features["mqsad-pk-insts"] = true;
327 Features["mqsad-insts"] = true;
328 Features["cvt-pknorm-vop2-insts"] = true;
329 Features["gws"] = true;
330 Features["dot11-insts"] = true;
331 Features["fp8-conversion-insts"] = true;
332 Features["wmma-128b-insts"] = true;
333 Features["swmmac-gfx1200-insts"] = true;
334 Features["atomic-fmin-fmax-global-f32"] = true;
335 break;
336 case GK_GFX1153:
337 case GK_GFX1152:
338 case GK_GFX1151:
339 case GK_GFX1150:
340 case GK_GFX1103:
341 case GK_GFX1102:
342 case GK_GFX1101:
343 case GK_GFX1100:
344 case GK_GFX11_GENERIC:
345 Features["ci-insts"] = true;
346 Features["dot5-insts"] = true;
347 Features["dot7-insts"] = true;
348 Features["dot8-insts"] = true;
349 Features["dot9-insts"] = true;
350 Features["dot10-insts"] = true;
351 Features["dot12-insts"] = true;
352 Features["dl-insts"] = true;
353 Features["16-bit-insts"] = true;
354 Features["dpp"] = true;
355 Features["gfx8-insts"] = true;
356 Features["gfx9-insts"] = true;
357 Features["gfx10-insts"] = true;
358 Features["gfx10-3-insts"] = true;
359 Features["gfx11-insts"] = true;
360 Features["atomic-fadd-rtn-insts"] = true;
361 Features["image-insts"] = true;
362 Features["cube-insts"] = true;
363 Features["lerp-inst"] = true;
364 Features["sad-insts"] = true;
365 Features["qsad-insts"] = true;
366 Features["msad-insts"] = true;
367 Features["mqsad-pk-insts"] = true;
368 Features["mqsad-insts"] = true;
369 Features["cvt-pknorm-vop2-insts"] = true;
370 Features["gws"] = true;
371 Features["wmma-256b-insts"] = true;
372 Features["atomic-fmin-fmax-global-f32"] = true;
373 break;
374 case GK_GFX1036:
375 case GK_GFX1035:
376 case GK_GFX1034:
377 case GK_GFX1033:
378 case GK_GFX1032:
379 case GK_GFX1031:
380 case GK_GFX1030:
381 case GK_GFX10_3_GENERIC:
382 Features["ci-insts"] = true;
383 Features["dot1-insts"] = true;
384 Features["dot2-insts"] = true;
385 Features["dot5-insts"] = true;
386 Features["dot6-insts"] = true;
387 Features["dot7-insts"] = true;
388 Features["dot10-insts"] = true;
389 Features["dl-insts"] = true;
390 Features["16-bit-insts"] = true;
391 Features["dpp"] = true;
392 Features["gfx8-insts"] = true;
393 Features["gfx9-insts"] = true;
394 Features["gfx10-insts"] = true;
395 Features["gfx10-3-insts"] = true;
396 Features["image-insts"] = true;
397 Features["s-memrealtime"] = true;
398 Features["s-memtime-inst"] = true;
399 Features["gws"] = true;
400 Features["vmem-to-lds-load-insts"] = true;
401 Features["atomic-fmin-fmax-global-f32"] = true;
402 Features["atomic-fmin-fmax-global-f64"] = true;
403 Features["cube-insts"] = true;
404 Features["lerp-inst"] = true;
405 Features["sad-insts"] = true;
406 Features["qsad-insts"] = true;
407 Features["msad-insts"] = true;
408 Features["mqsad-pk-insts"] = true;
409 Features["mqsad-insts"] = true;
410 Features["cvt-pknorm-vop2-insts"] = true;
411 break;
412 case GK_GFX1012:
413 case GK_GFX1011:
414 Features["dot1-insts"] = true;
415 Features["dot2-insts"] = true;
416 Features["dot5-insts"] = true;
417 Features["dot6-insts"] = true;
418 Features["dot7-insts"] = true;
419 Features["dot10-insts"] = true;
420 [[fallthrough]];
421 case GK_GFX1013:
422 case GK_GFX1010:
423 case GK_GFX10_1_GENERIC:
424 Features["dl-insts"] = true;
425 Features["ci-insts"] = true;
426 Features["16-bit-insts"] = true;
427 Features["dpp"] = true;
428 Features["gfx8-insts"] = true;
429 Features["gfx9-insts"] = true;
430 Features["gfx10-insts"] = true;
431 Features["image-insts"] = true;
432 Features["s-memrealtime"] = true;
433 Features["s-memtime-inst"] = true;
434 Features["gws"] = true;
435 Features["vmem-to-lds-load-insts"] = true;
436 Features["atomic-fmin-fmax-global-f32"] = true;
437 Features["atomic-fmin-fmax-global-f64"] = true;
438 Features["cube-insts"] = true;
439 Features["lerp-inst"] = true;
440 Features["sad-insts"] = true;
441 Features["qsad-insts"] = true;
442 Features["msad-insts"] = true;
443 Features["mqsad-pk-insts"] = true;
444 Features["mqsad-insts"] = true;
445 Features["cvt-pknorm-vop2-insts"] = true;
446 break;
447 case GK_GFX950:
448 Features["bitop3-insts"] = true;
449 Features["fp6bf6-cvt-scale-insts"] = true;
450 Features["fp4-cvt-scale-insts"] = true;
451 Features["bf8-cvt-scale-insts"] = true;
452 Features["fp8-cvt-scale-insts"] = true;
453 Features["f16bf16-to-fp6bf6-cvt-scale-insts"] = true;
454 Features["f32-to-f16bf16-cvt-sr-insts"] = true;
455 Features["prng-inst"] = true;
456 Features["permlane16-swap"] = true;
457 Features["permlane32-swap"] = true;
458 Features["ashr-pk-insts"] = true;
459 Features["dot12-insts"] = true;
460 Features["dot13-insts"] = true;
461 Features["atomic-buffer-pk-add-bf16-inst"] = true;
462 Features["gfx950-insts"] = true;
463 [[fallthrough]];
464 case GK_GFX942:
465 Features["fp8-insts"] = true;
466 Features["fp8-conversion-insts"] = true;
467 if (Kind != GK_GFX950)
468 Features["xf32-insts"] = true;
469 [[fallthrough]];
470 case GK_GFX9_4_GENERIC:
471 Features["gfx940-insts"] = true;
472 Features["atomic-ds-pk-add-16-insts"] = true;
473 Features["atomic-flat-pk-add-16-insts"] = true;
474 Features["atomic-global-pk-add-bf16-inst"] = true;
475 Features["gfx90a-insts"] = true;
476 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
477 Features["atomic-fadd-rtn-insts"] = true;
478 Features["dot3-insts"] = true;
479 Features["dot4-insts"] = true;
480 Features["dot5-insts"] = true;
481 Features["dot6-insts"] = true;
482 Features["mai-insts"] = true;
483 Features["dl-insts"] = true;
484 Features["dot1-insts"] = true;
485 Features["dot2-insts"] = true;
486 Features["dot7-insts"] = true;
487 Features["dot10-insts"] = true;
488 Features["gfx9-insts"] = true;
489 Features["gfx8-insts"] = true;
490 Features["16-bit-insts"] = true;
491 Features["dpp"] = true;
492 Features["s-memrealtime"] = true;
493 Features["ci-insts"] = true;
494 Features["s-memtime-inst"] = true;
495 Features["gws"] = true;
496 Features["vmem-to-lds-load-insts"] = true;
497 Features["atomic-fmin-fmax-global-f64"] = true;
498 Features["wavefrontsize64"] = true;
499 Features["cube-insts"] = true;
500 Features["lerp-inst"] = true;
501 Features["sad-insts"] = true;
502 Features["qsad-insts"] = true;
503 Features["msad-insts"] = true;
504 Features["mqsad-pk-insts"] = true;
505 Features["mqsad-insts"] = true;
506 Features["cvt-pknorm-vop2-insts"] = true;
507 break;
508 case GK_GFX90A:
509 Features["gfx90a-insts"] = true;
510 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
511 Features["atomic-fadd-rtn-insts"] = true;
512 Features["atomic-fmin-fmax-global-f64"] = true;
513 [[fallthrough]];
514 case GK_GFX908:
515 Features["dot3-insts"] = true;
516 Features["dot4-insts"] = true;
517 Features["dot5-insts"] = true;
518 Features["dot6-insts"] = true;
519 Features["mai-insts"] = true;
520 [[fallthrough]];
521 case GK_GFX906:
522 Features["dl-insts"] = true;
523 Features["dot1-insts"] = true;
524 Features["dot2-insts"] = true;
525 Features["dot7-insts"] = true;
526 Features["dot10-insts"] = true;
527 [[fallthrough]];
528 case GK_GFX90C:
529 case GK_GFX909:
530 case GK_GFX904:
531 case GK_GFX902:
532 case GK_GFX900:
533 case GK_GFX9_GENERIC:
534 Features["gfx9-insts"] = true;
535 Features["vmem-to-lds-load-insts"] = true;
536 [[fallthrough]];
537 case GK_GFX810:
538 case GK_GFX805:
539 case GK_GFX803:
540 case GK_GFX802:
541 case GK_GFX801:
542 Features["gfx8-insts"] = true;
543 Features["16-bit-insts"] = true;
544 Features["dpp"] = true;
545 Features["s-memrealtime"] = true;
546 Features["ci-insts"] = true;
547 Features["image-insts"] = true;
548 Features["s-memtime-inst"] = true;
549 Features["gws"] = true;
550 Features["wavefrontsize64"] = true;
551 Features["cube-insts"] = true;
552 Features["lerp-inst"] = true;
553 Features["sad-insts"] = true;
554 Features["qsad-insts"] = true;
555 Features["msad-insts"] = true;
556 Features["mqsad-pk-insts"] = true;
557 Features["mqsad-insts"] = true;
558 Features["cvt-pknorm-vop2-insts"] = true;
559 break;
560 case GK_GFX705:
561 case GK_GFX704:
562 case GK_GFX703:
563 case GK_GFX702:
564 case GK_GFX701:
565 case GK_GFX700:
566 Features["ci-insts"] = true;
567 Features["cube-insts"] = true;
568 Features["lerp-inst"] = true;
569 Features["sad-insts"] = true;
570 Features["qsad-insts"] = true;
571 Features["msad-insts"] = true;
572 Features["mqsad-pk-insts"] = true;
573 Features["mqsad-insts"] = true;
574 Features["cvt-pknorm-vop2-insts"] = true;
575 Features["image-insts"] = true;
576 Features["s-memtime-inst"] = true;
577 Features["gws"] = true;
578 Features["atomic-fmin-fmax-global-f32"] = true;
579 Features["atomic-fmin-fmax-global-f64"] = true;
580 Features["wavefrontsize64"] = true;
581 break;
582 case GK_GFX602:
583 case GK_GFX601:
584 case GK_GFX600:
585 Features["image-insts"] = true;
586 Features["s-memtime-inst"] = true;
587 Features["gws"] = true;
588 Features["atomic-fmin-fmax-global-f32"] = true;
589 Features["atomic-fmin-fmax-global-f64"] = true;
590 Features["wavefrontsize64"] = true;
591 Features["cube-insts"] = true;
592 Features["lerp-inst"] = true;
593 Features["sad-insts"] = true;
594 Features["msad-insts"] = true;
595 Features["mqsad-pk-insts"] = true;
596 Features["cvt-pknorm-vop2-insts"] = true;
597 break;
598 case GK_NONE:
599 break;
600 default:
601 llvm_unreachable("Unhandled GPU!");
602 }
603}
604
605/// Fills Features map with default values for given target GPU.
606/// \p Features contains overriding target features and this function returns
607/// default target features with entries overridden by \p Features.
608std::pair<FeatureError, StringRef>
610 StringMap<bool> &Features) {
611 // XXX - What does the member GPU mean if device name string passed here?
612 if (T.isSPIRV() && T.getOS() == Triple::OSType::AMDHSA) {
613 // AMDGCN SPIRV must support the union of all AMDGCN features.
616
617 static const Triple AMDGCN("amdgcn-amd-amdhsa");
618 StringMap<bool> Tmp;
619 for (auto &&GPU : GPUs) {
620 fillAMDGCNFeatureMap(GPU, AMDGCN, Tmp);
621 for (auto &&[F, B] : Tmp)
622 Features[F] = B;
623 }
624 Features["wavefrontsize32"] = true;
625 Features["wavefrontsize64"] = true;
626 } else if (T.isAMDGCN()) {
627 StringMap<bool> DefaultFeatures;
628 fillAMDGCNFeatureMap(GPU, T, DefaultFeatures);
629 return insertWaveSizeFeature(GPU, T, DefaultFeatures, Features);
630 } else {
631 if (GPU.empty())
632 GPU = "r600";
633
634 switch (llvm::AMDGPU::parseArchR600(GPU)) {
635 case GK_CAYMAN:
636 case GK_CYPRESS:
637 case GK_RV770:
638 case GK_RV670:
639 // TODO: Add fp64 when implemented.
640 break;
641 case GK_TURKS:
642 case GK_CAICOS:
643 case GK_BARTS:
644 case GK_SUMO:
645 case GK_REDWOOD:
646 case GK_JUNIPER:
647 case GK_CEDAR:
648 case GK_RV730:
649 case GK_RV710:
650 case GK_RS880:
651 case GK_R630:
652 case GK_R600:
653 break;
654 default:
655 llvm_unreachable("Unhandled GPU!");
656 }
657 }
658 return {NO_ERROR, StringRef()};
659}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void fillAMDGCNFeatureMap(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Fills Features map with default values for given target GPU.
static std::pair< FeatureError, StringRef > insertWaveSizeFeature(StringRef GPU, const Triple &T, const StringMap< bool > &DefaultFeatures, StringMap< bool > &Features)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define F(x, y, z)
Definition MD5.cpp:54
#define T
This file defines the SmallVector class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:133
iterator end()
Definition StringMap.h:224
iterator find(StringRef Key)
Definition StringMap.h:237
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition StringMap.h:285
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition StringMap.h:321
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
constexpr bool empty() const
Check if the string is empty.
Definition StringRef.h:141
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
Definition StringRef.h:600
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
Definition StringRef.h:290
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
Definition StringRef.h:270
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Definition StringRef.h:636
A switch()-like statement whose cases are string literals.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI StringRef getArchNameR600(GPUKind AK)
GPUKind
GPU kinds supported by the AMDGPU target.
LLVM_ABI StringRef getCanonicalArchName(const Triple &T, StringRef Arch)
LLVM_ABI void fillValidArchListR600(SmallVectorImpl< StringRef > &Values)
LLVM_ABI StringRef getArchFamilyNameAMDGCN(GPUKind AK)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
LLVM_ABI void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values)
LLVM_ABI GPUKind parseArchAMDGCN(StringRef CPU)
LLVM_ABI std::pair< FeatureError, StringRef > fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Fills Features map with default values for given target GPU.
LLVM_ABI StringRef getArchNameAMDGCN(GPUKind AK)
LLVM_ABI unsigned getArchAttrAMDGCN(GPUKind AK)
LLVM_ABI unsigned getArchAttrR600(GPUKind AK)
LLVM_ABI GPUKind parseArchR600(StringRef CPU)
This is an optimization pass for GlobalISel generic memory operations.
Instruction set architecture version.