gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
37 namespace prefetch
38 {
39 
40 SBOOE::SBOOE(const SBOOEPrefetcherParams &p)
41  : Queued(p),
42  sequentialPrefetchers(p.sequential_prefetchers),
43  scoreThreshold((p.sandbox_entries*p.score_threshold_pct)/100),
44  latencyBuffer(p.latency_buffer_size),
45  averageAccessLatency(0), latencyBufferSum(0),
46  bestSandbox(NULL),
47  accesses(0)
48 {
49  // Initialize a sandbox for every sequential prefetcher between
50  // -1 and the number of sequential prefetchers defined
51  for (int i = 0; i < sequentialPrefetchers; i++) {
52  sandboxes.push_back(Sandbox(p.sandbox_entries, i-1));
53  }
54 }
55 
56 void
58 {
59  // Search for the address in the FIFO queue to update the score
60  for (const SandboxEntry &entry: entries) {
61  if (entry.valid && entry.line == addr) {
62  sandboxScore++;
63  if (entry.expectedArrivalTick > curTick()) {
64  lateScore++;
65  }
66  }
67  }
68 
69  // Insert new access in this sandbox
70  SandboxEntry entry;
71  entry.valid = true;
72  entry.line = addr + stride;
73  entry.expectedArrivalTick = tick;
74  entries.push_back(entry);
75 }
76 
77 bool
78 SBOOE::access(Addr access_line)
79 {
80  for (Sandbox &sb : sandboxes) {
81  sb.access(access_line, curTick() + averageAccessLatency);
82 
83  if (bestSandbox == NULL || sb.score() > bestSandbox->score()) {
84  bestSandbox = &sb;
85  }
86  }
87 
88  accesses++;
89 
90  return (accesses >= sandboxes.size());
91 }
92 
93 void
95 {
96  // (1) Look for the address in the demands list
97  // (2) Calculate the elapsed cycles until it was filled (curTick)
98  // (3) Insert the latency into the latency buffer (FIFO)
99  // (4) Calculate the new average access latency
100 
101  auto it = demandAddresses.find(pkt->getAddr());
102 
103  if (it != demandAddresses.end()) {
104  Tick elapsed_ticks = curTick() - it->second;
105 
106  if (latencyBuffer.full()) {
108  }
109  latencyBuffer.push_back(elapsed_ticks);
110  latencyBufferSum += elapsed_ticks;
111 
113 
114  demandAddresses.erase(it);
115  }
116 }
117 
118 void
120  std::vector<AddrPriority> &addresses)
121 {
122  const Addr pfi_addr = pfi.getAddr();
123  const Addr pfi_line = pfi_addr >> lBlkSize;
124 
125  auto it = demandAddresses.find(pfi_addr);
126 
127  if (it == demandAddresses.end()) {
128  demandAddresses.insert(std::pair<Addr, Tick>(pfi_addr, curTick()));
129  }
130 
131  const bool evaluationFinished = access(pfi_line);
132 
133  if (evaluationFinished && bestSandbox->score() > scoreThreshold) {
134  Addr pref_line = pfi_line + bestSandbox->stride;
135  addresses.push_back(AddrPriority(pref_line << lBlkSize, 0));
136  }
137 }
138 
139 } // namespace prefetch
140 } // namespace gem5
gem5::prefetch::Base::PrefetchInfo::getAddr
Addr getAddr() const
Obtains the address value of this Prefetcher address.
Definition: base.hh:124
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:82
gem5::prefetch::SBOOE::Sandbox::lateScore
unsigned int lateScore
Hits in the sandbox that wouldn't have been filled on time.
Definition: sbooe.hh:111
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:78
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:142
sbooe.hh
gem5::prefetch::SBOOE::sequentialPrefetchers
const int sequentialPrefetchers
Prefetcher parameters.
Definition: sbooe.hh:58
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:57
gem5::prefetch::SBOOE::Sandbox::score
unsigned int score() const
Calculate the useful score.
Definition: sbooe.hh:136
gem5::prefetch::SBOOE::demandAddresses
std::unordered_map< Addr, Tick > demandAddresses
Holds the current demand addresses and tick.
Definition: sbooe.hh:68
std::vector
STL vector class.
Definition: stl.hh:37
gem5::prefetch::SBOOE::averageAccessLatency
Tick averageAccessLatency
Holds the current average access latency.
Definition: sbooe.hh:79
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:67
gem5::prefetch::SBOOE::Sandbox
Definition: sbooe.hh:98
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:76
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:102
gem5::prefetch::SBOOE::SBOOE
SBOOE(const SBOOEPrefetcherParams &p)
Definition: sbooe.cc:40
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::prefetch::SBOOE::Sandbox::sandboxScore
unsigned int sandboxScore
Accesses during the eval period that were present in the sandbox.
Definition: sbooe.hh:108
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:145
gem5::prefetch::SBOOE::SandboxEntry::expectedArrivalTick
Tick expectedArrivalTick
Tick when the simulated prefetch is expected to be filled.
Definition: sbooe.hh:89
gem5::prefetch::SBOOE::sandboxes
std::vector< Sandbox > sandboxes
Definition: sbooe.hh:139
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::prefetch::Queued
Definition: queued.hh:59
gem5::prefetch::SBOOE::scoreThreshold
const unsigned int scoreThreshold
Threshold used to issue prefetchers.
Definition: sbooe.hh:61
gem5::ArmISA::sb
Bitfield< 15, 12 > sb
Definition: misc_types.hh:93
gem5::prefetch::Base::lBlkSize
unsigned lBlkSize
log_2(block size of the parent cache).
Definition: base.hh:272
gem5::prefetch::SBOOE::SandboxEntry::valid
bool valid
To indicate if it was initialized.
Definition: sbooe.hh:91
gem5::prefetch::SBOOE::calculatePrefetch
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Definition: sbooe.cc:119
gem5::prefetch::SBOOE::notifyFill
void notifyFill(const PacketPtr &pkt) override
Update the latency buffer after a prefetch fill.
Definition: sbooe.cc:94
gem5::Clocked::tick
Tick tick
Definition: clocked_object.hh:68
gem5::Packet::getAddr
Addr getAddr() const
Definition: packet.hh:807
gem5::prefetch::SBOOE::Sandbox::stride
const int stride
Sequential stride for this prefetcher.
Definition: sbooe.hh:115
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::prefetch::Base::PrefetchInfo
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Definition: base.hh:96
gem5::prefetch::SBOOE::SandboxEntry::line
Addr line
Cache line predicted by the candidate prefetcher.
Definition: sbooe.hh:87
gem5::prefetch::SBOOE::SandboxEntry
Definition: sbooe.hh:84
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Sun Jul 30 2023 01:56:57 for gem5 by doxygen 1.8.17