class ResourceState
Declaration
class ResourceState { /* full declaration omitted */ };
Description
A processor resource descriptor. There is an instance of this class for every processor resource defined by the machine scheduling model. Objects of class ResourceState dynamically track the usage of processor resource units.
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:135
Member Variables
- private const unsigned int ProcResourceDescIndex
- An index to the MCProcResourceDesc entry in the processor model.
- private const uint64_t ResourceMask
- In this example, resources A, B and C are processor resource units. Only resource D is a group resource, and it contains resources B and C. That is because MSB(B) and MSB(C) are both contained within Group(D).
- private uint64_t ResourceSizeMask
- For normal (i.e. non-group) resources, the number of bits set in this mask is equivalent to the number of units declared by the processor model (see field 'NumUnits' in 'ProcResourceUnits').
- private uint64_t ReadyMask
- A mask of ready units.
- private const int BufferSize
- A BufferSize of 0 is used to model in-order issue/dispatch resources. Since in-order issue/dispatch resources don't implement buffers, dispatch events coincide with issue events. Also, no other instruction ca be dispatched/issue while this resource is in use. Only when all the "resource cycles" are consumed (after the issue event), a new instruction ca be dispatched.
- private unsigned int AvailableSlots
- Available slots in the buffer (zero, if this is not a buffered resource).
- Resources can be reserved for a number of cycles. Instructions can still be dispatched to reserved resources. However, istructions dispatched to a reserved resource cannot be issued to the underlying units (i.e. pipelines) until the resource is released.
- private const bool IsAGroup
Method Overview
- public ResourceState(const llvm::MCProcResourceDesc & Desc, unsigned int Index, uint64_t Mask)
- public void clearReserved()
- public bool containsResource(uint64_t ID) const
- public void dump() const
- public int getBufferSize() const
- public unsigned int getNumUnits() const
- public unsigned int getProcResourceID() const
- public uint64_t getReadyMask() const
- public uint64_t getResourceMask() const
- public bool isADispatchHazard() const
- public bool isAResourceGroup() const
- public llvm::mca::ResourceStateEvent isBufferAvailable() const
- public bool isBuffered() const
- public bool isInOrder() const
- public bool isReady(unsigned int NumUnits = 1) const
- public bool isReserved() const
- private bool isSubResourceReady(uint64_t SubResMask) const
- public void markSubResourceAsUsed(uint64_t ID)
- public void releaseBuffer()
- public void releaseSubResource(uint64_t ID)
- public bool reserveBuffer()
- public void setReserved()
Methods
¶ResourceState(
const llvm::MCProcResourceDesc& Desc,
unsigned int Index,
uint64_t Mask)
ResourceState(
const llvm::MCProcResourceDesc& Desc,
unsigned int Index,
uint64_t Mask)
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:214
Parameters
- const llvm::MCProcResourceDesc& Desc
- unsigned int Index
- uint64_t Mask
¶void clearReserved()
void clearReserved()
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:229
¶bool containsResource(uint64_t ID) const
bool containsResource(uint64_t ID) const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:237
Parameters
- uint64_t ID
¶void dump() const
void dump() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:288
¶int getBufferSize() const
int getBufferSize() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:219
¶unsigned int getNumUnits() const
unsigned int getNumUnits() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:249
¶unsigned int getProcResourceID() const
unsigned int getProcResourceID() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:216
¶uint64_t getReadyMask() const
uint64_t getReadyMask() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:218
¶uint64_t getResourceMask() const
uint64_t getResourceMask() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:217
¶bool isADispatchHazard() const
bool isADispatchHazard() const
Description
Returns true if this is an in-order dispatch/issue resource.
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:225
¶bool isAResourceGroup() const
bool isAResourceGroup() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:235
¶llvm::mca::ResourceStateEvent isBufferAvailable()
const
llvm::mca::ResourceStateEvent isBufferAvailable()
const
Description
Checks if there is an available slot in the resource buffer. Returns RS_BUFFER_AVAILABLE if this is not a buffered resource, or if there is a slot available. Returns RS_RESERVED if this buffered resource is a dispatch hazard, and it is reserved. Returns RS_BUFFER_UNAVAILABLE if there are no available slots.
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:262
¶bool isBuffered() const
bool isBuffered() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:221
¶bool isInOrder() const
bool isInOrder() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:222
¶bool isReady(unsigned int NumUnits = 1) const
bool isReady(unsigned int NumUnits = 1) const
Description
Returs true if this resource is not reserved, and if there are at least `NumUnits` available units.
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:233
Parameters
- unsigned int NumUnits = 1
¶bool isReserved() const
bool isReserved() const
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:226
¶bool isSubResourceReady(uint64_t SubResMask) const
bool isSubResourceReady(uint64_t SubResMask) const
Description
Checks for the availability of unit 'SubResMask' in the group.
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:209
Parameters
- uint64_t SubResMask
¶void markSubResourceAsUsed(uint64_t ID)
void markSubResourceAsUsed(uint64_t ID)
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:239
Parameters
- uint64_t ID
¶void releaseBuffer()
void releaseBuffer()
Description
Releases a slot in the buffer.
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:278
¶void releaseSubResource(uint64_t ID)
void releaseSubResource(uint64_t ID)
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:244
Parameters
- uint64_t ID
¶bool reserveBuffer()
bool reserveBuffer()
Description
Reserve a buffer slot. Returns true if the buffer is not full. It always returns true if BufferSize is set to zero.
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:268
¶void setReserved()
void setReserved()
Declared at: llvm/include/llvm/MCA/HardwareUnits/ResourceManager.h:228