gem5  v21.1.0.2
sbooe.cc
Go to the documentation of this file.
1 
30 
31 #include "debug/HWPrefetch.hh"
32 #include "params/SBOOEPrefetcher.hh"
33 
34 namespace gem5
35 {
36 
38 namespace prefetch
39 {
40 
41 SBOOE::SBOOE(const SBOOEPrefetcherParams &p)
42  : Queued(p),
43  sequentialPrefetchers(p.sequential_prefetchers),
44  scoreThreshold((p.sandbox_entries*p.score_threshold_pct)/100),
45  latencyBuffer(p.latency_buffer_size),
46  averageAccessLatency(0), latencyBufferSum(0),
47  bestSandbox(NULL),
48  accesses(0)
49 {
50  // Initialize a sandbox for every sequential prefetcher between
51  // -1 and the number of sequential prefetchers defined
52  for (int i = 0; i < sequentialPrefetchers; i++) {
53  sandboxes.push_back(Sandbox(p.sandbox_entries, i-1));
54  }
55 }
56 
57 void
59 {
60  // Search for the address in the FIFO queue to update the score
61  for (const SandboxEntry &entry: entries) {
62  if (entry.valid && entry.line == addr) {
63  sandboxScore++;
64  if (entry.expectedArrivalTick > curTick()) {
65  lateScore++;
66  }
67  }
68  }
69 
70  // Insert new access in this sandbox
71  SandboxEntry entry;
72  entry.valid = true;
73  entry.line = addr + stride;
74  entry.expectedArrivalTick = tick;
75  entries.push_back(entry);
76 }
77 
78 bool
79 SBOOE::access(Addr access_line)
80 {
81  for (Sandbox &sb : sandboxes) {
82  sb.access(access_line, curTick() + averageAccessLatency);
83 
84  if (bestSandbox == NULL || sb.score() > bestSandbox->score()) {
85  bestSandbox = &sb;
86  }
87  }
88 
89  accesses++;
90 
91  return (accesses >= sandboxes.size());
92 }
93 
94 void
96 {
97  // (1) Look for the address in the demands list
98  // (2) Calculate the elapsed cycles until it was filled (curTick)
99  // (3) Insert the latency into the latency buffer (FIFO)
100  // (4) Calculate the new average access latency
101 
102  auto it = demandAddresses.find(pkt->getAddr());
103 
104  if (it != demandAddresses.end()) {
105  Tick elapsed_ticks = curTick() - it->second;
106 
107  if (latencyBuffer.full()) {
109  }
110  latencyBuffer.push_back(elapsed_ticks);
111  latencyBufferSum += elapsed_ticks;
112 
114 
115  demandAddresses.erase(it);
116  }
117 }
118 
119 void
121  std::vector<AddrPriority> &addresses)
122 {
123  const Addr pfi_addr = pfi.getAddr();
124  const Addr pfi_line = pfi_addr >> lBlkSize;
125 
126  auto it = demandAddresses.find(pfi_addr);
127 
128  if (it == demandAddresses.end()) {
129  demandAddresses.insert(std::pair<Addr, Tick>(pfi_addr, curTick()));
130  }
131 
132  const bool evaluationFinished = access(pfi_line);
133 
134  if (evaluationFinished && bestSandbox->score() > scoreThreshold) {
135  Addr pref_line = pfi_line + bestSandbox->stride;
136  addresses.push_back(AddrPriority(pref_line << lBlkSize, 0));
137  }
138 }
139 
140 } // namespace prefetch
141 } // namespace gem5
gem5::prefetch::Base::PrefetchInfo::getAddr
Addr getAddr() const
Obtains the address value of this Prefetcher address.
Definition: base.hh:125
gem5::curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:46
gem5::prefetch::SBOOE::latencyBufferSum
Tick latencyBufferSum
Holds the current sum of the latency buffer latency.
Definition: sbooe.hh:83
gem5::prefetch::SBOOE::Sandbox::lateScore
unsigned int lateScore
Hits in the sandbox that wouldn't have been filled on time.
Definition: sbooe.hh:112
gem5::prefetch::SBOOE::access
bool access(Addr line)
Process an access to the specified line address and update the sandbox counters counters.
Definition: sbooe.cc:79
gem5::prefetch::Queued::AddrPriority
std::pair< Addr, int32_t > AddrPriority
Definition: queued.hh:190
gem5::prefetch::SBOOE::bestSandbox
const Sandbox * bestSandbox
Current best sandbox.
Definition: sbooe.hh:143
sbooe.hh
gem5::prefetch::SBOOE::sequentialPrefetchers
const int sequentialPrefetchers
Prefetcher parameters.
Definition: sbooe.hh:59
gem5::prefetch::SBOOE::Sandbox::access
void access(Addr line, Tick tick)
Update score and insert the line address being accessed into the FIFO queue of the sandbox.
Definition: sbooe.cc:58
gem5::prefetch::SBOOE::Sandbox::score
unsigned int score() const
Calculate the useful score.
Definition: sbooe.hh:137
gem5::prefetch::SBOOE::demandAddresses
std::unordered_map< Addr, Tick > demandAddresses
Holds the current demand addresses and tick.
Definition: sbooe.hh:69
std::vector
STL vector class.
Definition: stl.hh:37
gem5::prefetch::SBOOE::averageAccessLatency
Tick averageAccessLatency
Holds the current average access latency.
Definition: sbooe.hh:80
gem5::CircularQueue::push_back
void push_back(typename std::vector< T >::value_type val)
Pushes an element at the end of the queue.
Definition: circular_queue.hh:502
gem5::CircularQueue::full
bool full() const
Is the queue full? A queue is full if the head is the 0^{th} element and the tail is the (size-1)^{th...
Definition: circular_queue.hh:558
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
gem5::prefetch::SBOOE::Sandbox
Definition: sbooe.hh:99
gem5::prefetch::SBOOE::latencyBuffer
CircularQueue< Tick > latencyBuffer
The latency buffer holds the elapsed ticks between the demand and the fill in the cache for the lates...
Definition: sbooe.hh:77
gem5::CircularQueue::size
size_t size() const
Definition: circular_queue.hh:466
gem5::prefetch::SBOOE::Sandbox::entries
CircularQueue< SandboxEntry > entries
FIFO queue containing the sandbox entries.
Definition: sbooe.hh:103
gem5::prefetch::SBOOE::SBOOE
SBOOE(const SBOOEPrefetcherParams &p)
Definition: sbooe.cc:41
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::prefetch::SBOOE::Sandbox::sandboxScore
unsigned int sandboxScore
Accesses during the eval period that were present in the sandbox.
Definition: sbooe.hh:109
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::prefetch::SBOOE::accesses
unsigned int accesses
Number of accesses notified to the prefetcher.
Definition: sbooe.hh:146
gem5::prefetch::SBOOE::SandboxEntry::expectedArrivalTick
Tick expectedArrivalTick
Tick when the simulated prefetch is expected to be filled.
Definition: sbooe.hh:90
gem5::prefetch::SBOOE::sandboxes
std::vector< Sandbox > sandboxes
Definition: sbooe.hh:140
gem5::CircularQueue::front
reference front()
Definition: circular_queue.hh:441
std::pair
STL pair class.
Definition: stl.hh:58
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::ArmISA::sb
Bitfield< 39, 36 > sb
Definition: misc_types.hh:108
gem5::prefetch::Queued
Definition: queued.hh:60
gem5::prefetch::SBOOE::scoreThreshold
const unsigned int scoreThreshold
Threshold used to issue prefetchers.
Definition: sbooe.hh:62
gem5::prefetch::Base::lBlkSize
unsigned lBlkSize
log_2(block size of the parent cache).
Definition: base.hh:273
gem5::prefetch::SBOOE::SandboxEntry::valid
bool valid
To indicate if it was initialized.
Definition: sbooe.hh:92
gem5::prefetch::SBOOE::calculatePrefetch
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Definition: sbooe.cc:120
gem5::prefetch::SBOOE::notifyFill
void notifyFill(const PacketPtr &pkt) override
Update the latency buffer after a prefetch fill.
Definition: sbooe.cc:95
gem5::Clocked::tick
Tick tick
Definition: clocked_object.hh:68
gem5::context_switch_task_id::Prefetcher
@ Prefetcher
Definition: request.hh:83
gem5::Packet::getAddr
Addr getAddr() const
Definition: packet.hh:781
gem5::prefetch::SBOOE::Sandbox::stride
const int stride
Sequential stride for this prefetcher.
Definition: sbooe.hh:116
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::prefetch::Base::PrefetchInfo
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:97
gem5::prefetch::SBOOE::SandboxEntry::line
Addr line
Cache line predicted by the candidate prefetcher.
Definition: sbooe.hh:88
gem5::prefetch::SBOOE::SandboxEntry
Definition: sbooe.hh:85
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Tue Sep 21 2021 12:25:29 for gem5 by doxygen 1.8.17