31 #include "debug/RubyPrefetcher.hh"
36 PrefetcherParams::create()
42 :
SimObject(p), m_num_streams(p->num_streams),
43 m_array(p->num_streams), m_train_misses(p->train_misses),
44 m_num_startup_pfs(p->num_startup_pfs), m_num_unit_filters(p->unit_filter),
45 m_num_nonunit_filters(p->nonunit_filter),
46 m_unit_filter(p->unit_filter, 0),
47 m_negative_filter(p->unit_filter, 0),
48 m_nonunit_filter(p->nonunit_filter, 0),
49 m_prefetch_cross_pages(p->cross_page),
50 m_page_shift(p->sys->getPageShift())
94 .
desc(
"number of misses observed")
99 .
desc(
"number of streams allocated for prefetching")
103 .
name(
name() +
".prefetches_requested")
104 .
desc(
"number of prefetch requests made")
108 .
name(
name() +
".prefetches_accepted")
109 .
desc(
"number of prefetch requests accepted")
113 .
name(
name() +
".dropped_prefetches")
114 .
desc(
"number of prefetch requests dropped")
119 .
desc(
"number of prefetched blocks accessed")
124 .
desc(
"number of misses observed for a block being prefetched")
129 .
desc(
"number of prefetches across pages")
133 .
name(
name() +
".misses_on_prefetched_blocks")
134 .
desc(
"number of misses for blocks that were prefetched, yet missed")
141 DPRINTF(RubyPrefetcher,
"Observed miss for %#x\n", address);
148 if (pfEntry != NULL) {
178 DPRINTF(RubyPrefetcher,
" *** hit in unit stride buffer\n");
189 DPRINTF(RubyPrefetcher,
" *** hit in unit negative unit buffer\n");
201 DPRINTF(RubyPrefetcher,
" *** hit in non-unit stride buffer\n");
210 DPRINTF(RubyPrefetcher,
"Observed partial hit for %#x\n", address);
218 DPRINTF(RubyPrefetcher,
"Observed hit for %#x\n", address);
226 if (stream == NULL) {
232 if (stream == NULL) {
233 DPRINTF(RubyPrefetcher,
"Unallocated stream, returning\n");
256 DPRINTF(RubyPrefetcher,
"Requesting prefetch for %#x\n", line_addr);
263 uint32_t lru_index = 0;
270 if (
m_array[
i].m_use_time < lru_access) {
289 uint32_t
index,
const RubyRequestType&
type)
320 DPRINTF(RubyPrefetcher,
"Requesting prefetch for %#x\n", line_addr);
348 uint32_t *filter_hit, uint32_t &
index,
Addr address,
356 if (filter_table[
i] == line_addr) {
367 int local_index =
index;
369 filter_hit[local_index] = 0;
370 local_index = local_index + 1;
371 if (local_index >= m_num_unit_filters) {
422 m_nonunit_filter[
i] = line_addr;
445 out <<
name() <<
" Prefetcher State\n";
447 out <<
"unit table:\n";
452 out <<
"negative table:\n";
458 out <<
"non-unit table:\n";
471 <<
m_array[
i].m_use_time << std::endl;
uint32_t m_negative_filter_index
a round robin pointer into the negative filter group
Stats::Scalar numPartialHits
Count of partial successful prefetches.
int * m_nonunit_stride
An array of strides (in # of cache lines) for the filter entries.
Cycles is a wrapper class for representing cycle counts, i.e.
uint32_t getLRUindex(void)
Returns an unused stream buffer (or if all are used, returns the least recently used (accessed) strea...
std::bitset< MAX_PF_INFLIGHT > requestIssued
Bitset for tracking prefetches for which addresses have been issued, which ones have completed...
Stats::Scalar numMissedPrefetchedBlocks
Count of misses incurred for blocks that were prefetched.
Stats::Scalar numMissObserved
Count of accesses to the prefetcher.
Bitfield< 21, 20 > stride
void observePfHit(Addr address)
Implement the prefetch hit(miss) callback interface.
virtual void enqueuePrefetch(const Addr &, const RubyRequestType &)
Function for enqueuing a prefetch request.
RubyRequestType m_type
L1D prefetches loads and stores.
Stats::Scalar numHits
Count of successful prefetches.
void clearNonunitEntry(uint32_t index)
clear a non-unit stride prefetcher entry
virtual void regStats()
Register statistics for this object.
Prefetcher(const Params *p)
int m_stride
stride distance to get next address from
std::vector< Addr > m_negative_filter
a negative nit stride filter array: helps reduce BW requirement of prefetching
uint32_t m_train_misses
number of misses I must see before allocating a stream
Stats::Scalar numPrefetchAccepted
Count of prefetch requests accepted.
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
uint32_t m_unit_filter_index
a round robin pointer into the unit filter group
std::vector< Addr > m_nonunit_filter
a non-unit stride filter array: helps reduce BW requirement of prefetching
bool m_is_valid
valid bit for each stream
uint32_t m_num_nonunit_filters
number of non-stride filters
bool accessNonunitFilter(Addr address, int *stride, bool &alloc)
access a unit stride filter to determine if there is a hit
Stats::Scalar numPagesCrossed
Count of pages crossed.
uint32_t * m_nonunit_hit
An array used to count the of times particular filter entries have been hit.
void initializeStream(Addr address, int stride, uint32_t index, const RubyRequestType &type)
allocate a new stream buffer at a specific index
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool m_prefetch_cross_pages
Used for allowing prefetches across pages.
Addr makeLineAddress(Addr addr)
void regStats()
Register statistics for this object.
std::vector< PrefetchEntry > m_array
an array of the active prefetch streams
Addr m_address
The base address for the stream prefetch.
void issueNextPrefetch(Addr address, PrefetchEntry *stream)
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
uint32_t m_nonunit_index
a round robin pointer into the unit filter group
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
virtual const std::string name() const
uint32_t m_num_unit_filters
number of stride filters
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 s...
Addr pageAddress(Addr addr) const
determine the page aligned address
void observeMiss(Addr address, const RubyRequestType &type)
Observe a memory miss from the cache.
Stats::Scalar numPrefetchRequested
Count of prefetch requests made.
std::bitset< MAX_PF_INFLIGHT > requestCompleted
uint32_t * m_unit_filter_hit
An array used to count the of times particular filter entries have been hit.
void print(std::ostream &out) const
Print out some statistics.
Stats::Scalar numAllocatedStreams
Count of prefetch streams allocated.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
uint32_t m_num_streams
number of prefetch streams available
uint32_t * m_negative_filter_hit
An array used to count the of times particular filter entries have been hit.
uint32_t m_num_startup_pfs
number of initial prefetches to startup a stream
Addr makeNextStrideAddress(Addr addr, int stride)
static uint32_t getBlockSizeBytes()
AbstractController * m_controller
Abstract superclass for simulation objects.
void observePfMiss(Addr address)
Addr maskLowOrderBits(Addr addr, unsigned int number)
Stats::Scalar numDroppedPrefetches
Count of prefetches dropped.
std::vector< Addr > m_unit_filter
a unit stride filter array: helps reduce BW requirement of prefetching
Cycles m_use_time
the last time that any prefetched request was used