56#define INTEL_GPU(NAME, KIND, MAJOR, MINOR, IGCA_TARGET, IGCA_FEATURE_SETS) \
57 if (Device == packDevice(MAJOR, MINOR)) \
59#include "llvm/TargetParser/IntelGPUTargetParser.def"
67 return (
"xe_" +
Twine(Major) +
"." +
Twine(Minor) +
"." +
Twine(Revision))
75#define INTEL_GPU(NAME, KIND, MAJOR, MINOR, IGCA_TARGET, IGCA_FEATURE_SETS) \
78#define INTEL_GPU_COMPAT(NAME, KIND, IGCA_TARGET, IGCA_FEATURE_SETS) \
81#include "llvm/TargetParser/IntelGPUTargetParser.def"
90 if (Name.starts_with(
"xe_")) {
91 auto [
Device, Revision] = Name.rsplit(
'.');
92 if (
Device.count(
'.') != 1 || Revision.empty() ||
99#define INTEL_GPU(NAME, KIND, MAJOR, MINOR, IGCA_TARGET, IGCA_FEATURE_SETS) \
100 .Case(NAME, GK_##KIND).Case("xe_" #MAJOR "." #MINOR, GK_##KIND)
101#define INTEL_GPU_COMPAT(NAME, KIND, IGCA_TARGET, IGCA_FEATURE_SETS) \
102 .Case(NAME, GK_##KIND)
103#define INTEL_GPU_ALIAS(NAME, KIND) .Case(NAME, GK_##KIND)
104#include "llvm/TargetParser/IntelGPUTargetParser.def"
112struct DeviceIGCATarget {
116constexpr DeviceIGCATarget DeviceIGCATargets[] = {
117#define INTEL_GPU(NAME, KIND, MAJOR, MINOR, IGCA_TARGET, IGCA_FEATURE_SETS) \
118 {IGCA_TARGET, IGCAFeatureSet::IGCA_FEATURE_SETS},
119#define INTEL_GPU_COMPAT(NAME, KIND, IGCA_TARGET, IGCA_FEATURE_SETS) \
120 {IGCA_TARGET, IGCAFeatureSet::IGCA_FEATURE_SETS},
121#include "llvm/TargetParser/IntelGPUTargetParser.def"
128struct IGCATargetNameEntry {
133#define IGCA_TARGET_NAMES(TARGET) \
134 {"igca_" #TARGET, TARGET, IGCAFeatureSet::Core}, \
135 {"igca_" #TARGET "c", TARGET, IGCAFeatureSet::Compute}, \
136 {"igca_" #TARGET "ca", TARGET, IGCAFeatureSet::ComputeExact}, \
137 {"igca_" #TARGET "r", TARGET, IGCAFeatureSet::Render}, \
138 {"igca_" #TARGET "ra", TARGET, IGCAFeatureSet::RenderExact},
139constexpr IGCATargetNameEntry IGCATargetNames[] = {
140#define INTEL_GPU(NAME, KIND, MAJOR, MINOR, IGCA_TARGET, IGCA_FEATURE_SETS) \
141 IGCA_TARGET_NAMES(IGCA_TARGET)
142#define INTEL_GPU_COMPAT(NAME, KIND, IGCA_TARGET, IGCA_FEATURE_SETS) \
143 IGCA_TARGET_NAMES(IGCA_TARGET)
144#include "llvm/TargetParser/IntelGPUTargetParser.def"
146#undef IGCA_TARGET_NAMES
157 if (RequestedFeatureSet == IGCAFeatureSet::Core)
160 if (RequestedFeatureSet == DeviceFeatureSet)
164 if (DeviceFeatureSet == IGCAFeatureSet::ComputeExact)
165 return RequestedFeatureSet == IGCAFeatureSet::Compute;
166 if (DeviceFeatureSet == IGCAFeatureSet::RenderExact)
167 return RequestedFeatureSet == IGCAFeatureSet::Render;
171bool llvm::IntelGPU::IGCATarget::isKnownIGCATarget(
uint32_t Packed) {
174 if (Packed & ReservedMask)
178 uint16_t RequestedTarget = uint16_t(Packed >> TargetShift);
179 auto RequestedFeatureSet =
IGCAFeatureSet(Packed & FeatureSetMask);
180 for (
const DeviceIGCATarget &
D : DeviceIGCATargets)
181 if (
D.Target == RequestedTarget &&
188 for (
const IGCATargetNameEntry &E : IGCATargetNames)
189 if (MaybeTarget == E.Name)
195 for (
const IGCATargetNameEntry &E : IGCATargetNames)
196 if (E.Target ==
T.getTarget() && E.FeatureSet ==
T.getFeatureSet())
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static constexpr uint32_t GPUIPMajorMask
static constexpr uint32_t GPUIPMajorShift
static constexpr uint32_t GPUIPRevisionMask
static constexpr uint32_t GPUIPMinorMask
static constexpr uint32_t packDevice(uint32_t Major, uint32_t Minor)
static constexpr uint32_t GPUIPMinorShift
static bool deviceCanRunIGCAFeatureSet(IGCAFeatureSet DeviceFeatureSet, IGCAFeatureSet RequestedFeatureSet)
static constexpr uint32_t GPUIPDeviceMask
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
Wrapper around an IGCA target's uint32_t representation, packed using the following format:
static constexpr IGCATarget invalid()
Represent a constant reference to a string, i.e.
A switch()-like statement whose cases are string literals.
Target - Wrapper for Target specific information.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVM_ABI GPUKind parseArch(StringRef Name)
LLVM_ABI std::string getNumericArchName(uint32_t GPUIPVersion)
IGCAFeatureSet
Represents an IGCA feature set, including whether or not it is exact.
LLVM_ABI IGCATarget parseIGCATarget(StringRef MaybeTarget)
Parse an IGCA target string such as "igca_20ca".
LLVM_ABI StringRef getIGCATargetName(IGCATarget Target)
LLVM_ABI StringRef getArchName(uint32_t GPUIPVersion)
GPUKind
Intel GPU architecture names, covering both physical devices and the compatibility names that stand f...
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
bool isDigit(char C)
Checks if character C is one of the 10 decimal digits.