LLVM 24.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
14#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/Twine.h"
21
22using namespace llvm;
23using namespace AMDGPU;
24
26 StringRef ArchName = getArchNameAMDGCN(AK);
28 ArchName.ends_with("-generic") &&
29 "Generic AMDGCN arch not classified correctly!");
31 // Return the part before the first '-', e.g. "gfx9-4-generic" -> "gfx9".
32 return ArchName.take_front(ArchName.find('-'));
33 }
34 return ArchName.empty() ? "" : ArchName.drop_back(2);
35}
36
38 switch (AK) {
39#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
40 case ENUM: \
41 return SUBARCH;
42#include "llvm/TargetParser/AMDGPUTargetParser.def"
43 default:
45 }
46}
47
50 switch (SubArch) {
51#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
52 case SUBARCH: \
53 return ENUM;
54#include "llvm/TargetParser/AMDGPUTargetParser.def"
55 default:
56 return GK_NONE;
57 }
58}
59
60static const Triple::SubArchType
62 1] = {
65
70
74
76
81
83
86
90
95
101
104
107
110
112
118
120 if (A == B || A == Triple::NoSubArch || B == Triple::NoSubArch)
121 return true;
122
125
126 // One side is the major-family subarch covering the other's family.
127 if (A == MajorA)
128 return MajorA == MajorB;
129 if (B == MajorB)
130 return MajorA == MajorB;
131
132 return false;
133}
134
136 // An unrecognized GPU is never valid.
137 if (AK == GK_NONE)
138 return false;
139 // A legacy triple without a subarch accepts any known GPU.
140 if (SubArch == Triple::NoSubArch)
141 return true;
142 return isSubArchCompatible(getSubArch(AK), SubArch);
143}
144
148
150 // Tolerate subarch mismatch if one entry is none. This is a hack for bitcode
151 // libraries.
152 // There's a missing enum entry for an unknown subarch. Make sure the
153 // subarch is really empty.
154 if (A.getSubArch() == Triple::NoSubArch)
155 return A.getArchName().size() == 6;
156
157 if (B.getSubArch() == Triple::NoSubArch)
158 return B.getArchName().size() == 6;
159
160 return isSubArchCompatible(A.getSubArch(), B.getSubArch());
161}
162
163std::string AMDGPU::mergeSubArch(const Triple &A, const Triple &B) {
164 if (A.getSubArch() == Triple::NoSubArch)
165 return B.str();
166 if (B.getSubArch() == Triple::NoSubArch)
167 return A.str();
168
169 Triple::SubArchType MajorA = AMDGPU::getMajorSubArch(A.getSubArch());
170 Triple::SubArchType MajorB = AMDGPU::getMajorSubArch(B.getSubArch());
171
172 // With a compatible major arch, return the specific subarch.
173 if (A.getSubArch() == MajorA) {
174 if (MajorA == MajorB)
175 return B.str();
176 }
177
178 if (B.getSubArch() == MajorB) {
179 if (MajorA == MajorB)
180 return A.str();
181 }
182
183 // Invalid case.
184 return B.str();
185}
186
188 switch (AK) {
189#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
190 case ENUM: \
191 return NAME;
192#include "llvm/TargetParser/AMDGPUTargetParser.def"
193 default:
194 return "";
195 }
196}
197
198// Canonical GPU name for each AMDGPU subarch, indexed by SubArch -
199// Triple::FirstAMDGPUSubArch.
202 {"gfx600", // AMDGPUSubArch6 (no generic target)
203 "gfx600", "gfx601", "gfx602",
204
205 "gfx700", // AMDGPUSubArch7 (no generic target)
206 "gfx700", "gfx701", "gfx702", "gfx703", "gfx704",
207 "gfx705",
208
209 "gfx801", // AMDGPUSubArch8 (no generic target)
210 "gfx801", "gfx802", "gfx803", "gfx805",
211
212 "gfx810",
213
214 "gfx9-generic", "gfx900", "gfx902", "gfx904", "gfx906",
215 "gfx909", "gfx90c",
216
217 "gfx908", "gfx90a",
218
219 "gfx9-4-generic", "gfx942", "gfx950",
220
221 "gfx10-1-generic", "gfx1010", "gfx1011", "gfx1012", "gfx1013",
222
223 "gfx10-3-generic", "gfx1030", "gfx1031", "gfx1032", "gfx1033",
224 "gfx1034", "gfx1035", "gfx1036",
225
226 "gfx11-generic", "gfx1100", "gfx1101", "gfx1102", "gfx1103",
227 "gfx1150", "gfx1151", "gfx1152", "gfx1153", "gfx1154",
228
229 "gfx11-7-generic", "gfx1170", "gfx1171", "gfx1172",
230
231 "gfx12-generic", "gfx1200", "gfx1201", "gfx12-5-generic", "gfx1250",
232 "gfx1251",
233
234 "gfx13-generic", "gfx1310"};
235
242
244 switch (AK) {
245#define R600_GPU(NAME, ENUM, FEATURES) \
246 case ENUM: \
247 return NAME;
248#include "llvm/TargetParser/AMDGPUTargetParser.def"
249 default:
250 return "";
251 }
252}
253
256#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) .Case(NAME, ENUM)
257#define AMDGCN_GPU_ALIAS(NAME, ENUM) .Case(NAME, ENUM)
258#include "llvm/TargetParser/AMDGPUTargetParser.def"
259 .Case("generic", AMDGPU::GPUKind::GK_GFX600)
260 .Case("generic-hsa", AMDGPU::GPUKind::GK_GFX700)
262}
263
266#define R600_GPU(NAME, ENUM, FEATURES) .Case(NAME, ENUM)
267#define R600_GPU_ALIAS(NAME, ENUM) .Case(NAME, ENUM)
268#include "llvm/TargetParser/AMDGPUTargetParser.def"
270}
271
273 switch (AK) {
274#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
275 case ENUM: \
276 return FEATURES;
277#include "llvm/TargetParser/AMDGPUTargetParser.def"
278 default:
279 return FEATURE_NONE;
280 }
281}
282
284 switch (SubArch) {
285#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
286 case SUBARCH: \
287 return FEATURES;
288#include "llvm/TargetParser/AMDGPUTargetParser.def"
289 default:
290 return FEATURE_NONE;
291 }
292}
293
295 switch (AK) {
296#define R600_GPU(NAME, ENUM, FEATURES) \
297 case ENUM: \
298 return FEATURES;
299#include "llvm/TargetParser/AMDGPUTargetParser.def"
300 default:
301 return FEATURE_NONE;
302 }
303}
304
306 Triple::SubArchType SubArch) {
307 // XXX: Should this only report unique canonical names?
308 // An alias shares its GPU's GPUKind, so it is filtered alongside it.
309#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
310 if (isCPUValidForSubArch(SubArch, ENUM)) \
311 Values.push_back(NAME);
312#define AMDGCN_GPU_ALIAS(NAME, ENUM) \
313 if (isCPUValidForSubArch(SubArch, ENUM)) \
314 Values.push_back(NAME);
315#include "llvm/TargetParser/AMDGPUTargetParser.def"
316}
317
319 Values.append({
320#define R600_GPU(NAME, ENUM, FEATURES) NAME,
321#define R600_GPU_ALIAS(NAME, ENUM) NAME,
322#include "llvm/TargetParser/AMDGPUTargetParser.def"
323 });
324}
325
328 if (AK == AMDGPU::GPUKind::GK_NONE) {
329 if (GPU == "generic-hsa")
330 return {7, 0, 0};
331 if (GPU == "generic")
332 return {6, 0, 0};
333 return {0, 0, 0};
334 }
335
336 switch (AK) {
337#define MAKE_ISAVERSION(A, B, C) {A, B, C}
338#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
339 case ENUM: \
340 return MAKE_ISAVERSION ISAVERSION;
341#include "llvm/TargetParser/AMDGPUTargetParser.def"
342#undef MAKE_ISAVERSION
343 default:
344 return {0, 0, 0};
345 }
346}
347
349 switch (SubArch) {
350#define MAKE_ISAVERSION(A, B, C) {A, B, C}
351#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
352 case SUBARCH: \
353 return MAKE_ISAVERSION ISAVERSION;
354#include "llvm/TargetParser/AMDGPUTargetParser.def"
355#undef MAKE_ISAVERSION
356 default:
357 return {0, 0, 0};
358 }
359}
360
363 if (Version.Major >= 8)
364 return 800;
365 return 512;
366}
367
370 if (Version.Major >= 8)
371 return 800;
372 return 512;
373}
374
378
380 if (Version.Major >= 10)
381 return 106;
382 if (Version.Major >= 8)
383 return 102;
384 return 104;
385}
386
390
392 if (Version.Major >= 10)
393 return 106;
394 if (Version.Major >= 8)
395 return 102;
396 return 104;
397}
398
401 if (Version.Major >= 10)
402 return getAddressableNumSGPRs(AK);
403 if (Version.Major >= 8)
404 return 16;
405 return 8;
406}
407
410 if (Version.Major >= 10)
411 return getAddressableNumSGPRs(SubArch);
412 if (Version.Major >= 8)
413 return 16;
414 return 8;
415}
416
418 assert(T.isAMDGPU());
419 auto ProcKind = T.isAMDGCN() ? parseArchAMDGCN(Arch) : parseArchR600(Arch);
420 if (ProcKind == GK_NONE)
421 return StringRef();
422
423 return T.isAMDGCN() ? getArchNameAMDGCN(ProcKind) : getArchNameR600(ProcKind);
424}
425
426static std::pair<FeatureError, StringRef>
428 const StringMap<bool> &DefaultFeatures,
429 StringMap<bool> &Features) {
430 // A bare subarch triple (no -target-cpu) still pins down the target, so it is
431 // not a null GPU: DefaultFeatures has already been populated from the
432 // subarch.
433 const bool IsNullGPU = T.getSubArch() == Triple::NoSubArch && GPU.empty();
434 const bool TargetHasWave32 = DefaultFeatures.count("wavefrontsize32");
435 const bool TargetHasWave64 = DefaultFeatures.count("wavefrontsize64");
436
437 auto Wave32Itr = Features.find("wavefrontsize32");
438 auto Wave64Itr = Features.find("wavefrontsize64");
439 const bool EnableWave32 =
440 Wave32Itr != Features.end() && Wave32Itr->getValue();
441 const bool EnableWave64 =
442 Wave64Itr != Features.end() && Wave64Itr->getValue();
443 const bool DisableWave32 =
444 Wave32Itr != Features.end() && !Wave32Itr->getValue();
445 const bool DisableWave64 =
446 Wave64Itr != Features.end() && !Wave64Itr->getValue();
447
448 if (EnableWave32 && EnableWave64)
450 "'+wavefrontsize32' and '+wavefrontsize64' are mutually exclusive"};
451 if (DisableWave32 && DisableWave64)
453 "'-wavefrontsize32' and '-wavefrontsize64' are mutually exclusive"};
454
455 if (!IsNullGPU) {
456 if (TargetHasWave64) {
457 if (EnableWave32)
458 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "+wavefrontsize32"};
459 if (DisableWave64)
460 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "-wavefrontsize64"};
461 }
462
463 if (TargetHasWave32) {
464 if (EnableWave64)
465 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "+wavefrontsize64"};
466 if (DisableWave32)
467 return {AMDGPU::UNSUPPORTED_TARGET_FEATURE, "-wavefrontsize32"};
468 }
469 }
470
471 // Don't assume any wavesize with an unknown subtarget.
472 // Default to wave32 if target supports both.
473 if (!IsNullGPU && !EnableWave32 && !EnableWave64 && !TargetHasWave32 &&
474 !TargetHasWave64)
475 Features.insert(std::make_pair("wavefrontsize32", true));
476
477 for (const auto &Entry : DefaultFeatures) {
478 if (!Features.count(Entry.getKey()))
479 Features[Entry.getKey()] = Entry.getValue();
480 }
481
482 return {NO_ERROR, StringRef()};
483}
484
485/// Fills Features map with default values for given target GPU.
486/// \p Features contains overriding target features and this function returns
487/// default target features with entries overridden by \p Features.
488static void fillAMDGCNFeatureMap(StringRef GPU, const Triple &T,
489 StringMap<bool> &Features) {
490 // With no explicit GPU, the triple's subarch identifies the target.
491 AMDGPU::GPUKind Kind = GPU.empty() && T.getSubArch() != Triple::NoSubArch
492 ? getGPUKindFromSubArch(T.getSubArch())
493 : parseArchAMDGCN(GPU);
494 switch (Kind) {
495 case GK_GFX1310:
496 case GK_GFX13_GENERIC:
497 Features["ci-insts"] = true;
498 Features["dot7-insts"] = true;
499 Features["dot8-insts"] = true;
500 Features["dl-insts"] = true;
501 Features["16-bit-insts"] = true;
502 Features["dpp"] = true;
503 Features["gfx8-insts"] = true;
504 Features["gfx9-insts"] = true;
505 Features["gfx10-insts"] = true;
506 Features["gfx10-3-insts"] = true;
507 Features["gfx11-insts"] = true;
508 Features["gfx12-insts"] = true;
509 Features["gfx1250-insts"] = true;
510 Features["gfx13-insts"] = true;
511 Features["bitop3-insts"] = true;
512 Features["prng-inst"] = true;
513 Features["tanh-insts"] = true;
514 Features["tensor-cvt-lut-insts"] = true;
515 Features["bf16-trans-insts"] = true;
516 Features["bf16-cvt-insts"] = true;
517 Features["bf16-pk-insts"] = true;
518 Features["fp8-conversion-insts"] = true;
519 Features["permlane16-swap"] = true;
520 Features["ashr-pk-insts"] = true;
521 Features["atomic-buffer-pk-add-bf16-inst"] = true;
522 Features["atomic-fadd-rtn-insts"] = true;
523 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
524 Features["atomic-flat-pk-add-16-insts"] = true;
525 Features["atomic-global-pk-add-bf16-inst"] = true;
526 Features["atomic-ds-pk-add-16-insts"] = true;
527 Features["s-wakeup-barrier-inst"] = true;
528 Features["f16bf16-to-fp6bf6-cvt-scale-insts"] = true;
529 Features["f32-to-fp6bf6-cvt-scale-insts"] = true;
530 Features["clusters"] = true;
531 Features["cube-insts"] = true;
532 Features["lerp-inst"] = true;
533 Features["sad-insts"] = true;
534 Features["qsad-insts"] = true;
535 Features["cvt-pknorm-vop2-insts"] = true;
536 Features["cvt-pknorm-vop3-insts"] = true;
537 Features["image-insts"] = true;
538 Features["async-load-to-lds-insts"] = true;
539 break;
540 case GK_GFX1251:
541 Features["gfx1251-gemm-insts"] = true;
542 [[fallthrough]];
543 case GK_GFX1250:
544 Features["swmmac-gfx1200-insts"] = true;
545 Features["swmmac-gfx1250-insts"] = true;
546 Features["cube-insts"] = true;
547 Features["cvt-pknorm-vop2-insts"] = true;
548 Features["lerp-inst"] = true;
549 Features["qsad-insts"] = true;
550 Features["sad-insts"] = true;
551 Features["msad-insts"] = true;
552 Features["mqsad-pk-insts"] = true;
553 Features["mqsad-insts"] = true;
554 [[fallthrough]];
555 case GK_GFX12_5_GENERIC:
556 Features["ci-insts"] = true;
557 Features["dot7-insts"] = true;
558 Features["dot8-insts"] = true;
559 Features["dl-insts"] = true;
560 Features["16-bit-insts"] = true;
561 Features["dpp"] = true;
562 Features["gfx8-insts"] = true;
563 Features["gfx9-insts"] = true;
564 Features["flat-global-insts"] = true;
565 Features["gfx10-insts"] = true;
566 Features["gfx10-3-insts"] = true;
567 Features["gfx11-insts"] = true;
568 Features["gfx12-insts"] = true;
569 Features["gfx1250-insts"] = true;
570 Features["bitop3-insts"] = true;
571 Features["prng-inst"] = true;
572 Features["tanh-insts"] = true;
573 Features["tensor-cvt-lut-insts"] = true;
574 Features["transpose-load-f4f6-insts"] = true;
575 Features["bf16-trans-insts"] = true;
576 Features["bf16-cvt-insts"] = true;
577 Features["bf16-pk-insts"] = true;
578 Features["fp8-conversion-insts"] = true;
579 Features["fp8e5m3-insts"] = true;
580 Features["permlane16-swap"] = true;
581 Features["ashr-pk-insts"] = true;
582 Features["add-min-max-insts"] = true;
583 Features["pk-add-min-max-insts"] = true;
584 Features["atomic-buffer-pk-add-bf16-inst"] = true;
585 Features["vmem-pref-insts"] = true;
586 Features["atomic-fadd-rtn-insts"] = true;
587 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
588 Features["atomic-flat-pk-add-16-insts"] = true;
589 Features["atomic-global-pk-add-bf16-inst"] = true;
590 Features["atomic-ds-pk-add-16-insts"] = true;
591 Features["setprio-inc-wg-inst"] = true;
592 Features["s-wakeup-barrier-inst"] = true;
593 Features["atomic-fmin-fmax-global-f32"] = true;
594 Features["atomic-fmin-fmax-global-f64"] = true;
595 Features["wavefrontsize32"] = true;
596 Features["clusters"] = true;
597 Features["mcast-load-insts"] = true;
598 Features["async-load-to-lds-insts"] = true;
599 Features["async-store-from-lds-insts"] = true;
600 Features["asynccnt"] = true;
601 break;
602 case GK_GFX1201:
603 case GK_GFX1200:
604 case GK_GFX12_GENERIC:
605 Features["ci-insts"] = true;
606 Features["dot7-insts"] = true;
607 Features["dot8-insts"] = true;
608 Features["dot9-insts"] = true;
609 Features["dot10-insts"] = true;
610 Features["dot11-insts"] = true;
611 Features["dot12-insts"] = true;
612 Features["dl-insts"] = true;
613 Features["atomic-ds-pk-add-16-insts"] = true;
614 Features["atomic-flat-pk-add-16-insts"] = true;
615 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
616 Features["atomic-buffer-pk-add-bf16-inst"] = true;
617 Features["atomic-global-pk-add-bf16-inst"] = true;
618 Features["16-bit-insts"] = true;
619 Features["dpp"] = true;
620 Features["gfx8-insts"] = true;
621 Features["gfx9-insts"] = true;
622 Features["flat-global-insts"] = true;
623 Features["gfx10-insts"] = true;
624 Features["gfx10-3-insts"] = true;
625 Features["gfx11-insts"] = true;
626 Features["gfx12-insts"] = true;
627 Features["atomic-fadd-rtn-insts"] = true;
628 Features["image-insts"] = true;
629 Features["bvh-ray-tracing-insts"] = true;
630 Features["cube-insts"] = true;
631 Features["lerp-inst"] = true;
632 Features["sad-insts"] = true;
633 Features["qsad-insts"] = true;
634 Features["msad-insts"] = true;
635 Features["mqsad-pk-insts"] = true;
636 Features["mqsad-insts"] = true;
637 Features["cvt-pknorm-vop2-insts"] = true;
638 Features["fp8-conversion-insts"] = true;
639 Features["wmma-128b-insts"] = true;
640 Features["swmmac-gfx1200-insts"] = true;
641 Features["atomic-fmin-fmax-global-f32"] = true;
642 break;
643 case GK_GFX1170:
644 case GK_GFX1171:
645 case GK_GFX1172:
646 case GK_GFX11_7_GENERIC:
647 Features["ci-insts"] = true;
648 Features["dot7-insts"] = true;
649 Features["dot8-insts"] = true;
650 Features["dot9-insts"] = true;
651 Features["dot10-insts"] = true;
652 Features["dot12-insts"] = true;
653 Features["dl-insts"] = true;
654 Features["16-bit-insts"] = true;
655 Features["dpp"] = true;
656 Features["gfx8-insts"] = true;
657 Features["gfx9-insts"] = true;
658 Features["flat-global-insts"] = true;
659 Features["gfx10-insts"] = true;
660 Features["gfx10-3-insts"] = true;
661 Features["gfx11-insts"] = true;
662 Features["atomic-fadd-rtn-insts"] = true;
663 Features["image-insts"] = true;
664 Features["bvh-ray-tracing-insts"] = true;
665 Features["cube-insts"] = true;
666 Features["lerp-inst"] = true;
667 Features["sad-insts"] = true;
668 Features["qsad-insts"] = true;
669 Features["msad-insts"] = true;
670 Features["mqsad-pk-insts"] = true;
671 Features["mqsad-insts"] = true;
672 Features["cvt-pknorm-vop2-insts"] = true;
673 Features["gws"] = true;
674 Features["dot11-insts"] = true;
675 Features["fp8-conversion-insts"] = true;
676 Features["wmma-128b-insts"] = true;
677 Features["swmmac-gfx1200-insts"] = true;
678 Features["atomic-fmin-fmax-global-f32"] = true;
679 break;
680 case GK_GFX1154:
681 case GK_GFX1153:
682 case GK_GFX1152:
683 case GK_GFX1151:
684 case GK_GFX1150:
685 case GK_GFX1103:
686 case GK_GFX1102:
687 case GK_GFX1101:
688 case GK_GFX1100:
689 case GK_GFX11_GENERIC:
690 Features["ci-insts"] = true;
691 Features["dot5-insts"] = true;
692 Features["dot7-insts"] = true;
693 Features["dot8-insts"] = true;
694 Features["dot9-insts"] = true;
695 Features["dot10-insts"] = true;
696 Features["dot12-insts"] = true;
697 Features["dl-insts"] = true;
698 Features["16-bit-insts"] = true;
699 Features["dpp"] = true;
700 Features["gfx8-insts"] = true;
701 Features["gfx9-insts"] = true;
702 Features["flat-global-insts"] = true;
703 Features["gfx10-insts"] = true;
704 Features["gfx10-3-insts"] = true;
705 Features["gfx11-insts"] = true;
706 Features["atomic-fadd-rtn-insts"] = true;
707 Features["image-insts"] = true;
708 Features["bvh-ray-tracing-insts"] = true;
709 Features["cube-insts"] = true;
710 Features["lerp-inst"] = true;
711 Features["sad-insts"] = true;
712 Features["qsad-insts"] = true;
713 Features["msad-insts"] = true;
714 Features["mqsad-pk-insts"] = true;
715 Features["mqsad-insts"] = true;
716 Features["cvt-pknorm-vop2-insts"] = true;
717 Features["gws"] = true;
718 Features["wmma-256b-insts"] = true;
719 Features["atomic-fmin-fmax-global-f32"] = true;
720 break;
721 case GK_GFX1036:
722 case GK_GFX1035:
723 case GK_GFX1034:
724 case GK_GFX1033:
725 case GK_GFX1032:
726 case GK_GFX1031:
727 case GK_GFX1030:
728 case GK_GFX10_3_GENERIC:
729 Features["ci-insts"] = true;
730 Features["dot1-insts"] = true;
731 Features["dot2-insts"] = true;
732 Features["dot5-insts"] = true;
733 Features["dot6-insts"] = true;
734 Features["dot7-insts"] = true;
735 Features["dot10-insts"] = true;
736 Features["dl-insts"] = true;
737 Features["16-bit-insts"] = true;
738 Features["dpp"] = true;
739 Features["gfx8-insts"] = true;
740 Features["gfx9-insts"] = true;
741 Features["flat-global-insts"] = true;
742 Features["gfx10-insts"] = true;
743 Features["gfx10-3-insts"] = true;
744 Features["image-insts"] = true;
745 Features["bvh-ray-tracing-insts"] = true;
746 Features["s-memrealtime"] = true;
747 Features["s-memtime-inst"] = true;
748 Features["gws"] = true;
749 Features["vmem-to-lds-load-insts"] = true;
750 Features["atomic-fmin-fmax-global-f32"] = true;
751 Features["atomic-fmin-fmax-global-f64"] = true;
752 Features["cube-insts"] = true;
753 Features["lerp-inst"] = true;
754 Features["sad-insts"] = true;
755 Features["qsad-insts"] = true;
756 Features["msad-insts"] = true;
757 Features["mqsad-pk-insts"] = true;
758 Features["mqsad-insts"] = true;
759 Features["cvt-pknorm-vop2-insts"] = true;
760 break;
761 case GK_GFX1012:
762 case GK_GFX1011:
763 Features["dot1-insts"] = true;
764 Features["dot2-insts"] = true;
765 Features["dot5-insts"] = true;
766 Features["dot6-insts"] = true;
767 Features["dot7-insts"] = true;
768 Features["dot10-insts"] = true;
769 [[fallthrough]];
770 case GK_GFX1013:
771 case GK_GFX1010:
772 case GK_GFX10_1_GENERIC:
773 if (Kind == GK_GFX1013)
774 Features["bvh-ray-tracing-insts"] = true;
775 Features["dl-insts"] = true;
776 Features["ci-insts"] = true;
777 Features["16-bit-insts"] = true;
778 Features["dpp"] = true;
779 Features["gfx8-insts"] = true;
780 Features["gfx9-insts"] = true;
781 Features["flat-global-insts"] = true;
782 Features["gfx10-insts"] = true;
783 Features["image-insts"] = true;
784 Features["s-memrealtime"] = true;
785 Features["s-memtime-inst"] = true;
786 Features["gws"] = true;
787 Features["vmem-to-lds-load-insts"] = true;
788 Features["atomic-fmin-fmax-global-f32"] = true;
789 Features["atomic-fmin-fmax-global-f64"] = true;
790 Features["cube-insts"] = true;
791 Features["lerp-inst"] = true;
792 Features["sad-insts"] = true;
793 Features["qsad-insts"] = true;
794 Features["msad-insts"] = true;
795 Features["mqsad-pk-insts"] = true;
796 Features["mqsad-insts"] = true;
797 Features["cvt-pknorm-vop2-insts"] = true;
798 break;
799 case GK_GFX950:
800 Features["bitop3-insts"] = true;
801 Features["fp6bf6-cvt-scale-insts"] = true;
802 Features["fp4-cvt-scale-insts"] = true;
803 Features["bf8-cvt-scale-insts"] = true;
804 Features["fp8-cvt-scale-insts"] = true;
805 Features["f16bf16-to-fp6bf6-cvt-scale-insts"] = true;
806 Features["f32-to-f16bf16-cvt-sr-insts"] = true;
807 Features["prng-inst"] = true;
808 Features["permlane16-swap"] = true;
809 Features["permlane32-swap"] = true;
810 Features["ashr-pk-insts"] = true;
811 Features["dot12-insts"] = true;
812 Features["dot13-insts"] = true;
813 Features["atomic-buffer-pk-add-bf16-inst"] = true;
814 Features["gfx950-insts"] = true;
815 [[fallthrough]];
816 case GK_GFX942:
817 Features["fp8-insts"] = true;
818 Features["fp8-conversion-insts"] = true;
819 if (Kind != GK_GFX950)
820 Features["xf32-insts"] = true;
821 [[fallthrough]];
822 case GK_GFX9_4_GENERIC:
823 Features["gfx940-insts"] = true;
824 Features["atomic-ds-pk-add-16-insts"] = true;
825 Features["atomic-flat-pk-add-16-insts"] = true;
826 Features["atomic-global-pk-add-bf16-inst"] = true;
827 Features["gfx90a-insts"] = true;
828 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
829 Features["atomic-fadd-rtn-insts"] = true;
830 Features["dot3-insts"] = true;
831 Features["dot4-insts"] = true;
832 Features["dot5-insts"] = true;
833 Features["dot6-insts"] = true;
834 Features["mai-insts"] = true;
835 Features["dl-insts"] = true;
836 Features["dot1-insts"] = true;
837 Features["dot2-insts"] = true;
838 Features["dot7-insts"] = true;
839 Features["dot10-insts"] = true;
840 Features["gfx9-insts"] = true;
841 Features["flat-global-insts"] = true;
842 Features["gfx8-insts"] = true;
843 Features["16-bit-insts"] = true;
844 Features["dpp"] = true;
845 Features["s-memrealtime"] = true;
846 Features["ci-insts"] = true;
847 Features["s-memtime-inst"] = true;
848 Features["gws"] = true;
849 Features["vmem-to-lds-load-insts"] = true;
850 Features["atomic-fmin-fmax-global-f64"] = true;
851 Features["wavefrontsize64"] = true;
852 Features["cube-insts"] = true;
853 Features["lerp-inst"] = true;
854 Features["sad-insts"] = true;
855 Features["qsad-insts"] = true;
856 Features["msad-insts"] = true;
857 Features["mqsad-pk-insts"] = true;
858 Features["mqsad-insts"] = true;
859 Features["cvt-pknorm-vop2-insts"] = true;
860 break;
861 case GK_GFX90A:
862 Features["gfx90a-insts"] = true;
863 Features["atomic-buffer-global-pk-add-f16-insts"] = true;
864 Features["atomic-fadd-rtn-insts"] = true;
865 Features["atomic-fmin-fmax-global-f64"] = true;
866 [[fallthrough]];
867 case GK_GFX908:
868 Features["dot3-insts"] = true;
869 Features["dot4-insts"] = true;
870 Features["dot5-insts"] = true;
871 Features["dot6-insts"] = true;
872 Features["mai-insts"] = true;
873 [[fallthrough]];
874 case GK_GFX906:
875 Features["dl-insts"] = true;
876 Features["dot1-insts"] = true;
877 Features["dot2-insts"] = true;
878 Features["dot7-insts"] = true;
879 Features["dot10-insts"] = true;
880 [[fallthrough]];
881 case GK_GFX90C:
882 case GK_GFX909:
883 case GK_GFX904:
884 case GK_GFX902:
885 case GK_GFX900:
886 case GK_GFX9_GENERIC:
887 Features["gfx9-insts"] = true;
888 Features["flat-global-insts"] = true;
889 Features["vmem-to-lds-load-insts"] = true;
890 [[fallthrough]];
891 case GK_GFX810:
892 case GK_GFX805:
893 case GK_GFX803:
894 case GK_GFX802:
895 case GK_GFX801:
896 Features["gfx8-insts"] = true;
897 Features["16-bit-insts"] = true;
898 Features["dpp"] = true;
899 Features["s-memrealtime"] = true;
900 Features["ci-insts"] = true;
901 Features["image-insts"] = true;
902 Features["s-memtime-inst"] = true;
903 Features["gws"] = true;
904 Features["wavefrontsize64"] = true;
905 Features["cube-insts"] = true;
906 Features["lerp-inst"] = true;
907 Features["sad-insts"] = true;
908 Features["qsad-insts"] = true;
909 Features["msad-insts"] = true;
910 Features["mqsad-pk-insts"] = true;
911 Features["mqsad-insts"] = true;
912 Features["cvt-pknorm-vop2-insts"] = true;
913 break;
914 case GK_GFX705:
915 case GK_GFX704:
916 case GK_GFX703:
917 case GK_GFX702:
918 case GK_GFX701:
919 case GK_GFX700:
920 Features["ci-insts"] = true;
921 Features["cube-insts"] = true;
922 Features["lerp-inst"] = true;
923 Features["sad-insts"] = true;
924 Features["qsad-insts"] = true;
925 Features["msad-insts"] = true;
926 Features["mqsad-pk-insts"] = true;
927 Features["mqsad-insts"] = true;
928 Features["cvt-pknorm-vop2-insts"] = true;
929 Features["image-insts"] = true;
930 Features["s-memtime-inst"] = true;
931 Features["gws"] = true;
932 Features["atomic-fmin-fmax-global-f32"] = true;
933 Features["atomic-fmin-fmax-global-f64"] = true;
934 Features["wavefrontsize64"] = true;
935 break;
936 case GK_GFX602:
937 case GK_GFX601:
938 case GK_GFX600:
939 Features["image-insts"] = true;
940 Features["s-memtime-inst"] = true;
941 Features["gws"] = true;
942 Features["atomic-fmin-fmax-global-f32"] = true;
943 Features["atomic-fmin-fmax-global-f64"] = true;
944 Features["wavefrontsize64"] = true;
945 Features["cube-insts"] = true;
946 Features["lerp-inst"] = true;
947 Features["sad-insts"] = true;
948 Features["msad-insts"] = true;
949 Features["mqsad-pk-insts"] = true;
950 Features["cvt-pknorm-vop2-insts"] = true;
951 break;
952 case GK_NONE:
953 break;
954 default:
955 llvm_unreachable("Unhandled GPU!");
956 }
957}
958
959/// Fills Features map with default values for given target GPU.
960/// \p Features contains overriding target features and this function returns
961/// default target features with entries overridden by \p Features.
962std::pair<FeatureError, StringRef>
964 StringMap<bool> &Features) {
965 // XXX - What does the member GPU mean if device name string passed here?
966 if (T.isSPIRV() && T.getOS() == Triple::OSType::AMDHSA) {
967 // AMDGCN SPIRV must support the union of all AMDGCN features.
970
971 static const Triple AMDGCN("amdgcn-amd-amdhsa");
972 StringMap<bool> Tmp;
973 for (auto &&GPU : GPUs) {
974 fillAMDGCNFeatureMap(GPU, AMDGCN, Tmp);
975 for (auto &&[F, B] : Tmp)
976 Features[F] = B;
977 }
978 Features["wavefrontsize32"] = true;
979 Features["wavefrontsize64"] = true;
980 } else if (T.isAMDGCN()) {
981 StringMap<bool> DefaultFeatures;
982 fillAMDGCNFeatureMap(GPU, T, DefaultFeatures);
983 return insertWaveSizeFeature(GPU, T, DefaultFeatures, Features);
984 } else {
985 if (GPU.empty())
986 GPU = "r600";
987
988 switch (llvm::AMDGPU::parseArchR600(GPU)) {
989 case GK_CAYMAN:
990 case GK_CYPRESS:
991 case GK_RV770:
992 case GK_RV670:
993 // TODO: Add fp64 when implemented.
994 break;
995 case GK_TURKS:
996 case GK_CAICOS:
997 case GK_BARTS:
998 case GK_SUMO:
999 case GK_REDWOOD:
1000 case GK_JUNIPER:
1001 case GK_CEDAR:
1002 case GK_RV730:
1003 case GK_RV710:
1004 case GK_RS880:
1005 case GK_R630:
1006 case GK_R600:
1007 break;
1008 default:
1009 llvm_unreachable("Unhandled GPU!");
1010 }
1011 }
1012 return {NO_ERROR, StringRef()};
1013}
1014
1015TargetID::TargetID(GPUKind Arch, const Triple &TT, TargetIDSetting XnackSetting,
1016 TargetIDSetting SramEccSetting)
1017 : Arch(Arch),
1018 TargetTripleString(TT.normalize(Triple::CanonicalForm::FOUR_IDENT)),
1019 XnackSetting(XnackSetting), SramEccSetting(SramEccSetting),
1020 IsAMDHSA(TT.getOS() == Triple::AMDHSA) {}
1021
1022// Parse a feature modifier sign ("+"/"-"). Returns "Unsupported" if \p Sign is
1023// neither (i.e. the modifier is malformed).
1025 if (Sign == "+")
1026 return TargetIDSetting::On;
1027 if (Sign == "-")
1028 return TargetIDSetting::Off;
1029
1030 return TargetIDSetting::Unsupported;
1031}
1032
1033// Derive the architecture from the processor name in \p TargetIDStr. "generic"
1034// and the empty processor name act as a wildcard.
1035static GPUKind getGPUKindFromTargetID(const Triple &TT, StringRef TargetIDStr) {
1036 StringRef CPUName = TargetIDStr.split(':').first;
1037 return (CPUName.empty() || CPUName == "generic")
1038 ? getGPUKindFromSubArch(TT.getSubArch())
1039 : parseArchAMDGCN(CPUName);
1040}
1041
1042// Compute the xnack/sramecc settings for processor \p Arch from the
1043// processor+features string \p TargetIDStr
1044// (e.g. "gfx90a:xnack+:sramecc-"). Returns false if a modifier names an unknown
1045// or repeated feature, names one the processor does not support, or has a
1046// malformed sign.
1047static bool computeTargetIDFeatures(GPUKind Arch, StringRef TargetIDStr,
1050 unsigned ArchAttr = getArchAttrAMDGCN(Arch);
1052 ? TargetIDSetting::Any
1053 : TargetIDSetting::Unsupported;
1054 SramEccSetting = (ArchAttr & FEATURE_SRAMECC) ? TargetIDSetting::Any
1055 : TargetIDSetting::Unsupported;
1056
1057 // The first component is the processor; the rest are feature modifiers of the
1058 // form "<feature><+|->".
1060 TargetIDStr.split(Split, ':');
1061 bool SeenXnack = false;
1062 bool SeenSramEcc = false;
1063 bool Valid = true;
1064 for (unsigned I = 1, E = Split.size(); I != E; ++I) {
1065 StringRef FeatureString = Split[I];
1066 if (FeatureString.consume_front("xnack")) {
1068 if (SeenXnack || XnackSetting == TargetIDSetting::Unsupported ||
1069 Sign == TargetIDSetting::Unsupported)
1070 Valid = false;
1071 else
1072 XnackSetting = Sign;
1073 SeenXnack = true;
1074 } else if (FeatureString.consume_front("sramecc")) {
1076 if (SeenSramEcc || SramEccSetting == TargetIDSetting::Unsupported ||
1077 Sign == TargetIDSetting::Unsupported)
1078 Valid = false;
1079 else
1080 SramEccSetting = Sign;
1081 SeenSramEcc = true;
1082 } else {
1083 // Unknown feature name.
1084 Valid = false;
1085 }
1086 }
1087 return Valid;
1088}
1089
1090TargetID::TargetID(const Triple &TT, StringRef TargetIDStr)
1091 : TargetID(getGPUKindFromTargetID(TT, TargetIDStr), TT,
1093 // Derive the feature settings from the string. Validity is not checked here;
1094 // parseTargetIDString validates untrusted input.
1095 computeTargetIDFeatures(Arch, TargetIDStr, XnackSetting, SramEccSetting);
1096}
1097
1098std::optional<TargetID> TargetID::parse(const Triple &TT,
1099 StringRef ProcAndFeatures) {
1100 if (!TT.isAMDGCN())
1101 return std::nullopt;
1102
1103 // Filter out unrecognized subarch suffixes.
1104 if (TT.getSubArch() == Triple::NoSubArch && TT.getArchName() != "amdgcn")
1105 return std::nullopt;
1106
1107 // A named processor (i.e. not the empty/generic wildcard, which is resolved
1108 // from the triple's subarch) must be a recognized GPU that is consistent with
1109 // the triple's subarch.
1110 StringRef CPUName = ProcAndFeatures.split(':').first;
1111 if (!CPUName.empty() && CPUName != "generic" &&
1112 !isCPUValidForSubArch(TT.getSubArch(), CPUName))
1113 return std::nullopt;
1114
1115 // Parse the processor and its feature modifiers, then construct directly from
1116 // the resulting fields.
1117 GPUKind Arch = getGPUKindFromTargetID(TT, ProcAndFeatures);
1118 TargetIDSetting XnackSetting, SramEccSetting;
1119 if (!computeTargetIDFeatures(Arch, ProcAndFeatures, XnackSetting,
1120 SramEccSetting))
1121 return std::nullopt;
1122
1123 return TargetID(Arch, TT, XnackSetting, SramEccSetting);
1124}
1125
1126std::optional<TargetID>
1128 // Split on '-' to get arch-vendor-os-environment-processor:features. There is
1129 // a single dash separator after the 4-component triple, so the
1130 // processor+features field must be present (even if empty).
1132 TargetIDDirective.split(Parts, '-', /*MaxSplit=*/4);
1133 if (Parts.size() < 5)
1134 return std::nullopt;
1135
1136 return parse(Triple(Parts[0], Parts[1], Parts[2], Parts[3]), Parts[4]);
1137}
1138
1139// Append the explicit (On/Off) sramecc/xnack feature modifiers in canonical
1140// order, e.g. ":sramecc-:xnack+".
1142 TargetIDSetting Xnack) {
1143 if (SramEcc == TargetIDSetting::Off)
1144 OS << ":sramecc-";
1145 else if (SramEcc == TargetIDSetting::On)
1146 OS << ":sramecc+";
1147
1148 if (Xnack == TargetIDSetting::Off)
1149 OS << ":xnack-";
1150 else if (Xnack == TargetIDSetting::On)
1151 OS << ":xnack+";
1152}
1153
1154void TargetID::print(raw_ostream &StreamRep) const {
1155 StreamRep << TargetTripleString << '-' << getArchNameAMDGCN(Arch);
1156
1157 if (IsAMDHSA)
1159}
1160
1161std::string TargetID::toString() const {
1162 std::string Str;
1163 raw_string_ostream OS(Str);
1164 OS << *this;
1165 return Str;
1166}
1167
1172
1174 std::string Str;
1175 raw_string_ostream OS(Str);
1177 return Str;
1178}
1179
1181 return Arch == Other.Arch && XnackSetting == Other.XnackSetting &&
1182 SramEccSetting == Other.SramEccSetting && IsAMDHSA == Other.IsAMDHSA &&
1183 TargetTripleString == Other.TargetTripleString;
1184}
1185
1187 TargetIDSetting Requested) {
1188 return Provided == TargetIDSetting::Any ||
1189 Provided == TargetIDSetting::Unsupported || Provided == Requested;
1190}
1191
1193 // The processor and feature settings must match exactly
1194 if (Arch != Other.Arch || XnackSetting != Other.XnackSetting ||
1195 SramEccSetting != Other.SramEccSetting)
1196 return false;
1197
1199 .isCompatibleWith(Triple(Other.getTargetTripleString()));
1200}
1201
1203 // A major-family/generic processor (e.g. amdgpu9) provides for a specific
1204 // member of its family (e.g. gfx900), but not the reverse. Otherwise the
1205 // processors must match.
1206 if (Arch != Other.Arch && Arch != GK_NONE && Other.Arch != GK_NONE) {
1207 Triple::SubArchType ThisSubArch = getSubArch(Arch);
1208 if (ThisSubArch != getMajorSubArch(ThisSubArch) ||
1209 ThisSubArch != getMajorSubArch(getSubArch(Other.Arch)))
1210 return false;
1211 }
1212
1213 if (!featureProvidesFor(XnackSetting, Other.XnackSetting) ||
1214 !featureProvidesFor(SramEccSetting, Other.SramEccSetting))
1215 return false;
1216
1218 .isCompatibleWith(Triple(Other.getTargetTripleString()));
1219}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static cl::opt< bool > SramEccSetting("amdgpu-sramecc", cl::desc("Force amdgpu.sramecc for testing"), cl::ReallyHidden)
static cl::opt< bool > XnackSetting("amdgpu-xnack", cl::desc("Force amdgpu.xnack value for testing"), cl::ReallyHidden)
static GPUKind getGPUKindFromTargetID(const Triple &TT, StringRef TargetIDStr)
static void fillAMDGCNFeatureMap(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Fills Features map with default values for given target GPU.
static const StringLiteral AMDGPUSubArchNames[Triple::LastAMDGPUSubArch - Triple::FirstAMDGPUSubArch+1]
static bool computeTargetIDFeatures(GPUKind Arch, StringRef TargetIDStr, TargetIDSetting &XnackSetting, TargetIDSetting &SramEccSetting)
static TargetIDSetting getTargetIDSettingFromFeatureString(StringRef Sign)
static void printFeatureModifiers(raw_ostream &OS, TargetIDSetting SramEcc, TargetIDSetting Xnack)
static bool featureProvidesFor(TargetIDSetting Provided, TargetIDSetting Requested)
static const Triple::SubArchType AMDGPUMajorFamilies[Triple::LastAMDGPUSubArch - Triple::FirstAMDGPUSubArch+1]
static std::pair< FeatureError, StringRef > insertWaveSizeFeature(StringRef GPU, const Triple &T, const StringMap< bool > &DefaultFeatures, StringMap< bool > &Features)
#define X(NUM, ENUM, NAME)
Definition ELF.h:856
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
#define T
This file defines the SmallVector class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
void printCanonicalTargetIDString(raw_ostream &OS) const
Print the canonical processor name followed by any explicit xnack and sramecc feature modifiers (e....
static std::optional< TargetID > parseTargetIDString(StringRef TargetIDDirective)
Parse and validate a TargetID from a full "<triple>-<processor>:<features>" directive string.
void print(raw_ostream &OS) const
TargetIDSetting getXnackSetting() const
bool isEquivalent(const TargetID &Other) const
Returns true if Other denotes the same target as *this, i.e.
bool operator==(const TargetID &Other) const
bool providesFor(const TargetID &Other) const
Returns true if a device image for *this can provide the device code for a request for Other.
StringRef getTargetTripleString() const
std::string getCanonicalFeatureString() const
TargetID(GPUKind Arch, const Triple &TT, TargetIDSetting XnackSetting, TargetIDSetting SramEccSetting)
static std::optional< TargetID > parse(const Triple &TT, StringRef ProcAndFeatures)
Parse and validate a TargetID for triple TT from the processor+features string ProcAndFeatures (e....
TargetIDSetting getSramEccSetting() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition StringRef.h:888
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition StringMap.h:128
iterator end()
Definition StringMap.h:213
iterator find(StringRef Key)
Definition StringMap.h:226
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition StringMap.h:274
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition StringMap.h:310
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
Definition StringRef.h:736
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:606
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
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
Definition StringRef.h:661
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Definition StringRef.h:642
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
@ FirstAMDGPUSubArch
Definition Triple.h:276
@ AMDGPUSubArch9
Definition Triple.h:218
@ AMDGPUSubArch9_4
Definition Triple.h:231
@ AMDGPUSubArch6
Definition Triple.h:196
@ AMDGPUSubArch10_3
Definition Triple.h:241
@ AMDGPUSubArch90A
Definition Triple.h:229
@ AMDGPUSubArch810
Definition Triple.h:216
@ AMDGPUSubArch11
Definition Triple.h:250
@ AMDGPUSubArch7
Definition Triple.h:201
@ LastAMDGPUSubArch
Definition Triple.h:277
@ AMDGPUSubArch12_5
Definition Triple.h:270
@ AMDGPUSubArch10_1
Definition Triple.h:235
@ AMDGPUSubArch11_7
Definition Triple.h:261
@ AMDGPUSubArch8
Definition Triple.h:209
@ AMDGPUSubArch13
Definition Triple.h:274
@ AMDGPUSubArch12
Definition Triple.h:266
@ AMDGPUSubArch908
Definition Triple.h:228
LLVM_ABI bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
Definition Triple.cpp:2312
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
A raw_ostream that writes to an std::string.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI StringRef getArchNameR600(GPUKind AK)
LLVM_ABI void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values, Triple::SubArchType SubArch=Triple::NoSubArch)
Append the valid AMDGCN GPU names to Values.
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 std::string mergeSubArch(const Triple &A, const Triple &B)
Returns the effective triple appropriate to use when linking B into A by merging the subarches in cas...
LLVM_ABI bool isCPUValidForSubArch(Triple::SubArchType SubArch, GPUKind AK)
Return true if the GPU AK is usable with the triple subarch SubArch.
LLVM_ABI bool isSubArchCompatible(const Triple &A, const Triple &B)
Return true if subarch A is compatible with subarch B, i.e.
LLVM_ABI StringRef getArchFamilyNameAMDGCN(GPUKind AK)
LLVM_ABI unsigned getAddressableNumSGPRs(GPUKind AK)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
LLVM_ABI unsigned getTotalNumSGPRs(GPUKind AK)
LLVM_ABI unsigned getSGPRAllocGranule(GPUKind AK)
LLVM_ABI Triple::SubArchType getSubArch(GPUKind AK)
LLVM_ABI StringRef getArchNameFromSubArch(Triple::SubArchType SubArch)
Returns the canonical GPU name for an AMDGPU subarch, e.g.
LLVM_ABI GPUKind parseArchAMDGCN(StringRef CPU)
LLVM_ABI GPUKind getGPUKindFromSubArch(Triple::SubArchType SubArch)
AMDGPU::TargetID TargetID
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 Triple::SubArchType getMajorSubArch(Triple::SubArchType SubArch)
LLVM_ABI unsigned getArchAttrR600(GPUKind AK)
LLVM_ABI GPUKind parseArchR600(StringRef CPU)
This is an optimization pass for GlobalISel generic memory operations.
RelativeUniformCounterPtr Values
Definition InstrProf.h:91
Instruction set architecture version.