29 "Generic AMDGCN arch not classified correctly!");
39#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
42#include "llvm/TargetParser/AMDGPUTargetParser.def"
51#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
54#include "llvm/TargetParser/AMDGPUTargetParser.def"
128 return MajorA == MajorB;
130 return MajorA == MajorB;
155 return A.getArchName().size() == 6;
158 return B.getArchName().size() == 6;
173 if (
A.getSubArch() == MajorA) {
174 if (MajorA == MajorB)
178 if (
B.getSubArch() == MajorB) {
179 if (MajorA == MajorB)
189#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
192#include "llvm/TargetParser/AMDGPUTargetParser.def"
203 "gfx600",
"gfx601",
"gfx602",
206 "gfx700",
"gfx701",
"gfx702",
"gfx703",
"gfx704",
210 "gfx801",
"gfx802",
"gfx803",
"gfx805",
214 "gfx9-generic",
"gfx900",
"gfx902",
"gfx904",
"gfx906",
219 "gfx9-4-generic",
"gfx942",
"gfx950",
221 "gfx10-1-generic",
"gfx1010",
"gfx1011",
"gfx1012",
"gfx1013",
223 "gfx10-3-generic",
"gfx1030",
"gfx1031",
"gfx1032",
"gfx1033",
224 "gfx1034",
"gfx1035",
"gfx1036",
226 "gfx11-generic",
"gfx1100",
"gfx1101",
"gfx1102",
"gfx1103",
227 "gfx1150",
"gfx1151",
"gfx1152",
"gfx1153",
"gfx1154",
229 "gfx11-7-generic",
"gfx1170",
"gfx1171",
"gfx1172",
231 "gfx12-generic",
"gfx1200",
"gfx1201",
"gfx12-5-generic",
"gfx1250",
234 "gfx13-generic",
"gfx1310"};
245#define R600_GPU(NAME, ENUM, FEATURES) \
248#include "llvm/TargetParser/AMDGPUTargetParser.def"
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)
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"
274#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
277#include "llvm/TargetParser/AMDGPUTargetParser.def"
285#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
288#include "llvm/TargetParser/AMDGPUTargetParser.def"
296#define R600_GPU(NAME, ENUM, FEATURES) \
299#include "llvm/TargetParser/AMDGPUTargetParser.def"
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"
320#define R600_GPU(NAME, ENUM, FEATURES) NAME,
321#define R600_GPU_ALIAS(NAME, ENUM) NAME,
322#include "llvm/TargetParser/AMDGPUTargetParser.def"
329 if (GPU ==
"generic-hsa")
331 if (GPU ==
"generic")
337#define MAKE_ISAVERSION(A, B, C) {A, B, C}
338#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
340 return MAKE_ISAVERSION ISAVERSION;
341#include "llvm/TargetParser/AMDGPUTargetParser.def"
342#undef MAKE_ISAVERSION
350#define MAKE_ISAVERSION(A, B, C) {A, B, C}
351#define AMDGCN_GPU(NAME, ENUM, SUBARCH, ISAVERSION, FEATURES) \
353 return MAKE_ISAVERSION ISAVERSION;
354#include "llvm/TargetParser/AMDGPUTargetParser.def"
355#undef MAKE_ISAVERSION
426static std::pair<FeatureError, StringRef>
434 const bool TargetHasWave32 = DefaultFeatures.
count(
"wavefrontsize32");
435 const bool TargetHasWave64 = DefaultFeatures.
count(
"wavefrontsize64");
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();
448 if (EnableWave32 && EnableWave64)
450 "'+wavefrontsize32' and '+wavefrontsize64' are mutually exclusive"};
451 if (DisableWave32 && DisableWave64)
453 "'-wavefrontsize32' and '-wavefrontsize64' are mutually exclusive"};
456 if (TargetHasWave64) {
463 if (TargetHasWave32) {
473 if (!IsNullGPU && !EnableWave32 && !EnableWave64 && !TargetHasWave32 &&
475 Features.
insert(std::make_pair(
"wavefrontsize32",
true));
477 for (
const auto &Entry : DefaultFeatures) {
478 if (!Features.
count(Entry.getKey()))
479 Features[Entry.getKey()] = Entry.getValue();
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;
541 Features[
"gfx1251-gemm-insts"] =
true;
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;
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;
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;
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;
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;
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;
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;
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;
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;
817 Features[
"fp8-insts"] =
true;
818 Features[
"fp8-conversion-insts"] =
true;
819 if (Kind != GK_GFX950)
820 Features[
"xf32-insts"] =
true;
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;
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;
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;
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;
886 case GK_GFX9_GENERIC:
887 Features[
"gfx9-insts"] =
true;
888 Features[
"flat-global-insts"] =
true;
889 Features[
"vmem-to-lds-load-insts"] =
true;
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;
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;
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;
962std::pair<FeatureError, StringRef>
971 static const Triple AMDGCN(
"amdgcn-amd-amdhsa");
973 for (
auto &&GPU : GPUs) {
975 for (
auto &&[
F,
B] : Tmp)
978 Features[
"wavefrontsize32"] =
true;
979 Features[
"wavefrontsize64"] =
true;
980 }
else if (
T.isAMDGCN()) {
1018 TargetTripleString(TT.normalize(
Triple::CanonicalForm::FOUR_IDENT)),
1019 XnackSetting(XnackSetting), SramEccSetting(SramEccSetting),
1020 IsAMDHSA(TT.getOS() ==
Triple::AMDHSA) {}
1026 return TargetIDSetting::On;
1028 return TargetIDSetting::Off;
1030 return TargetIDSetting::Unsupported;
1037 return (CPUName.
empty() || CPUName ==
"generic")
1052 ? TargetIDSetting::Any
1053 : TargetIDSetting::Unsupported;
1055 : TargetIDSetting::Unsupported;
1060 TargetIDStr.
split(Split,
':');
1061 bool SeenXnack =
false;
1062 bool SeenSramEcc =
false;
1064 for (
unsigned I = 1,
E = Split.size();
I !=
E; ++
I) {
1068 if (SeenXnack ||
XnackSetting == TargetIDSetting::Unsupported ||
1069 Sign == TargetIDSetting::Unsupported)
1076 if (SeenSramEcc ||
SramEccSetting == TargetIDSetting::Unsupported ||
1077 Sign == TargetIDSetting::Unsupported)
1101 return std::nullopt;
1105 return std::nullopt;
1111 if (!CPUName.
empty() && CPUName !=
"generic" &&
1113 return std::nullopt;
1121 return std::nullopt;
1123 return TargetID(Arch, TT, XnackSetting, SramEccSetting);
1126std::optional<TargetID>
1132 TargetIDDirective.
split(Parts,
'-', 4);
1133 if (Parts.
size() < 5)
1134 return std::nullopt;
1136 return parse(
Triple(Parts[0], Parts[1], Parts[2], Parts[3]), Parts[4]);
1143 if (SramEcc == TargetIDSetting::Off)
1145 else if (SramEcc == TargetIDSetting::On)
1148 if (Xnack == TargetIDSetting::Off)
1150 else if (Xnack == TargetIDSetting::On)
1181 return Arch ==
Other.Arch && XnackSetting ==
Other.XnackSetting &&
1182 SramEccSetting ==
Other.SramEccSetting && IsAMDHSA ==
Other.IsAMDHSA &&
1183 TargetTripleString ==
Other.TargetTripleString;
1188 return Provided == TargetIDSetting::Any ||
1189 Provided == TargetIDSetting::Unsupported || Provided == Requested;
1194 if (Arch !=
Other.Arch || XnackSetting !=
Other.XnackSetting ||
1195 SramEccSetting !=
Other.SramEccSetting)
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)
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")
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....
std::string toString() const
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...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
iterator find(StringRef Key)
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
constexpr bool empty() const
Check if the string is empty.
StringRef take_front(size_t N=1) const
Return a StringRef equal to 'this' but with only the first N elements remaining.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
bool consume_front(char Prefix)
Returns true if this StringRef has the given prefix and removes that prefix.
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
Triple - Helper class for working with autoconf configuration names.
LLVM_ABI bool isCompatibleWith(const Triple &Other) const
Test whether target triples are compatible.
This class implements an extremely fast bulk output stream that can only output to a stream.
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)
@ FIXED_NUM_SGPRS_FOR_INIT_BUG
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.
@ GK_AMDGCN_GENERIC_FIRST
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)
@ UNSUPPORTED_TARGET_FEATURE
@ INVALID_FEATURE_COMBINATION
LLVM_ABI GPUKind getGPUKindFromSubArch(Triple::SubArchType SubArch)
AMDGPU::TargetID TargetID
@ FEATURE_XNACK_ON_OFF_MODES
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
Instruction set architecture version.