19using namespace AMDGPU;
30constexpr GPUInfo R600GPUs[] = {
63constexpr GPUInfo AMDGCNGPUs[] = {
147 return A.Kind <
B.Kind;
150 if (
I == Table.
end() ||
I->Kind != Search.Kind)
177 if (
const auto *Entry = getArchEntry(AK, AMDGCNGPUs))
178 return Entry->CanonicalName;
183 if (
const auto *Entry = getArchEntry(AK, R600GPUs))
184 return Entry->CanonicalName;
189 for (
const auto &
C : AMDGCNGPUs) {
194 return AMDGPU::GPUKind::GK_NONE;
198 for (
const auto &
C : R600GPUs) {
203 return AMDGPU::GPUKind::GK_NONE;
207 if (
const auto *Entry = getArchEntry(AK, AMDGCNGPUs))
208 return Entry->Features;
213 if (
const auto *Entry = getArchEntry(AK, R600GPUs))
214 return Entry->Features;
220 for (
const auto &
C : AMDGCNGPUs)
225 for (
const auto &
C : R600GPUs)
231 if (AK == AMDGPU::GPUKind::GK_NONE) {
232 if (GPU ==
"generic-hsa")
234 if (GPU ==
"generic")
308 default:
return {0, 0, 0};
325 if (
T.isSPIRV() &&
T.getOS() == Triple::OSType::AMDHSA) {
327 Features[
"atomic-ds-pk-add-16-insts"] =
true;
328 Features[
"atomic-flat-pk-add-16-insts"] =
true;
329 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
330 Features[
"atomic-global-pk-add-bf16-inst"] =
true;
331 Features[
"atomic-fadd-rtn-insts"] =
true;
332 Features[
"ci-insts"] =
true;
333 Features[
"dot1-insts"] =
true;
334 Features[
"dot2-insts"] =
true;
335 Features[
"dot3-insts"] =
true;
336 Features[
"dot4-insts"] =
true;
337 Features[
"dot5-insts"] =
true;
338 Features[
"dot7-insts"] =
true;
339 Features[
"dot8-insts"] =
true;
340 Features[
"dot9-insts"] =
true;
341 Features[
"dot10-insts"] =
true;
342 Features[
"dot11-insts"] =
true;
343 Features[
"dl-insts"] =
true;
344 Features[
"16-bit-insts"] =
true;
345 Features[
"dpp"] =
true;
346 Features[
"gfx8-insts"] =
true;
347 Features[
"gfx9-insts"] =
true;
348 Features[
"gfx90a-insts"] =
true;
349 Features[
"gfx940-insts"] =
true;
350 Features[
"gfx10-insts"] =
true;
351 Features[
"gfx10-3-insts"] =
true;
352 Features[
"gfx11-insts"] =
true;
353 Features[
"gfx12-insts"] =
true;
354 Features[
"image-insts"] =
true;
355 Features[
"fp8-conversion-insts"] =
true;
356 Features[
"s-memrealtime"] =
true;
357 Features[
"s-memtime-inst"] =
true;
358 Features[
"gws"] =
true;
359 Features[
"fp8-insts"] =
true;
360 Features[
"fp8-conversion-insts"] =
true;
361 Features[
"atomic-ds-pk-add-16-insts"] =
true;
362 Features[
"mai-insts"] =
true;
363 Features[
"wavefrontsize32"] =
true;
364 Features[
"wavefrontsize64"] =
true;
365 }
else if (
T.isAMDGCN()) {
371 Features[
"ci-insts"] =
true;
372 Features[
"dot7-insts"] =
true;
373 Features[
"dot8-insts"] =
true;
374 Features[
"dot9-insts"] =
true;
375 Features[
"dot10-insts"] =
true;
376 Features[
"dot11-insts"] =
true;
377 Features[
"dot12-insts"] =
true;
378 Features[
"dl-insts"] =
true;
379 Features[
"atomic-ds-pk-add-16-insts"] =
true;
380 Features[
"atomic-flat-pk-add-16-insts"] =
true;
381 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
382 Features[
"atomic-buffer-pk-add-bf16-inst"] =
true;
383 Features[
"atomic-global-pk-add-bf16-inst"] =
true;
384 Features[
"16-bit-insts"] =
true;
385 Features[
"dpp"] =
true;
386 Features[
"gfx8-insts"] =
true;
387 Features[
"gfx9-insts"] =
true;
388 Features[
"gfx10-insts"] =
true;
389 Features[
"gfx10-3-insts"] =
true;
390 Features[
"gfx11-insts"] =
true;
391 Features[
"gfx12-insts"] =
true;
392 Features[
"atomic-fadd-rtn-insts"] =
true;
393 Features[
"image-insts"] =
true;
394 Features[
"fp8-conversion-insts"] =
true;
405 Features[
"ci-insts"] =
true;
406 Features[
"dot5-insts"] =
true;
407 Features[
"dot7-insts"] =
true;
408 Features[
"dot8-insts"] =
true;
409 Features[
"dot9-insts"] =
true;
410 Features[
"dot10-insts"] =
true;
411 Features[
"dot12-insts"] =
true;
412 Features[
"dl-insts"] =
true;
413 Features[
"16-bit-insts"] =
true;
414 Features[
"dpp"] =
true;
415 Features[
"gfx8-insts"] =
true;
416 Features[
"gfx9-insts"] =
true;
417 Features[
"gfx10-insts"] =
true;
418 Features[
"gfx10-3-insts"] =
true;
419 Features[
"gfx11-insts"] =
true;
420 Features[
"atomic-fadd-rtn-insts"] =
true;
421 Features[
"image-insts"] =
true;
422 Features[
"gws"] =
true;
432 Features[
"ci-insts"] =
true;
433 Features[
"dot1-insts"] =
true;
434 Features[
"dot2-insts"] =
true;
435 Features[
"dot5-insts"] =
true;
436 Features[
"dot6-insts"] =
true;
437 Features[
"dot7-insts"] =
true;
438 Features[
"dot10-insts"] =
true;
439 Features[
"dl-insts"] =
true;
440 Features[
"16-bit-insts"] =
true;
441 Features[
"dpp"] =
true;
442 Features[
"gfx8-insts"] =
true;
443 Features[
"gfx9-insts"] =
true;
444 Features[
"gfx10-insts"] =
true;
445 Features[
"gfx10-3-insts"] =
true;
446 Features[
"image-insts"] =
true;
447 Features[
"s-memrealtime"] =
true;
448 Features[
"s-memtime-inst"] =
true;
449 Features[
"gws"] =
true;
453 Features[
"dot1-insts"] =
true;
454 Features[
"dot2-insts"] =
true;
455 Features[
"dot5-insts"] =
true;
456 Features[
"dot6-insts"] =
true;
457 Features[
"dot7-insts"] =
true;
458 Features[
"dot10-insts"] =
true;
463 Features[
"dl-insts"] =
true;
464 Features[
"ci-insts"] =
true;
465 Features[
"16-bit-insts"] =
true;
466 Features[
"dpp"] =
true;
467 Features[
"gfx8-insts"] =
true;
468 Features[
"gfx9-insts"] =
true;
469 Features[
"gfx10-insts"] =
true;
470 Features[
"image-insts"] =
true;
471 Features[
"s-memrealtime"] =
true;
472 Features[
"s-memtime-inst"] =
true;
473 Features[
"gws"] =
true;
476 Features[
"bitop3-insts"] =
true;
477 Features[
"fp6bf6-cvt-scale-insts"] =
true;
478 Features[
"fp4-cvt-scale-insts"] =
true;
479 Features[
"bf8-cvt-scale-insts"] =
true;
480 Features[
"fp8-cvt-scale-insts"] =
true;
481 Features[
"f16bf16-to-fp6bf6-cvt-scale-insts"] =
true;
482 Features[
"f32-to-f16bf16-cvt-sr-insts"] =
true;
483 Features[
"prng-inst"] =
true;
484 Features[
"permlane16-swap"] =
true;
485 Features[
"permlane32-swap"] =
true;
486 Features[
"ashr-pk-insts"] =
true;
487 Features[
"dot12-insts"] =
true;
488 Features[
"dot13-insts"] =
true;
489 Features[
"atomic-buffer-pk-add-bf16-inst"] =
true;
490 Features[
"gfx950-insts"] =
true;
495 Features[
"fp8-insts"] =
true;
496 Features[
"fp8-conversion-insts"] =
true;
498 Features[
"xf32-insts"] =
true;
501 Features[
"gfx940-insts"] =
true;
502 Features[
"atomic-ds-pk-add-16-insts"] =
true;
503 Features[
"atomic-flat-pk-add-16-insts"] =
true;
504 Features[
"atomic-global-pk-add-bf16-inst"] =
true;
505 Features[
"gfx90a-insts"] =
true;
506 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
507 Features[
"atomic-fadd-rtn-insts"] =
true;
508 Features[
"dot3-insts"] =
true;
509 Features[
"dot4-insts"] =
true;
510 Features[
"dot5-insts"] =
true;
511 Features[
"dot6-insts"] =
true;
512 Features[
"mai-insts"] =
true;
513 Features[
"dl-insts"] =
true;
514 Features[
"dot1-insts"] =
true;
515 Features[
"dot2-insts"] =
true;
516 Features[
"dot7-insts"] =
true;
517 Features[
"dot10-insts"] =
true;
518 Features[
"gfx9-insts"] =
true;
519 Features[
"gfx8-insts"] =
true;
520 Features[
"16-bit-insts"] =
true;
521 Features[
"dpp"] =
true;
522 Features[
"s-memrealtime"] =
true;
523 Features[
"ci-insts"] =
true;
524 Features[
"s-memtime-inst"] =
true;
525 Features[
"gws"] =
true;
528 Features[
"gfx90a-insts"] =
true;
529 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
530 Features[
"atomic-fadd-rtn-insts"] =
true;
533 Features[
"dot3-insts"] =
true;
534 Features[
"dot4-insts"] =
true;
535 Features[
"dot5-insts"] =
true;
536 Features[
"dot6-insts"] =
true;
537 Features[
"mai-insts"] =
true;
540 Features[
"dl-insts"] =
true;
541 Features[
"dot1-insts"] =
true;
542 Features[
"dot2-insts"] =
true;
543 Features[
"dot7-insts"] =
true;
544 Features[
"dot10-insts"] =
true;
552 Features[
"gfx9-insts"] =
true;
559 Features[
"gfx8-insts"] =
true;
560 Features[
"16-bit-insts"] =
true;
561 Features[
"dpp"] =
true;
562 Features[
"s-memrealtime"] =
true;
570 Features[
"ci-insts"] =
true;
575 Features[
"image-insts"] =
true;
576 Features[
"s-memtime-inst"] =
true;
577 Features[
"gws"] =
true;
615 bool IsWave32Capable =
false;
644 IsWave32Capable =
true;
650 return IsWave32Capable;
653std::pair<FeatureError, StringRef>
657 const bool IsNullGPU = GPU.
empty();
658 const bool HaveWave32 = Features.
count(
"wavefrontsize32");
659 const bool HaveWave64 = Features.
count(
"wavefrontsize64");
660 if (HaveWave32 && HaveWave64) {
662 "'wavefrontsize32' and 'wavefrontsize64' are mutually exclusive"};
664 if (HaveWave32 && !IsNullGPU && !IsWave32Capable) {
670 if (!HaveWave32 && !HaveWave64) {
672 IsWave32Capable ?
"wavefrontsize32" :
"wavefrontsize64";
673 Features.
insert(std::make_pair(DefaultWaveSizeFeature,
true));
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isWave32Capable(StringRef GPU, const Triple &T)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
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",...
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.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
Triple - Helper class for working with autoconf configuration names.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
StringRef getArchNameR600(GPUKind AK)
GPUKind
GPU kinds supported by the AMDGPU target.
StringRef getCanonicalArchName(const Triple &T, StringRef Arch)
void fillValidArchListR600(SmallVectorImpl< StringRef > &Values)
StringRef getArchFamilyNameAMDGCN(GPUKind AK)
IsaVersion getIsaVersion(StringRef GPU)
void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Fills Features map with default values for given target GPU.
std::pair< FeatureError, StringRef > insertWaveSizeFeature(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Inserts wave size feature for given GPU into features map.
void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values)
GPUKind parseArchAMDGCN(StringRef CPU)
@ UNSUPPORTED_TARGET_FEATURE
@ INVALID_FEATURE_COMBINATION
@ FEATURE_FAST_DENORMAL_F32
StringRef getArchNameAMDGCN(GPUKind AK)
unsigned getArchAttrAMDGCN(GPUKind AK)
unsigned getArchAttrR600(GPUKind AK)
GPUKind parseArchR600(StringRef CPU)
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
Instruction set architecture version.