gem5  v22.1.0.0
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
gem5::ruby::RubyPrefetcher Class Reference

#include <RubyPrefetcher.hh>

Inheritance diagram for gem5::ruby::RubyPrefetcher:
gem5::SimObject gem5::EventManager gem5::Serializable gem5::Drainable gem5::statistics::Group gem5::Named

Classes

struct  NonUnitFilterEntry
 
struct  RubyPrefetcherStats
 
struct  UnitFilterEntry
 

Public Types

typedef RubyPrefetcherParams Params
 
- Public Types inherited from gem5::SimObject
typedef SimObjectParams Params
 

Public Member Functions

 RubyPrefetcher (const Params &p)
 
 ~RubyPrefetcher ()=default
 
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)
 
- Public Member Functions inherited from gem5::SimObject
const Paramsparams () const
 
 SimObject (const Params &p)
 
virtual ~SimObject ()
 
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...
 
ProbeManagergetProbeManager ()
 Get the probe manager for this object. More...
 
virtual PortgetPort (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...
 
- Public Member Functions inherited from gem5::EventManager
EventQueueeventQueue () 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)
 This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More...
 
void setCurTick (Tick newVal)
 
 EventManager (EventManager &em)
 Event manger manages events in the event queue. More...
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
- Public Member Functions inherited from gem5::Serializable
 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)
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 
- Public Member Functions inherited from gem5::statistics::Group
 Group (Group *parent, const char *name=nullptr)
 Construct a new statistics group. More...
 
virtual ~Group ()
 
virtual void regStats ()
 Callback to set stat parameters. More...
 
virtual void resetStats ()
 Callback to reset stats. More...
 
virtual void preDumpStats ()
 Callback before stats are dumped. More...
 
void addStat (statistics::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...
 
const InforesolveStat (std::string name) const
 Resolve a stat by its name within this group. More...
 
void mergeStatGroup (Group *block)
 Merge the contents (stats & children) of a block to this block. More...
 
 Group ()=delete
 
 Group (const Group &)=delete
 
Groupoperator= (const Group &)=delete
 
- Public Member Functions inherited from gem5::Named
 Named (const std::string &name_)
 
virtual ~Named ()=default
 
virtual std::string name () const
 

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 initializeStream (Addr address, int stride, uint32_t index, const RubyRequestType &type)
 allocate a new stream buffer at a specific index More...
 
PrefetchEntrygetPrefetchEntry (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 (CircularQueue< UnitFilterEntry > *const filter, Addr line_addr, int stride, const RubyRequestType &type)
 Access a unit stride filter to determine if there is a hit, and update it otherwise. More...
 
bool accessNonunitFilter (Addr line_addr, const RubyRequestType &type)
 Access a non-unit stride filter to determine if there is a hit, and update it otherwise. 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< PrefetchEntrym_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...
 
CircularQueue< UnitFilterEntryunitFilter
 A unit stride filter array: helps reduce BW requirement of prefetching. More...
 
CircularQueue< UnitFilterEntrynegativeFilter
 A negative unit stride filter array: helps reduce BW requirement of prefetching. More...
 
CircularQueue< NonUnitFilterEntrynonUnitFilter
 A non-unit stride filter array: helps reduce BW requirement of prefetching. More...
 
bool m_prefetch_cross_pages
 Used for allowing prefetches across pages. More...
 
AbstractControllerm_controller
 
const unsigned pageShift
 
gem5::ruby::RubyPrefetcher::RubyPrefetcherStats rubyPrefetcherStats
 

Additional Inherited Members

- Static Public Member Functions inherited from gem5::SimObject
static void serializeAll (const std::string &cpt_dir)
 Create a checkpoint by serializing all SimObjects in the system. More...
 
static SimObjectfind (const char *name)
 Find the SimObject with the given name and return a pointer to it. More...
 
static void setSimObjectResolver (SimObjectResolver *resolver)
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More...
 
static SimObjectResolvergetSimObjectResolver ()
 There is a single object name resolver, and it is only set when simulation is restoring from checkpoints. More...
 
- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section. More...
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it. More...
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain. More...
 
void signalDrainDone () const
 Signal that an object is drained. More...
 
- Protected Attributes inherited from gem5::SimObject
const SimObjectParams & _params
 Cached copy of the object parameters. More...
 
- Protected Attributes inherited from gem5::EventManager
EventQueueeventq
 A pointer to this object's event queue. More...
 

Detailed Description

Definition at line 100 of file RubyPrefetcher.hh.

Member Typedef Documentation

◆ Params

typedef RubyPrefetcherParams gem5::ruby::RubyPrefetcher::Params

Definition at line 103 of file RubyPrefetcher.hh.

Constructor & Destructor Documentation

◆ RubyPrefetcher()

gem5::ruby::RubyPrefetcher::RubyPrefetcher ( const Params p)

Definition at line 57 of file RubyPrefetcher.cc.

References m_num_startup_pfs, m_num_streams, and MAX_PF_INFLIGHT.

◆ ~RubyPrefetcher()

gem5::ruby::RubyPrefetcher::~RubyPrefetcher ( )
default

Member Function Documentation

◆ accessNonunitFilter()

bool gem5::ruby::RubyPrefetcher::accessNonunitFilter ( Addr  line_addr,
const RubyRequestType &  type 
)
private

Access a non-unit stride filter to determine if there is a hit, and update it otherwise.

Parameters
line_addrAddress being accessed, block aligned.
typeType of the request that generated the access.
Returns
True if a corresponding entry was found and its stride is not zero.

look for non-unit strides based on a (user-defined) page size

Definition at line 292 of file RubyPrefetcher.cc.

References gem5::ruby::RubySystem::getBlockSizeBytes(), getLRUindex(), initializeStream(), m_train_misses, nonUnitFilter, pageAddress(), gem5::ArmISA::stride, and gem5::X86ISA::type.

Referenced by observeMiss().

◆ accessUnitFilter()

bool gem5::ruby::RubyPrefetcher::accessUnitFilter ( CircularQueue< UnitFilterEntry > *const  filter,
Addr  line_addr,
int  stride,
const RubyRequestType &  type 
)
private

Access a unit stride filter to determine if there is a hit, and update it otherwise.

Parameters
filterUnit filter being accessed.
line_addrAddress being accessed, block aligned.
strideThe stride value.
typeType of the request that generated the access.
Returns
True if a corresponding entry was found.

Definition at line 269 of file RubyPrefetcher.cc.

References getLRUindex(), initializeStream(), m_train_misses, gem5::ruby::makeNextStrideAddress(), gem5::CircularQueue< T >::push_back(), gem5::ArmISA::stride, and gem5::X86ISA::type.

Referenced by observeMiss().

◆ getLRUindex()

uint32_t gem5::ruby::RubyPrefetcher::getLRUindex ( void  )
private

Returns an unused stream buffer (or if all are used, returns the least recently used (accessed) stream buffer).

Returns
The index of the least recently used stream buffer.

Definition at line 191 of file RubyPrefetcher.cc.

References gem5::ArmISA::i, m_array, and m_num_streams.

Referenced by accessNonunitFilter(), and accessUnitFilter().

◆ getPrefetchEntry()

PrefetchEntry * gem5::ruby::RubyPrefetcher::getPrefetchEntry ( Addr  address,
uint32_t &  index 
)
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 251 of file RubyPrefetcher.cc.

References gem5::ArmISA::i, gem5::ArmISA::j, m_array, m_num_startup_pfs, m_num_streams, and gem5::ruby::makeNextStrideAddress().

Referenced by issueNextPrefetch(), and observeMiss().

◆ initializeStream()

void gem5::ruby::RubyPrefetcher::initializeStream ( Addr  address,
int  stride,
uint32_t  index,
const RubyRequestType &  type 
)
private

◆ issueNextPrefetch()

void gem5::ruby::RubyPrefetcher::issueNextPrefetch ( Addr  address,
PrefetchEntry stream 
)

◆ observeMiss()

void gem5::ruby::RubyPrefetcher::observeMiss ( Addr  address,
const RubyRequestType &  type 
)

◆ observePfHit()

void gem5::ruby::RubyPrefetcher::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 144 of file RubyPrefetcher.cc.

References DPRINTF, issueNextPrefetch(), gem5::ruby::RubyPrefetcher::RubyPrefetcherStats::numHits, and rubyPrefetcherStats.

◆ observePfMiss()

void gem5::ruby::RubyPrefetcher::observePfMiss ( Addr  address)

◆ pageAddress()

Addr gem5::ruby::RubyPrefetcher::pageAddress ( Addr  addr) const
private

determine the page aligned address

Definition at line 379 of file RubyPrefetcher.cc.

References gem5::X86ISA::addr, and pageShift.

Referenced by accessNonunitFilter(), initializeStream(), and issueNextPrefetch().

◆ print()

void gem5::ruby::RubyPrefetcher::print ( std::ostream &  out) const

Print out some statistics.

Definition at line 346 of file RubyPrefetcher.cc.

References gem5::ArmISA::i, m_array, m_num_streams, gem5::Named::name(), negativeFilter, nonUnitFilter, and unitFilter.

◆ setController()

void gem5::ruby::RubyPrefetcher::setController ( AbstractController _ctrl)
inline

Definition at line 128 of file RubyPrefetcher.hh.

References m_controller.

Member Data Documentation

◆ m_array

std::vector<PrefetchEntry> gem5::ruby::RubyPrefetcher::m_array
private

an array of the active prefetch streams

Definition at line 210 of file RubyPrefetcher.hh.

Referenced by getLRUindex(), getPrefetchEntry(), initializeStream(), and print().

◆ m_controller

AbstractController* gem5::ruby::RubyPrefetcher::m_controller
private

Definition at line 238 of file RubyPrefetcher.hh.

Referenced by initializeStream(), issueNextPrefetch(), and setController().

◆ m_num_startup_pfs

uint32_t gem5::ruby::RubyPrefetcher::m_num_startup_pfs
private

number of initial prefetches to startup a stream

Definition at line 215 of file RubyPrefetcher.hh.

Referenced by getPrefetchEntry(), initializeStream(), and RubyPrefetcher().

◆ m_num_streams

uint32_t gem5::ruby::RubyPrefetcher::m_num_streams
private

number of prefetch streams available

Definition at line 208 of file RubyPrefetcher.hh.

Referenced by getLRUindex(), getPrefetchEntry(), print(), and RubyPrefetcher().

◆ m_prefetch_cross_pages

bool gem5::ruby::RubyPrefetcher::m_prefetch_cross_pages
private

Used for allowing prefetches across pages.

Definition at line 236 of file RubyPrefetcher.hh.

Referenced by initializeStream(), and issueNextPrefetch().

◆ m_train_misses

uint32_t gem5::ruby::RubyPrefetcher::m_train_misses
private

number of misses I must see before allocating a stream

Definition at line 213 of file RubyPrefetcher.hh.

Referenced by accessNonunitFilter(), and accessUnitFilter().

◆ negativeFilter

CircularQueue<UnitFilterEntry> gem5::ruby::RubyPrefetcher::negativeFilter
private

A negative unit stride filter array: helps reduce BW requirement of prefetching.

Definition at line 227 of file RubyPrefetcher.hh.

Referenced by observeMiss(), and print().

◆ nonUnitFilter

CircularQueue<NonUnitFilterEntry> gem5::ruby::RubyPrefetcher::nonUnitFilter
private

A non-unit stride filter array: helps reduce BW requirement of prefetching.

Definition at line 233 of file RubyPrefetcher.hh.

Referenced by accessNonunitFilter(), and print().

◆ pageShift

const unsigned gem5::ruby::RubyPrefetcher::pageShift
private

Definition at line 240 of file RubyPrefetcher.hh.

Referenced by pageAddress().

◆ rubyPrefetcherStats

gem5::ruby::RubyPrefetcher::RubyPrefetcherStats gem5::ruby::RubyPrefetcher::rubyPrefetcherStats
private

◆ unitFilter

CircularQueue<UnitFilterEntry> gem5::ruby::RubyPrefetcher::unitFilter
private

A unit stride filter array: helps reduce BW requirement of prefetching.

Definition at line 221 of file RubyPrefetcher.hh.

Referenced by observeMiss(), and print().


The documentation for this class was generated from the following files:

Generated on Wed Dec 21 2022 10:24:23 for gem5 by doxygen 1.9.1