19using namespace AMDGPU;
30constexpr GPUInfo R600GPUs[] = {
63constexpr GPUInfo AMDGCNGPUs[] = {
144 return A.Kind <
B.Kind;
147 if (
I == Table.
end() ||
I->Kind != Search.Kind)
173 if (
const auto *Entry = getArchEntry(AK, AMDGCNGPUs))
174 return Entry->CanonicalName;
179 if (
const auto *Entry = getArchEntry(AK, R600GPUs))
180 return Entry->CanonicalName;
185 for (
const auto &
C : AMDGCNGPUs) {
190 return AMDGPU::GPUKind::GK_NONE;
194 for (
const auto &
C : R600GPUs) {
199 return AMDGPU::GPUKind::GK_NONE;
203 if (
const auto *Entry = getArchEntry(AK, AMDGCNGPUs))
204 return Entry->Features;
209 if (
const auto *Entry = getArchEntry(AK, R600GPUs))
210 return Entry->Features;
216 for (
const auto &
C : AMDGCNGPUs)
221 for (
const auto &
C : R600GPUs)
227 if (AK == AMDGPU::GPUKind::GK_NONE) {
228 if (GPU ==
"generic-hsa")
230 if (GPU ==
"generic")
301 default:
return {0, 0, 0};
318 if (
T.isSPIRV() &&
T.getOS() == Triple::OSType::AMDHSA) {
320 Features[
"atomic-ds-pk-add-16-insts"] =
true;
321 Features[
"atomic-flat-pk-add-16-insts"] =
true;
322 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
323 Features[
"atomic-global-pk-add-bf16-inst"] =
true;
324 Features[
"atomic-fadd-rtn-insts"] =
true;
325 Features[
"ci-insts"] =
true;
326 Features[
"dot1-insts"] =
true;
327 Features[
"dot2-insts"] =
true;
328 Features[
"dot3-insts"] =
true;
329 Features[
"dot4-insts"] =
true;
330 Features[
"dot5-insts"] =
true;
331 Features[
"dot7-insts"] =
true;
332 Features[
"dot8-insts"] =
true;
333 Features[
"dot9-insts"] =
true;
334 Features[
"dot10-insts"] =
true;
335 Features[
"dot11-insts"] =
true;
336 Features[
"dl-insts"] =
true;
337 Features[
"16-bit-insts"] =
true;
338 Features[
"dpp"] =
true;
339 Features[
"gfx8-insts"] =
true;
340 Features[
"gfx9-insts"] =
true;
341 Features[
"gfx90a-insts"] =
true;
342 Features[
"gfx940-insts"] =
true;
343 Features[
"gfx10-insts"] =
true;
344 Features[
"gfx10-3-insts"] =
true;
345 Features[
"gfx11-insts"] =
true;
346 Features[
"gfx12-insts"] =
true;
347 Features[
"image-insts"] =
true;
348 Features[
"fp8-conversion-insts"] =
true;
349 Features[
"s-memrealtime"] =
true;
350 Features[
"s-memtime-inst"] =
true;
351 Features[
"gws"] =
true;
352 Features[
"fp8-insts"] =
true;
353 Features[
"fp8-conversion-insts"] =
true;
354 Features[
"atomic-ds-pk-add-16-insts"] =
true;
355 Features[
"mai-insts"] =
true;
356 Features[
"wavefrontsize32"] =
true;
357 Features[
"wavefrontsize64"] =
true;
358 }
else if (
T.isAMDGCN()) {
363 Features[
"ci-insts"] =
true;
364 Features[
"dot7-insts"] =
true;
365 Features[
"dot8-insts"] =
true;
366 Features[
"dot9-insts"] =
true;
367 Features[
"dot10-insts"] =
true;
368 Features[
"dot11-insts"] =
true;
369 Features[
"dl-insts"] =
true;
370 Features[
"atomic-ds-pk-add-16-insts"] =
true;
371 Features[
"atomic-flat-pk-add-16-insts"] =
true;
372 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
373 Features[
"atomic-global-pk-add-bf16-inst"] =
true;
374 Features[
"16-bit-insts"] =
true;
375 Features[
"dpp"] =
true;
376 Features[
"gfx8-insts"] =
true;
377 Features[
"gfx9-insts"] =
true;
378 Features[
"gfx10-insts"] =
true;
379 Features[
"gfx10-3-insts"] =
true;
380 Features[
"gfx11-insts"] =
true;
381 Features[
"gfx12-insts"] =
true;
382 Features[
"atomic-fadd-rtn-insts"] =
true;
383 Features[
"image-insts"] =
true;
384 Features[
"fp8-conversion-insts"] =
true;
394 Features[
"ci-insts"] =
true;
395 Features[
"dot5-insts"] =
true;
396 Features[
"dot7-insts"] =
true;
397 Features[
"dot8-insts"] =
true;
398 Features[
"dot9-insts"] =
true;
399 Features[
"dot10-insts"] =
true;
400 Features[
"dl-insts"] =
true;
401 Features[
"16-bit-insts"] =
true;
402 Features[
"dpp"] =
true;
403 Features[
"gfx8-insts"] =
true;
404 Features[
"gfx9-insts"] =
true;
405 Features[
"gfx10-insts"] =
true;
406 Features[
"gfx10-3-insts"] =
true;
407 Features[
"gfx11-insts"] =
true;
408 Features[
"atomic-fadd-rtn-insts"] =
true;
409 Features[
"image-insts"] =
true;
410 Features[
"gws"] =
true;
420 Features[
"ci-insts"] =
true;
421 Features[
"dot1-insts"] =
true;
422 Features[
"dot2-insts"] =
true;
423 Features[
"dot5-insts"] =
true;
424 Features[
"dot6-insts"] =
true;
425 Features[
"dot7-insts"] =
true;
426 Features[
"dot10-insts"] =
true;
427 Features[
"dl-insts"] =
true;
428 Features[
"16-bit-insts"] =
true;
429 Features[
"dpp"] =
true;
430 Features[
"gfx8-insts"] =
true;
431 Features[
"gfx9-insts"] =
true;
432 Features[
"gfx10-insts"] =
true;
433 Features[
"gfx10-3-insts"] =
true;
434 Features[
"image-insts"] =
true;
435 Features[
"s-memrealtime"] =
true;
436 Features[
"s-memtime-inst"] =
true;
437 Features[
"gws"] =
true;
441 Features[
"dot1-insts"] =
true;
442 Features[
"dot2-insts"] =
true;
443 Features[
"dot5-insts"] =
true;
444 Features[
"dot6-insts"] =
true;
445 Features[
"dot7-insts"] =
true;
446 Features[
"dot10-insts"] =
true;
451 Features[
"dl-insts"] =
true;
452 Features[
"ci-insts"] =
true;
453 Features[
"16-bit-insts"] =
true;
454 Features[
"dpp"] =
true;
455 Features[
"gfx8-insts"] =
true;
456 Features[
"gfx9-insts"] =
true;
457 Features[
"gfx10-insts"] =
true;
458 Features[
"image-insts"] =
true;
459 Features[
"s-memrealtime"] =
true;
460 Features[
"s-memtime-inst"] =
true;
461 Features[
"gws"] =
true;
466 Features[
"gfx940-insts"] =
true;
467 Features[
"fp8-insts"] =
true;
468 Features[
"fp8-conversion-insts"] =
true;
469 Features[
"atomic-ds-pk-add-16-insts"] =
true;
470 Features[
"atomic-flat-pk-add-16-insts"] =
true;
471 Features[
"atomic-global-pk-add-bf16-inst"] =
true;
472 Features[
"gfx90a-insts"] =
true;
473 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
474 Features[
"atomic-fadd-rtn-insts"] =
true;
475 Features[
"dot3-insts"] =
true;
476 Features[
"dot4-insts"] =
true;
477 Features[
"dot5-insts"] =
true;
478 Features[
"dot6-insts"] =
true;
479 Features[
"mai-insts"] =
true;
480 Features[
"dl-insts"] =
true;
481 Features[
"dot1-insts"] =
true;
482 Features[
"dot2-insts"] =
true;
483 Features[
"dot7-insts"] =
true;
484 Features[
"dot10-insts"] =
true;
485 Features[
"gfx9-insts"] =
true;
486 Features[
"gfx8-insts"] =
true;
487 Features[
"16-bit-insts"] =
true;
488 Features[
"dpp"] =
true;
489 Features[
"s-memrealtime"] =
true;
490 Features[
"ci-insts"] =
true;
491 Features[
"s-memtime-inst"] =
true;
492 Features[
"gws"] =
true;
495 Features[
"gfx90a-insts"] =
true;
496 Features[
"atomic-buffer-global-pk-add-f16-insts"] =
true;
497 Features[
"atomic-fadd-rtn-insts"] =
true;
500 Features[
"dot3-insts"] =
true;
501 Features[
"dot4-insts"] =
true;
502 Features[
"dot5-insts"] =
true;
503 Features[
"dot6-insts"] =
true;
504 Features[
"mai-insts"] =
true;
507 Features[
"dl-insts"] =
true;
508 Features[
"dot1-insts"] =
true;
509 Features[
"dot2-insts"] =
true;
510 Features[
"dot7-insts"] =
true;
511 Features[
"dot10-insts"] =
true;
519 Features[
"gfx9-insts"] =
true;
526 Features[
"gfx8-insts"] =
true;
527 Features[
"16-bit-insts"] =
true;
528 Features[
"dpp"] =
true;
529 Features[
"s-memrealtime"] =
true;
537 Features[
"ci-insts"] =
true;
542 Features[
"image-insts"] =
true;
543 Features[
"s-memtime-inst"] =
true;
544 Features[
"gws"] =
true;
582 bool IsWave32Capable =
false;
610 IsWave32Capable =
true;
616 return IsWave32Capable;
619std::pair<FeatureError, StringRef>
623 const bool IsNullGPU = GPU.
empty();
624 const bool HaveWave32 = Features.
count(
"wavefrontsize32");
625 const bool HaveWave64 = Features.
count(
"wavefrontsize64");
626 if (HaveWave32 && HaveWave64) {
628 "'wavefrontsize32' and 'wavefrontsize64' are mutually exclusive"};
630 if (HaveWave32 && !IsNullGPU && !IsWave32Capable) {
636 if (!HaveWave32 && !HaveWave64) {
638 IsWave32Capable ?
"wavefrontsize32" :
"wavefrontsize64";
639 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.