LLVM 24.0.0git
llvm::AMDGPU::IsaInfo Namespace Reference

Enumerations

enum  { FIXED_NUM_SGPRS_FOR_INIT_BUG = AMDGPU::FIXED_NUM_SGPRS_FOR_INIT_BUG , TRAP_NUM_SGPRS = 16 }

Functions

unsigned getInstCacheLineSize (const MCSubtargetInfo &STI)
unsigned getWavefrontSize (const MCSubtargetInfo &STI)
unsigned getLocalMemorySize (const MCSubtargetInfo &STI)
unsigned getAddressableLocalMemorySize (const MCSubtargetInfo &STI)
unsigned getEUsPerCU (const MCSubtargetInfo &STI)
unsigned getMaxWorkGroupsPerCU (const MCSubtargetInfo &STI, unsigned FlatWorkGroupSize)
unsigned getMinWavesPerEU (const MCSubtargetInfo &STI)
unsigned getMaxWavesPerEU (const MCSubtargetInfo &STI)
unsigned getWavesPerEUForWorkGroup (const MCSubtargetInfo &STI, unsigned FlatWorkGroupSize)
unsigned getMinFlatWorkGroupSize (const MCSubtargetInfo &STI)
unsigned getWavesPerWorkGroup (const MCSubtargetInfo &STI, unsigned FlatWorkGroupSize)
unsigned getSGPREncodingGranule (const MCSubtargetInfo &STI)
static unsigned getSGPRTrapHandlerReserve (const MCSubtargetInfo &STI)
static unsigned getSGPRBudgetPerWave (unsigned TotalNumSGPRs, unsigned WavesPerEU, unsigned TrapReserve, unsigned Granule)
unsigned getMinNumSGPRs (const MCSubtargetInfo &STI, unsigned WavesPerEU)
unsigned getMaxNumSGPRs (const MCSubtargetInfo &STI, unsigned WavesPerEU, bool Addressable)
bool isSGPROccupancyLimited (const MCSubtargetInfo &STI)
unsigned getNumExtraSGPRs (const MCSubtargetInfo &STI, bool VCCUsed, bool FlatScrUsed, bool XNACKUsed)
unsigned getNumExtraSGPRs (const MCSubtargetInfo &STI, bool VCCUsed, bool FlatScrUsed)
static unsigned getGranulatedNumRegisterBlocks (unsigned NumRegs, unsigned Granule)
unsigned getNumSGPRBlocks (const MCSubtargetInfo &STI, unsigned NumSGPRs)
unsigned getVGPRAllocGranule (const MCSubtargetInfo &STI, unsigned DynamicVGPRBlockSize, std::optional< bool > EnableWavefrontSize32)
unsigned getVGPREncodingGranule (const MCSubtargetInfo &STI, std::optional< bool > EnableWavefrontSize32)
unsigned getArchVGPRAllocGranule ()
 For subtargets with a unified VGPR file and mixed ArchVGPR/AGPR usage, returns the allocation granule for ArchVGPRs.
unsigned getTotalNumVGPRs (const MCSubtargetInfo &STI)
unsigned getAddressableNumArchVGPRs (const MCSubtargetInfo &STI)
unsigned getAddressableNumVGPRs (const MCSubtargetInfo &STI, unsigned DynamicVGPRBlockSize)
unsigned getNumWavesPerEUWithNumVGPRs (const MCSubtargetInfo &STI, unsigned NumVGPRs, unsigned DynamicVGPRBlockSize)
unsigned getNumWavesPerEUWithNumVGPRs (unsigned NumVGPRs, unsigned Granule, unsigned MaxWaves, unsigned TotalNumVGPRs)
unsigned getOccupancyWithNumSGPRs (unsigned SGPRs, unsigned MaxWaves, unsigned TotalNumSGPRs, unsigned Granule, unsigned TrapReserve)
unsigned getOccupancyWithNumSGPRs (const MCSubtargetInfo &STI, unsigned SGPRs)
unsigned getMinNumVGPRs (const MCSubtargetInfo &STI, unsigned WavesPerEU, unsigned DynamicVGPRBlockSize)
unsigned getMaxNumVGPRs (const MCSubtargetInfo &STI, unsigned WavesPerEU, unsigned DynamicVGPRBlockSize)
unsigned getEncodedNumVGPRBlocks (const MCSubtargetInfo &STI, unsigned NumVGPRs, std::optional< bool > EnableWavefrontSize32)
unsigned getAllocatedNumVGPRBlocks (const MCSubtargetInfo &STI, unsigned NumVGPRs, unsigned DynamicVGPRBlockSize, std::optional< bool > EnableWavefrontSize32)
bool targetIDSettingsConflict (TargetIDSetting Lhs, TargetIDSetting Rhs)
 Returns true if Lhs and Rhs are incompatible (both specific but different).
constexpr unsigned getMaxFlatWorkGroupSize ()

Variables

static constexpr unsigned MaxDynamicVGPRBlocks = 8
 Maximum number of VGPR blocks that can be allocated in dynamic VGPR mode.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FIXED_NUM_SGPRS_FOR_INIT_BUG 
TRAP_NUM_SGPRS 

Definition at line 161 of file AMDGPUBaseInfo.h.

Function Documentation

◆ getAddressableLocalMemorySize()

unsigned llvm::AMDGPU::IsaInfo::getAddressableLocalMemorySize ( const MCSubtargetInfo & STI)
Returns
Maximum addressable local memory size in bytes for given subtarget STI.

Definition at line 1191 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getFeatureBits(), and llvm::FeatureBitset::test().

Referenced by getLocalMemorySize().

◆ getAddressableNumArchVGPRs()

unsigned llvm::AMDGPU::IsaInfo::getAddressableNumArchVGPRs ( const MCSubtargetInfo & STI)
Returns
Addressable number of architectural VGPRs for a given subtarget STI.

Definition at line 1421 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getFeatureBits(), and llvm::FeatureBitset::test().

Referenced by llvm::GCNSubtarget::getAddressableNumArchVGPRs(), and getAddressableNumVGPRs().

◆ getAddressableNumVGPRs()

unsigned llvm::AMDGPU::IsaInfo::getAddressableNumVGPRs ( const MCSubtargetInfo & STI,
unsigned DynamicVGPRBlockSize )

◆ getAllocatedNumVGPRBlocks()

unsigned llvm::AMDGPU::IsaInfo::getAllocatedNumVGPRBlocks ( const MCSubtargetInfo & STI,
unsigned NumVGPRs,
unsigned DynamicVGPRBlockSize,
std::optional< bool > EnableWavefrontSize32 = std::nullopt )
Returns
Number of VGPR blocks that need to be allocated for the given subtarget STI when NumVGPRs are used.

Definition at line 1539 of file AMDGPUBaseInfo.cpp.

References getGranulatedNumRegisterBlocks(), and getVGPRAllocGranule().

Referenced by llvm::GCNSchedStage::shouldRevertScheduling().

◆ getArchVGPRAllocGranule()

unsigned llvm::AMDGPU::IsaInfo::getArchVGPRAllocGranule ( )

For subtargets with a unified VGPR file and mixed ArchVGPR/AGPR usage, returns the allocation granule for ArchVGPRs.

Definition at line 1408 of file AMDGPUBaseInfo.cpp.

Referenced by llvm::GCNRegPressure::getUnifiedVGPRNum().

◆ getEncodedNumVGPRBlocks()

unsigned llvm::AMDGPU::IsaInfo::getEncodedNumVGPRBlocks ( const MCSubtargetInfo & STI,
unsigned NumVGPRs,
std::optional< bool > EnableWavefrontSize32 = std::nullopt )
Returns
Number of VGPR blocks needed for given subtarget STI when NumVGPRs are used. We actually return the number of blocks -1, since that's what we encode.

For subtargets which support it, EnableWavefrontSize32 should match the ENABLE_WAVEFRONT_SIZE32 kernel descriptor field.

Definition at line 1532 of file AMDGPUBaseInfo.cpp.

References getGranulatedNumRegisterBlocks(), and getVGPREncodingGranule().

◆ getEUsPerCU()

unsigned llvm::AMDGPU::IsaInfo::getEUsPerCU ( const MCSubtargetInfo & STI)
Returns
Number of execution units per compute unit for given subtarget STI.

Definition at line 1203 of file AMDGPUBaseInfo.cpp.

References assert(), llvm::MCSubtargetInfo::getFeatureBits(), llvm::AMDGPU::isGFX10Plus(), llvm::AMDGPU::isGFX1250(), and llvm::FeatureBitset::test().

Referenced by llvm::GCNSubtarget::GCNSubtarget(), getMaxWorkGroupsPerCU(), and getWavesPerEUForWorkGroup().

◆ getGranulatedNumRegisterBlocks()

unsigned llvm::AMDGPU::IsaInfo::getGranulatedNumRegisterBlocks ( unsigned NumRegs,
unsigned Granule )
static

◆ getInstCacheLineSize()

unsigned llvm::AMDGPU::IsaInfo::getInstCacheLineSize ( const MCSubtargetInfo & STI)
Returns
Instruction cache line size in bytes for given subtarget STI.

Definition at line 1162 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getFeatureBits(), and llvm::FeatureBitset::test().

◆ getLocalMemorySize()

unsigned llvm::AMDGPU::IsaInfo::getLocalMemorySize ( const MCSubtargetInfo & STI)

◆ getMaxFlatWorkGroupSize()

unsigned llvm::AMDGPU::IsaInfo::getMaxFlatWorkGroupSize ( )
constexpr

◆ getMaxNumSGPRs()

unsigned llvm::AMDGPU::IsaInfo::getMaxNumSGPRs ( const MCSubtargetInfo & STI,
unsigned WavesPerEU,
bool Addressable )

◆ getMaxNumVGPRs()

unsigned llvm::AMDGPU::IsaInfo::getMaxNumVGPRs ( const MCSubtargetInfo & STI,
unsigned WavesPerEU,
unsigned DynamicVGPRBlockSize )
Returns
Maximum number of VGPRs that meets given number of waves per execution unit requirement for given subtarget STI.

Definition at line 1516 of file AMDGPUBaseInfo.cpp.

References llvm::alignDown(), assert(), getAddressableNumVGPRs(), getTotalNumVGPRs(), and getVGPRAllocGranule().

Referenced by llvm::GCNSubtarget::getMaxNumVGPRs().

◆ getMaxWavesPerEU()

unsigned llvm::AMDGPU::IsaInfo::getMaxWavesPerEU ( const MCSubtargetInfo & STI)
Returns
Maximum number of waves per execution unit for given subtarget STI without any kind of limitation.

Definition at line 1244 of file AMDGPUBaseInfo.cpp.

References llvm::AMDGPU::hasGFX10_3Insts(), llvm::AMDGPU::isGFX10Plus(), and llvm::AMDGPU::isGFX90A().

Referenced by createOccupancy(), llvm::GCNSubtarget::GCNSubtarget(), getMaxWorkGroupsPerCU(), getMinNumSGPRs(), getMinNumVGPRs(), getNumWavesPerEUWithNumVGPRs(), and getOccupancyWithNumSGPRs().

◆ getMaxWorkGroupsPerCU()

unsigned llvm::AMDGPU::IsaInfo::getMaxWorkGroupsPerCU ( const MCSubtargetInfo & STI,
unsigned FlatWorkGroupSize )

◆ getMinFlatWorkGroupSize()

unsigned llvm::AMDGPU::IsaInfo::getMinFlatWorkGroupSize ( const MCSubtargetInfo & STI)
Returns
Minimum flat work group size for given subtarget STI.

Definition at line 1259 of file AMDGPUBaseInfo.cpp.

Referenced by llvm::GCNSubtarget::getMinFlatWorkGroupSize(), and llvm::R600Subtarget::getMinFlatWorkGroupSize().

◆ getMinNumSGPRs()

unsigned llvm::AMDGPU::IsaInfo::getMinNumSGPRs ( const MCSubtargetInfo & STI,
unsigned WavesPerEU )

◆ getMinNumVGPRs()

unsigned llvm::AMDGPU::IsaInfo::getMinNumVGPRs ( const MCSubtargetInfo & STI,
unsigned WavesPerEU,
unsigned DynamicVGPRBlockSize )
Returns
Minimum number of VGPRs that meets given number of waves per execution unit requirement for given subtarget STI.

Definition at line 1481 of file AMDGPUBaseInfo.cpp.

References llvm::alignDown(), assert(), getAddressableNumVGPRs(), getMaxWavesPerEU(), getMinNumVGPRs(), getNumWavesPerEUWithNumVGPRs(), getTotalNumVGPRs(), and getVGPRAllocGranule().

Referenced by getMinNumVGPRs(), and llvm::GCNSubtarget::getMinNumVGPRs().

◆ getMinWavesPerEU()

unsigned llvm::AMDGPU::IsaInfo::getMinWavesPerEU ( const MCSubtargetInfo & STI)
Returns
Minimum number of waves per execution unit for given subtarget STI.

Definition at line 1242 of file AMDGPUBaseInfo.cpp.

Referenced by llvm::GCNSubtarget::getMinWavesPerEU(), and llvm::R600Subtarget::getMinWavesPerEU().

◆ getNumExtraSGPRs() [1/2]

unsigned llvm::AMDGPU::IsaInfo::getNumExtraSGPRs ( const MCSubtargetInfo & STI,
bool VCCUsed,
bool FlatScrUsed )
Returns
Number of extra SGPRs implicitly required by given subtarget STI when the given special registers are used. XNACK is inferred from STI.

Definition at line 1354 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getFeatureBits(), getNumExtraSGPRs(), and llvm::FeatureBitset::test().

◆ getNumExtraSGPRs() [2/2]

unsigned llvm::AMDGPU::IsaInfo::getNumExtraSGPRs ( const MCSubtargetInfo & STI,
bool VCCUsed,
bool FlatScrUsed,
bool XNACKUsed )
Returns
Number of extra SGPRs implicitly required by given subtarget STI when the given special registers are used.

Definition at line 1329 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getCPU(), llvm::MCSubtargetInfo::getFeatureBits(), llvm::AMDGPU::getIsaVersion(), llvm::FeatureBitset::test(), and llvm::Version.

Referenced by getNumExtraSGPRs().

◆ getNumSGPRBlocks()

unsigned llvm::AMDGPU::IsaInfo::getNumSGPRBlocks ( const MCSubtargetInfo & STI,
unsigned NumSGPRs )
Returns
Number of SGPR blocks needed for given subtarget STI when NumSGPRs are used. NumSGPRs should already include any special register counts.

Definition at line 1365 of file AMDGPUBaseInfo.cpp.

References getGranulatedNumRegisterBlocks(), and getSGPREncodingGranule().

◆ getNumWavesPerEUWithNumVGPRs() [1/2]

unsigned llvm::AMDGPU::IsaInfo::getNumWavesPerEUWithNumVGPRs ( const MCSubtargetInfo & STI,
unsigned NumVGPRs,
unsigned DynamicVGPRBlockSize )
Returns
Number of waves reachable for a given NumVGPRs usage for given subtarget STI.

Definition at line 1442 of file AMDGPUBaseInfo.cpp.

References getMaxWavesPerEU(), getNumWavesPerEUWithNumVGPRs(), getTotalNumVGPRs(), and getVGPRAllocGranule().

Referenced by getMinNumVGPRs(), getNumWavesPerEUWithNumVGPRs(), and llvm::GCNSubtarget::getOccupancyWithNumVGPRs().

◆ getNumWavesPerEUWithNumVGPRs() [2/2]

unsigned llvm::AMDGPU::IsaInfo::getNumWavesPerEUWithNumVGPRs ( unsigned NumVGPRs,
unsigned Granule,
unsigned MaxWaves,
unsigned TotalNumVGPRs )
Returns
Number of waves reachable for a given NumVGPRs usage, Granule size, MaxWaves possible, and TotalNumVGPRs available.

Definition at line 1450 of file AMDGPUBaseInfo.cpp.

References llvm::alignTo().

◆ getOccupancyWithNumSGPRs() [1/2]

unsigned llvm::AMDGPU::IsaInfo::getOccupancyWithNumSGPRs ( const MCSubtargetInfo & STI,
unsigned SGPRs )
Returns
SGPR-limited occupancy (waves per EU) for subtarget STI: the inverse of getMaxNumSGPRs(). Unlike getMaxNumSGPRs() the budget is not clamped to the addressable count, since the allocated count callers pass in can exceed it.

Definition at line 1469 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getCPU(), getMaxWavesPerEU(), getOccupancyWithNumSGPRs(), llvm::AMDGPU::getSGPRAllocGranule(), getSGPRTrapHandlerReserve(), llvm::AMDGPU::getTotalNumSGPRs(), isSGPROccupancyLimited(), and llvm::AMDGPU::parseArchAMDGCN().

◆ getOccupancyWithNumSGPRs() [2/2]

unsigned llvm::AMDGPU::IsaInfo::getOccupancyWithNumSGPRs ( unsigned SGPRs,
unsigned MaxWaves,
unsigned TotalNumSGPRs,
unsigned Granule,
unsigned TrapReserve )
Returns
SGPR-limited occupancy computed from explicit budget parameters (MaxWaves, TotalNumSGPRs, Granule, TrapReserve). Subtarget-free core shared by the overload above and the occupancy MCExpr. Callers must check isSGPROccupancyLimited() first.

Definition at line 1459 of file AMDGPUBaseInfo.cpp.

References llvm::alignTo().

Referenced by getOccupancyWithNumSGPRs(), and llvm::GCNSubtarget::getOccupancyWithNumSGPRs().

◆ getSGPRBudgetPerWave()

unsigned llvm::AMDGPU::IsaInfo::getSGPRBudgetPerWave ( unsigned TotalNumSGPRs,
unsigned WavesPerEU,
unsigned TrapReserve,
unsigned Granule )
static

Definition at line 1278 of file AMDGPUBaseInfo.cpp.

References llvm::alignDown(), and assert().

Referenced by getMaxNumSGPRs(), and getMinNumSGPRs().

◆ getSGPREncodingGranule()

unsigned llvm::AMDGPU::IsaInfo::getSGPREncodingGranule ( const MCSubtargetInfo & STI)
Returns
SGPR encoding granularity for given subtarget STI.

Definition at line 1266 of file AMDGPUBaseInfo.cpp.

Referenced by llvm::AMDGPUDisassembler::decodeCOMPUTE_PGM_RSRC1(), getNumSGPRBlocks(), and llvm::GCNSubtarget::getSGPREncodingGranule().

◆ getSGPRTrapHandlerReserve()

unsigned llvm::AMDGPU::IsaInfo::getSGPRTrapHandlerReserve ( const MCSubtargetInfo & STI)
static

◆ getTotalNumVGPRs()

unsigned llvm::AMDGPU::IsaInfo::getTotalNumVGPRs ( const MCSubtargetInfo & STI)

◆ getVGPRAllocGranule()

unsigned llvm::AMDGPU::IsaInfo::getVGPRAllocGranule ( const MCSubtargetInfo & STI,
unsigned DynamicVGPRBlockSize,
std::optional< bool > EnableWavefrontSize32 = std::nullopt )
Returns
VGPR allocation granularity for given subtarget STI.

For subtargets which support it, EnableWavefrontSize32 should match the ENABLE_WAVEFRONT_SIZE32 kernel descriptor field.

Definition at line 1371 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getFeatureBits(), llvm::AMDGPU::hasGFX10_3Insts(), and llvm::FeatureBitset::test().

Referenced by createOccupancy(), llvm::SIFrameLowering::emitEntryFunctionPrologue(), getAddressableNumVGPRs(), getAllocatedNumVGPRBlocks(), getMaxNumVGPRs(), getMinNumVGPRs(), getNumWavesPerEUWithNumVGPRs(), llvm::GCNSubtarget::getVGPRAllocGranule(), and llvm::GCNSchedStrategy::initialize().

◆ getVGPREncodingGranule()

unsigned llvm::AMDGPU::IsaInfo::getVGPREncodingGranule ( const MCSubtargetInfo & STI,
std::optional< bool > EnableWavefrontSize32 = std::nullopt )
Returns
VGPR encoding granularity for given subtarget STI.

For subtargets which support it, EnableWavefrontSize32 should match the ENABLE_WAVEFRONT_SIZE32 kernel descriptor field.

Definition at line 1393 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getFeatureBits(), and llvm::FeatureBitset::test().

Referenced by llvm::AMDGPUDisassembler::decodeCOMPUTE_PGM_RSRC1(), getEncodedNumVGPRBlocks(), and llvm::GCNSubtarget::getVGPREncodingGranule().

◆ getWavefrontSize()

unsigned llvm::AMDGPU::IsaInfo::getWavefrontSize ( const MCSubtargetInfo & STI)
Returns
Wavefront size for given subtarget STI.

Definition at line 1170 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getFeatureBits(), and llvm::FeatureBitset::test().

Referenced by getWavesPerWorkGroup().

◆ getWavesPerEUForWorkGroup()

unsigned llvm::AMDGPU::IsaInfo::getWavesPerEUForWorkGroup ( const MCSubtargetInfo & STI,
unsigned FlatWorkGroupSize )
Returns
Number of waves per execution unit required to support the given FlatWorkGroupSize.

Definition at line 1253 of file AMDGPUBaseInfo.cpp.

References llvm::divideCeil(), getEUsPerCU(), and getWavesPerWorkGroup().

Referenced by llvm::GCNSubtarget::getWavesPerEUForWorkGroup(), and llvm::R600Subtarget::getWavesPerEUForWorkGroup().

◆ getWavesPerWorkGroup()

unsigned llvm::AMDGPU::IsaInfo::getWavesPerWorkGroup ( const MCSubtargetInfo & STI,
unsigned FlatWorkGroupSize )
Returns
Number of waves per work group for given subtarget STI and FlatWorkGroupSize.

Definition at line 1261 of file AMDGPUBaseInfo.cpp.

References llvm::divideCeil(), and getWavefrontSize().

Referenced by getMaxWorkGroupsPerCU(), and getWavesPerEUForWorkGroup().

◆ isSGPROccupancyLimited()

bool llvm::AMDGPU::IsaInfo::isSGPROccupancyLimited ( const MCSubtargetInfo & STI)
Returns
Whether allocated SGPRs can reduce occupancy on subtarget STI (true pre-GFX10). One named capability so callers don't test the version.

Definition at line 1323 of file AMDGPUBaseInfo.cpp.

References llvm::MCSubtargetInfo::getCPU(), llvm::AMDGPU::getIsaVersion(), and llvm::AMDGPU::IsaVersion::Major.

Referenced by createOccupancy(), and getOccupancyWithNumSGPRs().

◆ targetIDSettingsConflict()

bool llvm::AMDGPU::IsaInfo::targetIDSettingsConflict ( TargetIDSetting Lhs,
TargetIDSetting Rhs )
inline

Returns true if Lhs and Rhs are incompatible (both specific but different).

Definition at line 168 of file AMDGPUBaseInfo.h.

Variable Documentation

◆ MaxDynamicVGPRBlocks

unsigned llvm::AMDGPU::IsaInfo::MaxDynamicVGPRBlocks = 8
staticconstexpr

Maximum number of VGPR blocks that can be allocated in dynamic VGPR mode.

Definition at line 274 of file AMDGPUBaseInfo.h.

Referenced by getAddressableNumVGPRs().