LLVM 24.0.0git
llvm::AMDGPU::TargetID Class Reference

#include "llvm/TargetParser/AMDGPUTargetParser.h"

Public Member Functions

 TargetID (GPUKind Arch, const Triple &TT, TargetIDSetting XnackSetting, TargetIDSetting SramEccSetting)
 TargetID (const Triple &TT, StringRef TargetIDStr)
 Construct a TargetID from a triple TT and the processor+features string e.g.
 ~TargetID ()=default
bool isXnackSupported () const
bool isXnackOnOrAny () const
bool isXnackOnOrOff () const
TargetIDSetting getXnackSetting () const
void setXnackSetting (TargetIDSetting NewXnackSetting)
 Sets xnack setting to NewXnackSetting.
bool isSramEccSupported () const
bool isSramEccOnOrAny () const
bool isSramEccOnOrOff () const
TargetIDSetting getSramEccSetting () const
void setSramEccSetting (TargetIDSetting NewSramEccSetting)
 Sets sramecc setting to NewSramEccSetting.
GPUKind getGPUKind () const
StringRef getTargetTripleString () const
bool isAMDHSA () const
bool isEquivalent (const TargetID &Other) const
 Returns true if Other denotes the same target as *this, i.e.
bool providesFor (const TargetID &Other) const
 Returns true if a device image for *this can provide the device code for a request for Other.
void print (raw_ostream &OS) const
std::string toString () const
void printCanonicalTargetIDString (raw_ostream &OS) const
 Print the canonical processor name followed by any explicit xnack and sramecc feature modifiers (e.g.
std::string getCanonicalFeatureString () const
bool operator== (const TargetID &Other) const
bool operator!= (const TargetID &Other) const

Static Public Member Functions

static std::optional< TargetIDparse (const Triple &TT, StringRef ProcAndFeatures)
 Parse and validate a TargetID for triple TT from the processor+features string ProcAndFeatures (e.g.
static std::optional< TargetIDparseTargetIDString (StringRef TargetIDDirective)
 Parse and validate a TargetID from a full "<triple>-<processor>:<features>" directive string.

Detailed Description

Definition at line 172 of file AMDGPUTargetParser.h.

Constructor & Destructor Documentation

◆ TargetID() [1/2]

TargetID::TargetID ( GPUKind Arch,
const Triple & TT,
TargetIDSetting XnackSetting,
TargetIDSetting SramEccSetting )

Definition at line 1015 of file AMDGPUTargetParser.cpp.

Referenced by isEquivalent(), operator!=(), operator==(), providesFor(), and TargetID().

◆ TargetID() [2/2]

TargetID::TargetID ( const Triple & TT,
StringRef TargetIDStr )

Construct a TargetID from a triple TT and the processor+features string e.g.

"gfx90a", "gfx90a:xnack+:sramecc-", "".

Definition at line 1090 of file AMDGPUTargetParser.cpp.

References computeTargetIDFeatures(), getGPUKindFromTargetID(), TargetID(), and llvm::AMDGPU::Unsupported.

◆ ~TargetID()

llvm::AMDGPU::TargetID::~TargetID ( )
default

Member Function Documentation

◆ getCanonicalFeatureString()

std::string TargetID::getCanonicalFeatureString ( ) const
Returns
the canonical processor name followed by any explicit xnack and sramecc feature modifiers order (e.g. "gfx908:sramecc-:xnack+"), without the triple prefix.

Definition at line 1173 of file AMDGPUTargetParser.cpp.

References printCanonicalTargetIDString().

◆ getGPUKind()

GPUKind llvm::AMDGPU::TargetID::getGPUKind ( ) const
inline

Definition at line 244 of file AMDGPUTargetParser.h.

Referenced by createOccupancy().

◆ getSramEccSetting()

TargetIDSetting llvm::AMDGPU::TargetID::getSramEccSetting ( ) const
inline
Returns
The current sramecc TargetIDSetting, possible options are "Unsupported", "Any", "Off", and "On".

Definition at line 237 of file AMDGPUTargetParser.h.

Referenced by isSramEccOnOrOff(), print(), and printCanonicalTargetIDString().

◆ getTargetTripleString()

StringRef llvm::AMDGPU::TargetID::getTargetTripleString ( ) const
inline

Definition at line 246 of file AMDGPUTargetParser.h.

Referenced by isEquivalent(), and providesFor().

◆ getXnackSetting()

TargetIDSetting llvm::AMDGPU::TargetID::getXnackSetting ( ) const
inline
Returns
The current xnack TargetIDSetting, possible options are "Unsupported", "Any", "Off", and "On".

Definition at line 210 of file AMDGPUTargetParser.h.

Referenced by isXnackOnOrOff(), print(), and printCanonicalTargetIDString().

◆ isAMDHSA()

bool llvm::AMDGPU::TargetID::isAMDHSA ( ) const
inline
Returns
True if this is an AMDHSA target.

Definition at line 249 of file AMDGPUTargetParser.h.

◆ isEquivalent()

bool TargetID::isEquivalent ( const TargetID & Other) const

Returns true if Other denotes the same target as *this, i.e.

the same processor and xnack/sramecc settings on a compatible triple. This is a semantic equality that looks through spelling differences.

Definition at line 1192 of file AMDGPUTargetParser.cpp.

References getTargetTripleString(), llvm::Triple::isCompatibleWith(), llvm::AMDGPU::Other, and TargetID().

Referenced by llvm::object::areTargetsEquivalent().

◆ isSramEccOnOrAny()

bool llvm::AMDGPU::TargetID::isSramEccOnOrAny ( ) const
inline
Returns
True if the current sramecc setting is "On" or "Any".

Definition at line 223 of file AMDGPUTargetParser.h.

◆ isSramEccOnOrOff()

bool llvm::AMDGPU::TargetID::isSramEccOnOrOff ( ) const
inline
Returns
True if current sramecc setting is "On" or "Off", false otherwise.

Definition at line 230 of file AMDGPUTargetParser.h.

References getSramEccSetting().

◆ isSramEccSupported()

bool llvm::AMDGPU::TargetID::isSramEccSupported ( ) const
inline
Returns
True if the current sramecc setting is not "Unsupported".

Definition at line 218 of file AMDGPUTargetParser.h.

Referenced by llvm::AMDGPU::createAMDGPUTargetID().

◆ isXnackOnOrAny()

bool llvm::AMDGPU::TargetID::isXnackOnOrAny ( ) const
inline
Returns
True if the current xnack setting is "On" or "Any".

Definition at line 196 of file AMDGPUTargetParser.h.

Referenced by llvm::AMDGPUAsmPrinter::runOnMachineFunction().

◆ isXnackOnOrOff()

bool llvm::AMDGPU::TargetID::isXnackOnOrOff ( ) const
inline
Returns
True if current xnack setting is "On" or "Off", false otherwise.

Definition at line 203 of file AMDGPUTargetParser.h.

References getXnackSetting().

◆ isXnackSupported()

bool llvm::AMDGPU::TargetID::isXnackSupported ( ) const
inline
Returns
True if the current xnack setting is not "Unsupported".

Definition at line 191 of file AMDGPUTargetParser.h.

◆ operator!=()

bool llvm::AMDGPU::TargetID::operator!= ( const TargetID & Other) const
inline

Definition at line 288 of file AMDGPUTargetParser.h.

References llvm::AMDGPU::Other, and TargetID().

◆ operator==()

bool TargetID::operator== ( const TargetID & Other) const

Definition at line 1180 of file AMDGPUTargetParser.cpp.

References llvm::AMDGPU::Other, and TargetID().

◆ parse()

std::optional< TargetID > TargetID::parse ( const Triple & TT,
StringRef ProcAndFeatures )
static

Parse and validate a TargetID for triple TT from the processor+features string ProcAndFeatures (e.g.

"gfx90a", "gfx90a:xnack+:sramecc-", ""). Returns std::nullopt if the triple is not AMDGCN, the processor is unrecognized, or a feature modifier is invalid for the processor.

Definition at line 1098 of file AMDGPUTargetParser.cpp.

References computeTargetIDFeatures(), llvm::StringRef::empty(), getGPUKindFromTargetID(), llvm::AMDGPU::isCPUValidForSubArch(), llvm::Triple::NoSubArch, and llvm::StringRef::split().

Referenced by parseTargetIDString().

◆ parseTargetIDString()

std::optional< TargetID > TargetID::parseTargetIDString ( StringRef TargetIDDirective)
static

Parse and validate a TargetID from a full "<triple>-<processor>:<features>" directive string.

Definition at line 1127 of file AMDGPUTargetParser.cpp.

References parse(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and llvm::StringRef::split().

◆ print()

void TargetID::print ( raw_ostream & OS) const

◆ printCanonicalTargetIDString()

void TargetID::printCanonicalTargetIDString ( raw_ostream & OS) const

Print the canonical processor name followed by any explicit xnack and sramecc feature modifiers (e.g.

"gfx908:sramecc-:xnack+"), without the triple prefix.

Definition at line 1168 of file AMDGPUTargetParser.cpp.

References llvm::AMDGPU::getArchNameAMDGCN(), getSramEccSetting(), getXnackSetting(), and printFeatureModifiers().

Referenced by getCanonicalFeatureString().

◆ providesFor()

bool TargetID::providesFor ( const TargetID & Other) const

Returns true if a device image for *this can provide the device code for a request for Other.

This is directional and models logical-linking compatibility.

Definition at line 1202 of file AMDGPUTargetParser.cpp.

References featureProvidesFor(), llvm::AMDGPU::getMajorSubArch(), llvm::AMDGPU::getSubArch(), getTargetTripleString(), llvm::AMDGPU::GK_NONE, llvm::Triple::isCompatibleWith(), llvm::AMDGPU::Other, and TargetID().

Referenced by llvm::object::areTargetsCompatible().

◆ setSramEccSetting()

void llvm::AMDGPU::TargetID::setSramEccSetting ( TargetIDSetting NewSramEccSetting)
inline

Sets sramecc setting to NewSramEccSetting.

Definition at line 240 of file AMDGPUTargetParser.h.

Referenced by llvm::AMDGPU::createAMDGPUTargetID().

◆ setXnackSetting()

void llvm::AMDGPU::TargetID::setXnackSetting ( TargetIDSetting NewXnackSetting)
inline

Sets xnack setting to NewXnackSetting.

Definition at line 213 of file AMDGPUTargetParser.h.

Referenced by llvm::AMDGPU::createAMDGPUTargetID().

◆ toString()

std::string TargetID::toString ( ) const

The documentation for this class was generated from the following files: