LLVM 23.0.0git
AMDGPUTargetParser.h
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
13#ifndef LLVM_TARGETPARSER_AMDGPUTARGETPARSER_H
14#define LLVM_TARGETPARSER_AMDGPUTARGETPARSER_H
15
16#include "llvm/ADT/StringMap.h"
17#include "llvm/ADT/StringRef.h"
19#include <cstdint>
20#include <utility>
21
22namespace llvm {
23
24template <typename T> class SmallVectorImpl;
25class Triple;
26
27namespace AMDGPU {
28
29/// GPU kinds supported by the AMDGPU target.
31 // Not specified processor.
33
34#define R600_GPU(NAME, ENUM, FEATURES) ENUM,
35#define AMDGCN_GPU(NAME, ENUM, ISAVERSION, FEATURES) ENUM,
36#include "AMDGPUTargetParser.def"
37
38 GK_AMDGCN_GENERIC_FIRST = GK_GFX9_GENERIC,
39 GK_AMDGCN_GENERIC_LAST = GK_GFX12_5_GENERIC,
40};
41
42/// Instruction set architecture version.
43struct IsaVersion {
44 unsigned Major;
45 unsigned Minor;
46 unsigned Stepping;
47};
48
49// This isn't comprehensive for now, just things that are needed from the
50// frontend driver.
53
54 // These features only exist for r600, and are implied true for amdgcn.
55 FEATURE_FMA = 1 << 1,
56 FEATURE_LDEXP = 1 << 2,
57 FEATURE_FP64 = 1 << 3,
58
59 // Common features.
62
63 // Wavefront 32 is available.
65
66 // Xnack is available.
67 FEATURE_XNACK = 1 << 7,
68
69 // Sram-ecc is available.
71
72 // WGP mode is supported.
73 FEATURE_WGP = 1 << 9,
74
75 // Xnack is available by default
77};
78
84
86
94
95LLVM_ABI void fillValidArchListAMDGCN(SmallVectorImpl<StringRef> &Values);
96LLVM_ABI void fillValidArchListR600(SmallVectorImpl<StringRef> &Values);
97
98LLVM_ABI IsaVersion getIsaVersion(StringRef GPU);
99
100/// Fills Features map with default values for given target GPU.
101/// \p Features contains overriding target features and this function returns
102/// default target features with entries overridden by \p Features.
103LLVM_ABI std::pair<FeatureError, StringRef>
104fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, StringMap<bool> &Features);
105} // namespace AMDGPU
106
107} // namespace llvm
108
109#endif
This file defines the StringMap class.
#define LLVM_ABI
Definition Compiler.h:213
#define T
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
LLVM_ABI StringRef getArchNameR600(GPUKind AK)
GPUKind
GPU kinds supported by the AMDGPU target.
LLVM_ABI StringRef getCanonicalArchName(const Triple &T, StringRef Arch)
LLVM_ABI void fillValidArchListR600(SmallVectorImpl< StringRef > &Values)
LLVM_ABI StringRef getArchFamilyNameAMDGCN(GPUKind AK)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
LLVM_ABI void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values)
LLVM_ABI GPUKind parseArchAMDGCN(StringRef CPU)
LLVM_ABI std::pair< FeatureError, StringRef > fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Fills Features map with default values for given target GPU.
LLVM_ABI StringRef getArchNameAMDGCN(GPUKind AK)
LLVM_ABI unsigned getArchAttrAMDGCN(GPUKind AK)
LLVM_ABI unsigned getArchAttrR600(GPUKind AK)
LLVM_ABI GPUKind parseArchR600(StringRef CPU)
This is an optimization pass for GlobalISel generic memory operations.
Instruction set architecture version.