15 #ifndef LLVM_MCA_SCHEDULER_H 16 #define LLVM_MCA_SCHEDULER_H 44 int computeRank(
const InstRef &Lhs)
const {
53 int LhsRank = computeRank(Lhs);
54 int RhsRank = computeRank(Rhs);
58 if (LhsRank == RhsRank)
60 return LhsRank < RhsRank;
91 std::unique_ptr<SchedulerStrategy> Strategy;
94 std::unique_ptr<ResourceManager> Resources;
96 std::vector<InstRef> WaitSet;
97 std::vector<InstRef> ReadySet;
98 std::vector<InstRef> IssuedSet;
103 void initializeStrategy(std::unique_ptr<SchedulerStrategy> S);
106 void issueInstructionImpl(
124 std::unique_ptr<SchedulerStrategy> SelectStrategy)
126 std::move(SelectStrategy)) {}
129 std::unique_ptr<SchedulerStrategy> SelectStrategy)
130 : LSU(Lsu), Resources(
std::move(RM)) {
131 initializeStrategy(std::move(SelectStrategy));
159 void dispatch(
const InstRef &IR);
163 bool isReady(
const InstRef &IR)
const;
168 void issueInstruction(
175 bool mustIssueImmediately(
const InstRef &IR)
const;
190 return Resources->resolveResourceMask(Mask);
205 assert(
find(WaitSet, IR) == WaitSet.end() &&
"Already in the wait set!");
206 assert(
find(ReadySet, IR) == ReadySet.end() &&
"Already in the ready set!");
207 assert(
find(IssuedSet, IR) == IssuedSet.end() &&
"Already executing!");
214 #endif // LLVM_MCA_SCHEDULER_H Instruction * getInstruction()
SchedulerStrategy()=default
virtual bool compare(const InstRef &Lhs, const InstRef &Rhs) const =0
Returns true if Lhs should take priority over Rhs.
bool compare(const InstRef &Lhs, const InstRef &Rhs) const override
Returns true if Lhs should take priority over Rhs.
A resource manager for processor resource units and groups.
This class represents lattice values for constants.
Default instruction selection strategy used by class Scheduler.
void sanityCheck(const InstRef &IR) const
Scheduler(std::unique_ptr< ResourceManager > RM, LSUnit &Lsu, std::unique_ptr< SchedulerStrategy > SelectStrategy)
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type make_unique(Args &&... args)
Constructs a new T() with the given args and returns a unique_ptr<T> which owns the object...
An InstRef contains both a SourceMgr index and Instruction pair.
Scheduler(const MCSchedModel &Model, LSUnit &Lsu, std::unique_ptr< SchedulerStrategy > SelectStrategy)
A Load/Store unit class that models load/store queues and that implements a simple weak memory consis...
unsigned getSourceIndex() const
unsigned getResourceID(uint64_t Mask) const
Convert a resource mask into a valid llvm processor resource identifier.
A Load/Store Unit implementing a load and store queues.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Class Scheduler is responsible for issuing instructions to pipeline resources.
This file defines a base class for describing a simulated hardware unit.
Helper functions used by various pipeline components.
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
virtual ~SchedulerStrategy()
Scheduler(const MCSchedModel &Model, LSUnit &Lsu)
The classes here represent processor resource units and their management strategy.
unsigned getNumUsers() const
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.
Machine model for scheduling, bundling, and heuristics.
Statically lint checks LLVM IR