gem5
v20.1.0.0
|
Memory dependency unit class. More...
#include <mem_dep_unit.hh>
Classes | |
class | MemDepEntry |
Memory dependence entries that track memory operations, marking when the instruction is ready to execute and what instructions depend upon it. More... | |
Public Types | |
typedef Impl::DynInstPtr | DynInstPtr |
typedef Impl::DynInstConstPtr | DynInstConstPtr |
Public Member Functions | |
MemDepUnit () | |
Empty constructor. More... | |
MemDepUnit (DerivO3CPUParams *params) | |
Constructs a MemDepUnit with given parameters. More... | |
~MemDepUnit () | |
Frees up any memory allocated. More... | |
std::string | name () const |
Returns the name of the memory dependence unit. More... | |
void | init (DerivO3CPUParams *params, ThreadID tid) |
Initializes the unit with parameters and a thread id. More... | |
void | regStats () |
Registers statistics. More... | |
bool | isDrained () const |
Determine if we are drained. More... | |
void | drainSanityCheck () const |
Perform sanity checks after a drain. More... | |
void | takeOverFrom () |
Takes over from another CPU's thread. More... | |
void | setIQ (InstructionQueue< Impl > *iq_ptr) |
Sets the pointer to the IQ. More... | |
void | insert (const DynInstPtr &inst) |
Inserts a memory instruction. More... | |
void | insertNonSpec (const DynInstPtr &inst) |
Inserts a non-speculative memory instruction. More... | |
void | insertBarrier (const DynInstPtr &barr_inst) |
Inserts a barrier instruction. More... | |
void | regsReady (const DynInstPtr &inst) |
Indicate that an instruction has its registers ready. More... | |
void | nonSpecInstReady (const DynInstPtr &inst) |
Indicate that a non-speculative instruction is ready. More... | |
void | reschedule (const DynInstPtr &inst) |
Reschedules an instruction to be re-executed. More... | |
void | replay () |
Replays all instructions that have been rescheduled by moving them to the ready list. More... | |
void | completeInst (const DynInstPtr &inst) |
Notifies completion of an instruction. More... | |
void | squash (const InstSeqNum &squashed_num, ThreadID tid) |
Squashes all instructions up until a given sequence number for a specific thread. More... | |
void | violation (const DynInstPtr &store_inst, const DynInstPtr &violating_load) |
Indicates an ordering violation between a store and a younger load. More... | |
void | issue (const DynInstPtr &inst) |
Issues the given instruction. More... | |
void | dumpLists () |
Debugging function to dump the lists of instructions. More... | |
Protected Attributes | |
std::string | _name |
Private Types | |
typedef std::list< DynInstPtr >::iterator | ListIt |
typedef std::shared_ptr< MemDepEntry > | MemDepEntryPtr |
typedef std::unordered_map< InstSeqNum, MemDepEntryPtr, SNHash > | MemDepHash |
typedef MemDepHash::iterator | MemDepHashIt |
Private Member Functions | |
void | completed (const DynInstPtr &inst) |
Completes a memory instruction. More... | |
void | wakeDependents (const DynInstPtr &inst) |
Wakes any dependents of a memory instruction. More... | |
MemDepEntryPtr & | findInHash (const DynInstConstPtr &inst) |
Finds the memory dependence entry in the hash map. More... | |
void | moveToReady (MemDepEntryPtr &ready_inst_entry) |
Moves an entry to the ready list. More... | |
bool | hasLoadBarrier () const |
Is there an outstanding load barrier that loads must wait on. More... | |
bool | hasStoreBarrier () const |
Is there an outstanding store barrier that loads must wait on. More... | |
void | insertBarrierSN (const DynInstPtr &barr_inst) |
Inserts the SN of a barrier inst. More... | |
Private Attributes | |
MemDepHash | memDepHash |
A hash map of all memory dependence entries. More... | |
std::list< DynInstPtr > | instList [Impl::MaxThreads] |
A list of all instructions in the memory dependence unit. More... | |
std::list< DynInstPtr > | instsToReplay |
A list of all instructions that are going to be replayed. More... | |
MemDepPred | depPred |
The memory dependence predictor. More... | |
std::unordered_set< InstSeqNum > | loadBarrierSNs |
Sequence numbers of outstanding load barriers. More... | |
std::unordered_set< InstSeqNum > | storeBarrierSNs |
Sequence numbers of outstanding store barriers. More... | |
InstructionQueue< Impl > * | iqPtr |
Pointer to the IQ. More... | |
int | id |
The thread id of this memory dependence unit. More... | |
Stats::Scalar | insertedLoads |
Stat for number of inserted loads. More... | |
Stats::Scalar | insertedStores |
Stat for number of inserted stores. More... | |
Stats::Scalar | conflictingLoads |
Stat for number of conflicting loads that had to wait for a store. More... | |
Stats::Scalar | conflictingStores |
Stat for number of conflicting stores that had to wait for a store. More... | |
Memory dependency unit class.
This holds the memory dependence predictor. As memory operations are issued to the IQ, they are also issued to this unit, which then looks up the prediction as to what they are dependent upon. This unit must be checked prior to a memory operation being able to issue. Although this is templated, it's somewhat hard to make a generic memory dependence unit. This one is mostly for store sets; it will be quite limited in what other memory dependence predictions it can also utilize. Thus this class should be most likely be rewritten for other dependence prediction schemes.
Definition at line 80 of file mem_dep_unit.hh.
typedef Impl::DynInstConstPtr MemDepUnit< MemDepPred, Impl >::DynInstConstPtr |
Definition at line 87 of file mem_dep_unit.hh.
typedef Impl::DynInstPtr MemDepUnit< MemDepPred, Impl >::DynInstPtr |
Definition at line 86 of file mem_dep_unit.hh.
|
private |
Definition at line 168 of file mem_dep_unit.hh.
|
private |
Definition at line 170 of file mem_dep_unit.hh.
|
private |
Definition at line 242 of file mem_dep_unit.hh.
|
private |
Definition at line 244 of file mem_dep_unit.hh.
MemDepUnit< MemDepPred, Impl >::MemDepUnit |
Empty constructor.
Must call init() prior to using in this case.
Definition at line 53 of file mem_dep_unit_impl.hh.
MemDepUnit< MemDepPred, Impl >::MemDepUnit | ( | DerivO3CPUParams * | params | ) |
Constructs a MemDepUnit with given parameters.
Definition at line 59 of file mem_dep_unit_impl.hh.
References DPRINTF.
MemDepUnit< MemDepPred, Impl >::~MemDepUnit |
Frees up any memory allocated.
Definition at line 69 of file mem_dep_unit_impl.hh.
|
private |
Completes a memory instruction.
Definition at line 417 of file mem_dep_unit_impl.hh.
References DPRINTF.
void MemDepUnit< MemDepPred, Impl >::completeInst | ( | const DynInstPtr & | inst | ) |
Notifies completion of an instruction.
Definition at line 441 of file mem_dep_unit_impl.hh.
References DPRINTF.
void MemDepUnit< MemDepPred, Impl >::drainSanityCheck |
Perform sanity checks after a drain.
Definition at line 142 of file mem_dep_unit_impl.hh.
References ArmISA::i.
void MemDepUnit< MemDepPred, Impl >::dumpLists |
Debugging function to dump the lists of instructions.
Definition at line 600 of file mem_dep_unit_impl.hh.
References cprintf().
|
inlineprivate |
Finds the memory dependence entry in the hash map.
Definition at line 576 of file mem_dep_unit_impl.hh.
|
inlineprivate |
Is there an outstanding load barrier that loads must wait on.
Definition at line 269 of file mem_dep_unit.hh.
References MemDepUnit< MemDepPred, Impl >::loadBarrierSNs.
|
inlineprivate |
Is there an outstanding store barrier that loads must wait on.
Definition at line 272 of file mem_dep_unit.hh.
References MemDepUnit< MemDepPred, Impl >::storeBarrierSNs.
void MemDepUnit< MemDepPred, Impl >::init | ( | DerivO3CPUParams * | params, |
ThreadID | tid | ||
) |
Initializes the unit with parameters and a thread id.
Definition at line 95 of file mem_dep_unit_impl.hh.
References csprintf(), and DPRINTF.
Referenced by InstructionQueue< Impl >::InstructionQueue().
void MemDepUnit< MemDepPred, Impl >::insert | ( | const DynInstPtr & | inst | ) |
Inserts a memory instruction.
Definition at line 197 of file mem_dep_unit_impl.hh.
void MemDepUnit< MemDepPred, Impl >::insertBarrier | ( | const DynInstPtr & | barr_inst | ) |
Inserts a barrier instruction.
Definition at line 330 of file mem_dep_unit_impl.hh.
|
private |
Inserts the SN of a barrier inst.
to the list of tracked barriers
Definition at line 171 of file mem_dep_unit_impl.hh.
References DPRINTF.
void MemDepUnit< MemDepPred, Impl >::insertNonSpec | ( | const DynInstPtr & | inst | ) |
Inserts a non-speculative memory instruction.
Definition at line 308 of file mem_dep_unit_impl.hh.
bool MemDepUnit< MemDepPred, Impl >::isDrained |
Determine if we are drained.
Definition at line 129 of file mem_dep_unit_impl.hh.
References ArmISA::i.
void MemDepUnit< MemDepPred, Impl >::issue | ( | const DynInstPtr & | inst | ) |
Issues the given instruction.
Definition at line 566 of file mem_dep_unit_impl.hh.
References DPRINTF.
|
inlineprivate |
Moves an entry to the ready list.
Definition at line 587 of file mem_dep_unit_impl.hh.
References DPRINTF.
|
inline |
Returns the name of the memory dependence unit.
Definition at line 99 of file mem_dep_unit.hh.
References MemDepUnit< MemDepPred, Impl >::_name.
void MemDepUnit< MemDepPred, Impl >::nonSpecInstReady | ( | const DynInstPtr & | inst | ) |
Indicate that a non-speculative instruction is ready.
Definition at line 376 of file mem_dep_unit_impl.hh.
References DPRINTF.
void MemDepUnit< MemDepPred, Impl >::regsReady | ( | const DynInstPtr & | inst | ) |
Indicate that an instruction has its registers ready.
Definition at line 353 of file mem_dep_unit_impl.hh.
References DPRINTF.
void MemDepUnit< MemDepPred, Impl >::regStats |
void MemDepUnit< MemDepPred, Impl >::replay |
Replays all instructions that have been rescheduled by moving them to the ready list.
Definition at line 396 of file mem_dep_unit_impl.hh.
References DPRINTF.
void MemDepUnit< MemDepPred, Impl >::reschedule | ( | const DynInstPtr & | inst | ) |
Reschedules an instruction to be re-executed.
Definition at line 389 of file mem_dep_unit_impl.hh.
void MemDepUnit< MemDepPred, Impl >::setIQ | ( | InstructionQueue< Impl > * | iq_ptr | ) |
Sets the pointer to the IQ.
Definition at line 164 of file mem_dep_unit_impl.hh.
Referenced by InstructionQueue< Impl >::InstructionQueue().
void MemDepUnit< MemDepPred, Impl >::squash | ( | const InstSeqNum & | squashed_num, |
ThreadID | tid | ||
) |
Squashes all instructions up until a given sequence number for a specific thread.
Definition at line 502 of file mem_dep_unit_impl.hh.
References DPRINTF.
void MemDepUnit< MemDepPred, Impl >::takeOverFrom |
Takes over from another CPU's thread.
Definition at line 154 of file mem_dep_unit_impl.hh.
void MemDepUnit< MemDepPred, Impl >::violation | ( | const DynInstPtr & | store_inst, |
const DynInstPtr & | violating_load | ||
) |
Indicates an ordering violation between a store and a younger load.
Definition at line 554 of file mem_dep_unit_impl.hh.
References DPRINTF.
|
private |
Wakes any dependents of a memory instruction.
Definition at line 464 of file mem_dep_unit_impl.hh.
|
protected |
Definition at line 83 of file mem_dep_unit.hh.
Referenced by MemDepUnit< MemDepPred, Impl >::name().
|
private |
Stat for number of conflicting loads that had to wait for a store.
Definition at line 288 of file mem_dep_unit.hh.
|
private |
Stat for number of conflicting stores that had to wait for a store.
Definition at line 290 of file mem_dep_unit.hh.
|
private |
The memory dependence predictor.
It is accessed upon new instructions being added to the IQ, and responds by telling this unit what instruction the newly added instruction is dependent upon.
Definition at line 260 of file mem_dep_unit.hh.
|
private |
The thread id of this memory dependence unit.
Definition at line 281 of file mem_dep_unit.hh.
|
private |
Stat for number of inserted loads.
Definition at line 284 of file mem_dep_unit.hh.
|
private |
Stat for number of inserted stores.
Definition at line 286 of file mem_dep_unit.hh.
|
private |
A list of all instructions in the memory dependence unit.
Definition at line 250 of file mem_dep_unit.hh.
|
private |
A list of all instructions that are going to be replayed.
Definition at line 253 of file mem_dep_unit.hh.
|
private |
Pointer to the IQ.
Definition at line 278 of file mem_dep_unit.hh.
|
private |
Sequence numbers of outstanding load barriers.
Definition at line 263 of file mem_dep_unit.hh.
Referenced by MemDepUnit< MemDepPred, Impl >::hasLoadBarrier().
|
private |
A hash map of all memory dependence entries.
Definition at line 247 of file mem_dep_unit.hh.
|
private |
Sequence numbers of outstanding store barriers.
Definition at line 266 of file mem_dep_unit.hh.
Referenced by MemDepUnit< MemDepPred, Impl >::hasStoreBarrier().