16 #ifndef LLVM_MCA_RESOURCE_MANAGER_H 17 #define LLVM_MCA_RESOURCE_MANAGER_H 59 virtual uint64_t
select(uint64_t ReadyMask) = 0;
65 virtual void used(uint64_t ResourceMask) {}
75 const uint64_t ResourceUnitMask;
98 uint64_t NextInSequenceMask;
120 uint64_t RemovedFromNextInSequence;
125 NextInSequenceMask(UnitMask), RemovedFromNextInSequence(0) {}
128 uint64_t
select(uint64_t ReadyMask)
override;
140 const unsigned ProcResourceDescIndex;
166 const uint64_t ResourceMask;
178 uint64_t ResourceSizeMask;
196 const int BufferSize;
199 unsigned AvailableSlots;
212 bool isSubResourceReady(uint64_t SubResMask)
const {
213 return ReadyMask & SubResMask;
236 bool isReady(
unsigned NumUnits = 1)
const;
243 assert(isSubResourceReady(ID));
248 assert(!isSubResourceReady(ID));
277 assert(AvailableSlots <= static_cast<unsigned>(BufferSize));
332 std::vector<std::unique_ptr<ResourceState>> Resources;
333 std::vector<std::unique_ptr<ResourceStrategy>> Strategies;
336 std::vector<uint64_t> Resource2Groups;
346 ResourceRef selectPipe(uint64_t ResourceID);
348 void use(
const ResourceRef &RR);
349 void release(
const ResourceRef &RR);
351 unsigned getNumUnits(uint64_t ResourceID)
const;
355 void setCustomStrategyImpl(std::unique_ptr<ResourceStrategy> S,
356 uint64_t ResourceMask);
365 unsigned ResourceID) {
367 "Invalid resource index in input!");
368 return setCustomStrategyImpl(std::move(S), ProcResID2Mask[ResourceID]);
376 unsigned resolveResourceMask(uint64_t
Mask)
const;
387 void reserveResource(uint64_t ResourceID);
390 void releaseResource(uint64_t ResourceID);
392 bool canBeIssued(
const InstrDesc &Desc)
const;
394 void issueInstruction(
402 for (
const std::unique_ptr<ResourceState> &Resource : Resources)
410 #endif // LLVM_MCA_RESOURCE_MANAGER_H bool isAResourceGroup() const
A resource manager for processor resource units and groups.
This class represents lattice values for constants.
void setCustomStrategy(std::unique_ptr< ResourceStrategy > S, unsigned ResourceID)
void markSubResourceAsUsed(uint64_t ID)
bool containsResource(uint64_t ID) const
virtual ~ResourceStrategy()
virtual void used(uint64_t ResourceMask)
Called by the ResourceManager when a processor resource group, or a processor resource with multiple ...
uint64_t getResourceMask() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
virtual uint64_t select(uint64_t ReadyMask)=0
Selects a processor resource unit from a ReadyMask.
unsigned getNumUnits() const
uint64_t getReadyMask() const
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
void releaseBuffer()
Release a slot in the buffer.
std::pair< uint64_t, uint64_t > ResourceRef
A resource unit identifier.
bool isADispatchHazard() const
Returns true if this is an in-order dispatch/issue resource.
void reserveBuffer()
Reserve a slot in the buffer.
Helper functions used by various pipeline components.
ResourceStateEvent
Used to notify the internal state of a processor resource.
int getBufferSize() const
unsigned countPopulation(T Value)
Count the number of set bits in a value.
Define a kind of processor resource that will be modeled by the scheduler.
std::pair< unsigned, unsigned > BufferUsageEntry
An instruction descriptor.
A processor resource descriptor.
This file defines abstractions used by the Pipeline to model register reads, register writes and inst...
void releaseSubResource(uint64_t ID)
DefaultResourceStrategy(uint64_t UnitMask)
unsigned getProcResourceID() const
Default resource allocation strategy used by processor resource groups and processor resources with m...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Resource allocation strategy used by hardware scheduler resources.
Machine model for scheduling, bundling, and heuristics.