gem5
v19.0.0.0
|
#include <Prefetcher.hh>
Public Types | |
typedef PrefetcherParams | Params |
![]() | |
typedef SimObjectParams | Params |
Public Member Functions | |
Prefetcher (const Params *p) | |
~Prefetcher () | |
void | issueNextPrefetch (Addr address, PrefetchEntry *stream) |
void | observePfHit (Addr address) |
Implement the prefetch hit(miss) callback interface. More... | |
void | observePfMiss (Addr address) |
void | observeMiss (Addr address, const RubyRequestType &type) |
Observe a memory miss from the cache. More... | |
void | print (std::ostream &out) const |
Print out some statistics. More... | |
void | setController (AbstractController *_ctrl) |
void | regStats () |
Callback to set stat parameters. More... | |
![]() | |
const Params * | params () const |
SimObject (const Params *_params) | |
virtual | ~SimObject () |
virtual const std::string | name () const |
virtual void | init () |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
virtual void | loadState (CheckpointIn &cp) |
loadState() is called on each SimObject when restoring from a checkpoint. More... | |
virtual void | initState () |
initState() is called on each SimObject when not restoring from a checkpoint. More... | |
virtual void | regProbePoints () |
Register probe points for this object. More... | |
virtual void | regProbeListeners () |
Register probe listeners for this object. More... | |
ProbeManager * | getProbeManager () |
Get the probe manager for this object. More... | |
virtual Port & | getPort (const std::string &if_name, PortID idx=InvalidPortID) |
Get a port with a given name and index. More... | |
virtual void | startup () |
startup() is the final initialization call before simulation. More... | |
DrainState | drain () override |
Provide a default implementation of the drain interface for objects that don't need draining. More... | |
virtual void | memWriteback () |
Write back dirty buffers to memory using functional writes. More... | |
virtual void | memInvalidate () |
Invalidate the contents of memory buffers. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
![]() | |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
void | setCurTick (Tick newVal) |
![]() | |
Serializable () | |
virtual | ~Serializable () |
void | serializeSection (CheckpointOut &cp, const char *name) const |
Serialize an object into a new section. More... | |
void | serializeSection (CheckpointOut &cp, const std::string &name) const |
void | unserializeSection (CheckpointIn &cp, const char *name) |
Unserialize an a child object. More... | |
void | unserializeSection (CheckpointIn &cp, const std::string &name) |
![]() | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
![]() | |
Group ()=delete | |
Group (const Group &)=delete | |
Group & | operator= (const Group &)=delete |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. More... | |
virtual | ~Group () |
virtual void | resetStats () |
Callback to reset stats. More... | |
virtual void | preDumpStats () |
Callback before stats are dumped. More... | |
void | addStat (Stats::Info *info) |
Register a stat with this group. More... | |
const std::map< std::string, Group * > & | getStatGroups () const |
Get all child groups associated with this object. More... | |
const std::vector< Info * > & | getStats () const |
Get all stats associated with this object. More... | |
void | addStatGroup (const char *name, Group *block) |
Add a stat block as a child of this block. More... | |
Private Member Functions | |
uint32_t | getLRUindex (void) |
Returns an unused stream buffer (or if all are used, returns the least recently used (accessed) stream buffer). More... | |
void | clearNonunitEntry (uint32_t index) |
clear a non-unit stride prefetcher entry More... | |
void | initializeStream (Addr address, int stride, uint32_t index, const RubyRequestType &type) |
allocate a new stream buffer at a specific index More... | |
PrefetchEntry * | getPrefetchEntry (Addr address, uint32_t &index) |
get pointer to the matching stream entry, returns NULL if not found index holds the multiple of the stride this address is. More... | |
bool | accessUnitFilter (std::vector< Addr > &filter_table, uint32_t *hit_table, uint32_t &index, Addr address, int stride, bool &alloc) |
access a unit stride filter to determine if there is a hit More... | |
bool | accessNonunitFilter (Addr address, int *stride, bool &alloc) |
access a unit stride filter to determine if there is a hit More... | |
Addr | pageAddress (Addr addr) const |
determine the page aligned address More... | |
Private Attributes | |
uint32_t | m_num_streams |
number of prefetch streams available More... | |
std::vector< PrefetchEntry > | m_array |
an array of the active prefetch streams More... | |
uint32_t | m_train_misses |
number of misses I must see before allocating a stream More... | |
uint32_t | m_num_startup_pfs |
number of initial prefetches to startup a stream More... | |
uint32_t | m_num_unit_filters |
number of stride filters More... | |
uint32_t | m_num_nonunit_filters |
number of non-stride filters More... | |
std::vector< Addr > | m_unit_filter |
a unit stride filter array: helps reduce BW requirement of prefetching More... | |
uint32_t | m_unit_filter_index |
a round robin pointer into the unit filter group More... | |
uint32_t * | m_unit_filter_hit |
An array used to count the of times particular filter entries have been hit. More... | |
std::vector< Addr > | m_negative_filter |
a negative nit stride filter array: helps reduce BW requirement of prefetching More... | |
uint32_t | m_negative_filter_index |
a round robin pointer into the negative filter group More... | |
uint32_t * | m_negative_filter_hit |
An array used to count the of times particular filter entries have been hit. More... | |
std::vector< Addr > | m_nonunit_filter |
a non-unit stride filter array: helps reduce BW requirement of prefetching More... | |
int * | m_nonunit_stride |
An array of strides (in # of cache lines) for the filter entries. More... | |
uint32_t * | m_nonunit_hit |
An array used to count the of times particular filter entries have been hit. More... | |
uint32_t | m_nonunit_index |
a round robin pointer into the unit filter group More... | |
bool | m_prefetch_cross_pages |
Used for allowing prefetches across pages. More... | |
AbstractController * | m_controller |
const Addr | m_page_shift |
Stats::Scalar | numMissObserved |
Count of accesses to the prefetcher. More... | |
Stats::Scalar | numAllocatedStreams |
Count of prefetch streams allocated. More... | |
Stats::Scalar | numPrefetchRequested |
Count of prefetch requests made. More... | |
Stats::Scalar | numPrefetchAccepted |
Count of prefetch requests accepted. More... | |
Stats::Scalar | numDroppedPrefetches |
Count of prefetches dropped. More... | |
Stats::Scalar | numHits |
Count of successful prefetches. More... | |
Stats::Scalar | numPartialHits |
Count of partial successful prefetches. More... | |
Stats::Scalar | numPagesCrossed |
Count of pages crossed. More... | |
Stats::Scalar | numMissedPrefetchedBlocks |
Count of misses incurred for blocks that were prefetched. More... | |
Additional Inherited Members | |
![]() | |
static void | serializeAll (CheckpointOut &cp) |
Serialize all SimObjects in the system. More... | |
static SimObject * | find (const char *name) |
Find the SimObject with the given name and return a pointer to it. More... | |
![]() | |
static const std::string & | currentSection () |
Get the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
static void | unserializeGlobals (CheckpointIn &cp) |
![]() | |
static int | ckptCount = 0 |
static int | ckptMaxCount = 0 |
static int | ckptPrevCount = -1 |
![]() | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. More... | |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
![]() | |
const SimObjectParams * | _params |
Cached copy of the object parameters. More... | |
![]() | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Definition at line 81 of file Prefetcher.hh.
typedef PrefetcherParams Prefetcher::Params |
Definition at line 84 of file Prefetcher.hh.
Prefetcher::Prefetcher | ( | const Params * | p | ) |
Definition at line 42 of file Prefetcher.cc.
References ArmISA::i, m_negative_filter_hit, m_negative_filter_index, m_nonunit_hit, m_nonunit_index, m_nonunit_stride, m_num_nonunit_filters, m_num_startup_pfs, m_num_streams, m_num_unit_filters, m_unit_filter_hit, m_unit_filter_index, and MAX_PF_INFLIGHT.
Prefetcher::~Prefetcher | ( | ) |
Definition at line 80 of file Prefetcher.cc.
References m_negative_filter_hit, m_nonunit_hit, m_nonunit_stride, and m_unit_filter_hit.
|
private |
access a unit stride filter to determine if there is a hit
look for non-unit strides based on a (user-defined) page size
Definition at line 381 of file Prefetcher.cc.
References clearNonunitEntry(), RubySystem::getBlockSizeBytes(), ArmISA::i, m_nonunit_filter, m_nonunit_hit, m_nonunit_index, m_nonunit_stride, m_num_nonunit_filters, m_train_misses, makeLineAddress(), and pageAddress().
Referenced by observeMiss().
|
private |
access a unit stride filter to determine if there is a hit
Definition at line 348 of file Prefetcher.cc.
References ArmISA::i, MipsISA::index, m_num_unit_filters, m_train_misses, makeLineAddress(), and makeNextStrideAddress().
Referenced by observeMiss().
|
private |
clear a non-unit stride prefetcher entry
Definition at line 281 of file Prefetcher.cc.
References MipsISA::index, m_nonunit_filter, m_nonunit_hit, and m_nonunit_stride.
Referenced by accessNonunitFilter().
|
private |
Returns an unused stream buffer (or if all are used, returns the least recently used (accessed) stream buffer).
Definition at line 262 of file Prefetcher.cc.
References ArmISA::i, m_array, and m_num_streams.
Referenced by observeMiss().
|
private |
get pointer to the matching stream entry, returns NULL if not found index holds the multiple of the stride this address is.
Definition at line 330 of file Prefetcher.cc.
References ArmISA::i, ArmISA::j, m_array, m_num_startup_pfs, m_num_streams, and makeNextStrideAddress().
Referenced by issueNextPrefetch(), and observeMiss().
|
private |
allocate a new stream buffer at a specific index
Definition at line 289 of file Prefetcher.cc.
References Clocked::curCycle(), DPRINTF, AbstractController::enqueuePrefetch(), MipsISA::index, MipsISA::k, PrefetchEntry::m_address, m_array, m_controller, PrefetchEntry::m_is_valid, m_num_startup_pfs, m_prefetch_cross_pages, PrefetchEntry::m_stride, PrefetchEntry::m_type, PrefetchEntry::m_use_time, makeLineAddress(), makeNextStrideAddress(), numAllocatedStreams, numPagesCrossed, numPrefetchRequested, pageAddress(), ArmISA::stride, and type.
Referenced by observeMiss().
void Prefetcher::issueNextPrefetch | ( | Addr | address, |
PrefetchEntry * | stream | ||
) |
Definition at line 224 of file Prefetcher.cc.
References Clocked::curCycle(), DPRINTF, AbstractController::enqueuePrefetch(), getPrefetchEntry(), MipsISA::index, PrefetchEntry::m_address, m_controller, PrefetchEntry::m_is_valid, m_prefetch_cross_pages, PrefetchEntry::m_stride, PrefetchEntry::m_type, PrefetchEntry::m_use_time, makeNextStrideAddress(), numPagesCrossed, and pageAddress().
Referenced by observePfHit(), and observePfMiss().
void Prefetcher::observeMiss | ( | Addr | address, |
const RubyRequestType & | type | ||
) |
Observe a memory miss from the cache.
address | The physical address that missed out of the cache. |
Definition at line 140 of file Prefetcher.cc.
References accessNonunitFilter(), accessUnitFilter(), DPRINTF, getLRUindex(), getPrefetchEntry(), MipsISA::index, initializeStream(), m_negative_filter, m_negative_filter_hit, m_negative_filter_index, m_unit_filter, m_unit_filter_hit, m_unit_filter_index, makeLineAddress(), numMissedPrefetchedBlocks, numMissObserved, numPartialHits, observePfHit(), PrefetchEntry::requestCompleted, PrefetchEntry::requestIssued, and ArmISA::stride.
void Prefetcher::observePfHit | ( | Addr | address | ) |
Implement the prefetch hit(miss) callback interface.
These functions are called by the cache when it hits(misses) on a line with the line's prefetch bit set. If this address hits in m_array we will continue prefetching the stream.
Definition at line 216 of file Prefetcher.cc.
References DPRINTF, issueNextPrefetch(), and numHits.
Referenced by observeMiss().
void Prefetcher::observePfMiss | ( | Addr | address | ) |
Definition at line 208 of file Prefetcher.cc.
References DPRINTF, issueNextPrefetch(), and numPartialHits.
determine the page aligned address
Definition at line 477 of file Prefetcher.cc.
References addr, and m_page_shift.
Referenced by accessNonunitFilter(), initializeStream(), and issueNextPrefetch().
void Prefetcher::print | ( | std::ostream & | out | ) | const |
Print out some statistics.
Definition at line 444 of file Prefetcher.cc.
References ArmISA::i, m_array, m_negative_filter, m_nonunit_filter, m_nonunit_hit, m_nonunit_stride, m_num_nonunit_filters, m_num_streams, m_num_unit_filters, m_unit_filter, and SimObject::name().
|
virtual |
Callback to set stat parameters.
This callback is typically used for complex stats (e.g., distributions) that need parameters in addition to a name and a description. Stat names and descriptions should typically be set from the constructor usingo from the constructor using the ADD_STAT macro.
Reimplemented from Stats::Group.
Definition at line 89 of file Prefetcher.cc.
References Stats::DataWrap< Derived, InfoProxyType >::desc(), SimObject::name(), Stats::DataWrap< Derived, InfoProxyType >::name(), numAllocatedStreams, numDroppedPrefetches, numHits, numMissedPrefetchedBlocks, numMissObserved, numPagesCrossed, numPartialHits, numPrefetchAccepted, numPrefetchRequested, and Stats::Group::regStats().
|
inline |
Definition at line 109 of file Prefetcher.hh.
References addr, MipsISA::index, ArmISA::stride, and type.
|
private |
an array of the active prefetch streams
Definition at line 149 of file Prefetcher.hh.
Referenced by getLRUindex(), getPrefetchEntry(), initializeStream(), and print().
|
private |
Definition at line 192 of file Prefetcher.hh.
Referenced by initializeStream(), and issueNextPrefetch().
|
private |
a negative nit stride filter array: helps reduce BW requirement of prefetching
Definition at line 171 of file Prefetcher.hh.
Referenced by observeMiss(), and print().
|
private |
An array used to count the of times particular filter entries have been hit.
Definition at line 176 of file Prefetcher.hh.
Referenced by observeMiss(), Prefetcher(), and ~Prefetcher().
|
private |
a round robin pointer into the negative filter group
Definition at line 173 of file Prefetcher.hh.
Referenced by observeMiss(), and Prefetcher().
|
private |
a non-unit stride filter array: helps reduce BW requirement of prefetching
Definition at line 180 of file Prefetcher.hh.
Referenced by accessNonunitFilter(), clearNonunitEntry(), and print().
|
private |
An array used to count the of times particular filter entries have been hit.
Definition at line 185 of file Prefetcher.hh.
Referenced by accessNonunitFilter(), clearNonunitEntry(), Prefetcher(), print(), and ~Prefetcher().
|
private |
a round robin pointer into the unit filter group
Definition at line 187 of file Prefetcher.hh.
Referenced by accessNonunitFilter(), and Prefetcher().
|
private |
An array of strides (in # of cache lines) for the filter entries.
Definition at line 182 of file Prefetcher.hh.
Referenced by accessNonunitFilter(), clearNonunitEntry(), Prefetcher(), print(), and ~Prefetcher().
|
private |
number of non-stride filters
Definition at line 158 of file Prefetcher.hh.
Referenced by accessNonunitFilter(), Prefetcher(), and print().
|
private |
number of initial prefetches to startup a stream
Definition at line 154 of file Prefetcher.hh.
Referenced by getPrefetchEntry(), initializeStream(), and Prefetcher().
|
private |
number of prefetch streams available
Definition at line 147 of file Prefetcher.hh.
Referenced by getLRUindex(), getPrefetchEntry(), Prefetcher(), and print().
|
private |
number of stride filters
Definition at line 156 of file Prefetcher.hh.
Referenced by accessUnitFilter(), Prefetcher(), and print().
|
private |
Definition at line 194 of file Prefetcher.hh.
Referenced by pageAddress().
|
private |
Used for allowing prefetches across pages.
Definition at line 190 of file Prefetcher.hh.
Referenced by initializeStream(), and issueNextPrefetch().
|
private |
number of misses I must see before allocating a stream
Definition at line 152 of file Prefetcher.hh.
Referenced by accessNonunitFilter(), and accessUnitFilter().
|
private |
a unit stride filter array: helps reduce BW requirement of prefetching
Definition at line 162 of file Prefetcher.hh.
Referenced by observeMiss(), and print().
|
private |
An array used to count the of times particular filter entries have been hit.
Definition at line 167 of file Prefetcher.hh.
Referenced by observeMiss(), Prefetcher(), and ~Prefetcher().
|
private |
a round robin pointer into the unit filter group
Definition at line 164 of file Prefetcher.hh.
Referenced by observeMiss(), and Prefetcher().
|
private |
Count of prefetch streams allocated.
Definition at line 199 of file Prefetcher.hh.
Referenced by initializeStream(), and regStats().
|
private |
Count of prefetches dropped.
Definition at line 205 of file Prefetcher.hh.
Referenced by regStats().
|
private |
Count of successful prefetches.
Definition at line 207 of file Prefetcher.hh.
Referenced by observePfHit(), and regStats().
|
private |
Count of misses incurred for blocks that were prefetched.
Definition at line 213 of file Prefetcher.hh.
Referenced by observeMiss(), and regStats().
|
private |
Count of accesses to the prefetcher.
Definition at line 197 of file Prefetcher.hh.
Referenced by observeMiss(), and regStats().
|
private |
Count of pages crossed.
Definition at line 211 of file Prefetcher.hh.
Referenced by initializeStream(), issueNextPrefetch(), and regStats().
|
private |
Count of partial successful prefetches.
Definition at line 209 of file Prefetcher.hh.
Referenced by observeMiss(), observePfMiss(), and regStats().
|
private |
Count of prefetch requests accepted.
Definition at line 203 of file Prefetcher.hh.
Referenced by regStats().
|
private |
Count of prefetch requests made.
Definition at line 201 of file Prefetcher.hh.
Referenced by initializeStream(), and regStats().