gem5  v20.1.0.0
tage_sc_l.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Metempsy Technology Consulting
3  * All rights reserved.
4  *
5  * Copyright (c) 2006 INRIA (Institut National de Recherche en
6  * Informatique et en Automatique / French National Research Institute
7  * for Computer Science and Applied Mathematics)
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are
13  * met: redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer;
15  * redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution;
18  * neither the name of the copyright holders nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  * Author: AndrĂ© Seznec, Pau Cabre, Javier Bueno
35  *
36  */
37 
38 /*
39  * TAGE-SC-L branch predictor base class (devised by Andre Seznec)
40  * It consits of a TAGE + a statistical corrector (SC) + a loop predictor (L)
41  */
42 
43 #include "cpu/pred/tage_sc_l.hh"
44 
45 #include "base/random.hh"
46 #include "debug/TageSCL.hh"
47 
48 bool
50 {
53 }
54 
55 bool
57 {
58  return (random_mt.random<int>() & 7) == 0;
59 }
60 
62 TAGE_SC_L_LoopPredictorParams::create()
63 {
64  return new TAGE_SC_L_LoopPredictor(this);
65 }
66 
67 TAGE_SC_L::TAGE_SC_L(const TAGE_SC_LParams *p)
68  : LTAGE(p), statisticalCorrector(p->statistical_corrector)
69 {
70 }
71 
74 {
75  return new BranchInfo(*this);
76 }
77 void
79 {
80  unsigned numHistLengths = nHistoryTables/2;
81  histLengths[1] = minHist;
82  histLengths[numHistLengths] = maxHist;
83 
84  // This calculates the different history lenghts
85  // there are only numHistLengths different lengths
86  // They are initially set to the lower half of histLengths
87  for (int i = 2; i <= numHistLengths; i++) {
88  histLengths[i] = (int) (((double) minHist *
89  pow ((double) (maxHist) / (double) minHist,
90  (double) (i - 1) / (double) ((numHistLengths - 1))))
91  + 0.5);
92  }
93 
94  // This copies and duplicates the values from the lower half of the table
95  // Ex: 4, 6, 9, 13 would get exanded to 4, 4, 6, 6, 9, 9, 13, 13
96  for (int i = nHistoryTables; i > 1; i--)
97  {
98  histLengths[i] = histLengths[(i + 1) / 2];
99  }
100 
101  for (int i = 1; i <= nHistoryTables; i++)
102  {
103  tagTableTagWidths.push_back(
105 
107  }
108 }
109 
110 void
112 {
113  // Trick! We only allocate entries for tables 1 and firstLongTagTable and
114  // make the other tables point to these allocated entries
115 
119  for (int i = 2; i < firstLongTagTable; ++i) {
120  gtable[i] = gtable[1];
121  }
122  for (int i = firstLongTagTable + 1; i <= nHistoryTables; ++i) {
124  }
125 }
126 
127 void
130 {
131  // computes the table addresses and the partial tags
132 
133  for (int i = 1; i <= nHistoryTables; i += 2) {
134  tableIndices[i] = gindex(tid, pc, i);
135  tableTags[i] = gtag(tid, pc, i);
136  tableTags[i + 1] = tableTags[i];
137  tableIndices[i + 1] = tableIndices[i] ^
138  (tableTags[i] & ((1 << logTagTableSizes[i]) - 1));
139 
140  bi->tableTags[i] = tableTags[i];
141  bi->tableTags[i+1] = tableTags[i+1];
142  }
143 
144  Addr t = (pc ^ (threadHistory[tid].pathHist &
145  ((1 << histLengths[firstLongTagTable]) - 1)))
147 
148  for (int i = firstLongTagTable; i <= nHistoryTables; i++) {
149  if (noSkip[i]) {
150  tableIndices[i] += (t << logTagTableSizes[i]);
151  bi->tableIndices[i] = tableIndices[i];
152  t++;
153  t = t % longTagsTageFactor;
154  }
155  }
156 
157  t = (pc ^ (threadHistory[tid].pathHist & ((1 << histLengths[1]) - 1)))
159 
160  for (int i = 1; i <= firstLongTagTable - 1; i++) {
161  if (noSkip[i]) {
162  tableIndices[i] += (t << logTagTableSizes[i]);
163  bi->tableIndices[i] = tableIndices[i];
164  t++;
165  t = t % shortTagsTageFactor;
166  }
167  }
168 }
169 
170 unsigned
172 {
173  BranchInfo *tbi = static_cast<BranchInfo *>(bi);
174  unsigned idx;
175  idx = ((((bi->hitBank-1)/8)<<1)+tbi->altConf) % (numUseAltOnNa-1);
176  return idx;
177 }
178 
179 int
180 TAGE_SC_L_TAGE::gindex(ThreadID tid, Addr pc, int bank) const
181 {
182  int index;
183  int hlen = (histLengths[bank] > pathHistBits) ? pathHistBits :
184  histLengths[bank];
185  unsigned int shortPc = pc;
186 
187  // pc is not shifted by instShiftAmt in this implementation
188  index = shortPc ^
189  (shortPc >> ((int) abs(logTagTableSizes[bank] - bank) + 1)) ^
190  threadHistory[tid].computeIndices[bank].comp ^
191  F(threadHistory[tid].pathHist, hlen, bank);
192 
193  index = gindex_ext(index, bank);
194 
195  return (index & ((ULL(1) << (logTagTableSizes[bank])) - 1));
196 }
197 
198 int
199 TAGE_SC_L_TAGE::F(int a, int size, int bank) const
200 {
201  int a1, a2;
202 
203  a = a & ((ULL(1) << size) - 1);
204  a1 = (a & ((ULL(1) << logTagTableSizes[bank]) - 1));
205  a2 = (a >> logTagTableSizes[bank]);
206 
207  if (bank < logTagTableSizes[bank]) {
208  a2 = ((a2 << bank) & ((ULL(1) << logTagTableSizes[bank]) - 1))
209  + (a2 >> (logTagTableSizes[bank] - bank));
210  }
211 
212  a = a1 ^ a2;
213 
214  if (bank < logTagTableSizes[bank]) {
215  a = ((a << bank) & ((ULL(1) << logTagTableSizes[bank]) - 1))
216  + (a >> (logTagTableSizes[bank] - bank));
217  }
218 
219  return a;
220 }
221 
222 int
224 {
225  return ((pc ^ (pc >> instShiftAmt)) &
226  ((ULL(1) << (logTagTableSizes[0])) - 1));
227 }
228 
229 void
231  ThreadHistory& tHist, int brtype, bool taken, Addr branch_pc, Addr target)
232 {
233  // TAGE update
234  int tmp = ((branch_pc ^ (branch_pc >> instShiftAmt))) ^ taken;
235  int path = branch_pc ^ (branch_pc >> instShiftAmt)
236  ^ (branch_pc >> (instShiftAmt+2));
237  if ((brtype == 3) & taken) {
238  tmp = (tmp ^ (target >> instShiftAmt));
239  path = path ^ (target >> instShiftAmt) ^ (target >> (instShiftAmt+2));
240  }
241 
242  // some branch types use 3 bits in global history, the others just 2
243  int maxt = (brtype == 2) ? 3 : 2;
244 
245  for (int t = 0; t < maxt; t++) {
246  bool dir = (tmp & 1);
247  tmp >>= 1;
248  int pathbit = (path & 127);
249  path >>= 1;
250  updateGHist(tHist.gHist, dir, tHist.globalHistory, tHist.ptGhist);
251  tHist.pathHist = (tHist.pathHist << 1) ^ pathbit;
252  if (truncatePathHist) {
253  // The 8KB implementation does not do this truncation
254  tHist.pathHist = (tHist.pathHist & ((ULL(1) << pathHistBits) - 1));
255  }
256  for (int i = 1; i <= nHistoryTables; i++) {
257  tHist.computeIndices[i].update(tHist.gHist);
258  tHist.computeTags[0][i].update(tHist.gHist);
259  tHist.computeTags[1][i].update(tHist.gHist);
260  }
261  }
262 }
263 
264 void
266  ThreadID tid, Addr branch_pc, bool taken, TAGEBase::BranchInfo* b,
267  bool speculative, const StaticInstPtr &inst, Addr target)
268 {
269  if (speculative != speculativeHistUpdate) {
270  return;
271  }
272  // speculation is not implemented
273  assert(! speculative);
274 
275  ThreadHistory& tHist = threadHistory[tid];
276 
277  int brtype = inst->isDirectCtrl() ? 0 : 2;
278  if (! inst->isUncondCtrl()) {
279  ++brtype;
280  }
281  updatePathAndGlobalHistory(tHist, brtype, taken, branch_pc, target);
282 
283  DPRINTF(TageSCL, "Updating global histories with branch:%lx; taken?:%d, "
284  "path Hist: %x; pointer:%d\n", branch_pc, taken, tHist.pathHist,
285  tHist.ptGhist);
286 }
287 
288 void
290  Addr target)
291 {
292  fatal("Speculation is not implemented");
293 }
294 
295 void
296 TAGE_SC_L_TAGE::adjustAlloc(bool & alloc, bool taken, bool pred_taken)
297 {
298  // Do not allocate too often if the prediction is ok
299  if ((taken == pred_taken) && ((random_mt.random<int>() & 31) != 0)) {
300  alloc = false;
301  }
302 }
303 
304 int
306 {
307  int a = 1;
308  if ((random_mt.random<int>() & 127) < 32) {
309  a = 2;
310  }
311  return ((((bi->hitBank - 1 + 2 * a) & 0xffe)) ^
312  (random_mt.random<int>() & 1));
313 }
314 
315 void
317 {
318  //just the best formula for the Championship:
319  //In practice when one out of two entries are useful
320  if (tCounter < 0) {
321  tCounter = 0;
322  }
323 
324  if (tCounter >= ((ULL(1) << logUResetPeriod))) {
325  // Update the u bits for the short tags table
326  for (int j = 0; j < (shortTagsTageFactor*(1<<logTagTableSize)); j++) {
327  resetUctr(gtable[1][j].u);
328  }
329 
330  // Update the u bits for the long tags table
331  for (int j = 0; j < (longTagsTageFactor*(1<<logTagTableSize)); j++) {
333  }
334 
335  tCounter = 0;
336  }
337 }
338 
339 bool
341 {
343  static_cast<TAGE_SC_L_TAGE::BranchInfo *>(tage_bi);
344 
345  int bim = (btablePrediction[bi->bimodalIndex] << 1)
346  + btableHysteresis[bi->bimodalIndex >> logRatioBiModalHystEntries];
347 
348  bi->highConf = (bim == 0) || (bim == 3);
349  bi->lowConf = ! bi->highConf;
350  bi->altConf = bi->highConf;
351  bi->medConf = false;
352  return TAGEBase::getBimodePred(pc, tage_bi);
353 }
354 
355 void
357 {
358  TAGE_SC_L_TAGE::BranchInfo *tage_scl_bi =
359  static_cast<TAGE_SC_L_TAGE::BranchInfo *>(bi);
360  int8_t ctr = gtable[bi->altBank][bi->altBankIndex].ctr;
361  tage_scl_bi->altConf = (abs(2*ctr + 1) > 1);
362 }
363 
364 bool
365 TAGE_SC_L::predict(ThreadID tid, Addr branch_pc, bool cond_branch, void* &b)
366 {
369  *loopPredictor);
370  b = (void*)(bi);
371 
372  bool pred_taken = tage->tagePredict(tid, branch_pc, cond_branch,
373  bi->tageBranchInfo);
374  pred_taken = loopPredictor->loopPredict(tid, branch_pc, cond_branch,
375  bi->lpBranchInfo, pred_taken,
376  instShiftAmt);
377 
378  if (bi->lpBranchInfo->loopPredUsed) {
379  bi->tageBranchInfo->provider = LOOP;
380  }
381 
382  TAGE_SC_L_TAGE::BranchInfo* tage_scl_bi =
383  static_cast<TAGE_SC_L_TAGE::BranchInfo *>(bi->tageBranchInfo);
384 
385  // Copy the confidences computed by TAGE
386  bi->scBranchInfo->lowConf = tage_scl_bi->lowConf;
387  bi->scBranchInfo->highConf = tage_scl_bi->highConf;
388  bi->scBranchInfo->altConf = tage_scl_bi->altConf;
389  bi->scBranchInfo->medConf = tage_scl_bi->medConf;
390 
391  bool use_tage_ctr = bi->tageBranchInfo->hitBank > 0;
392  int8_t tage_ctr = use_tage_ctr ?
393  tage->getCtr(tage_scl_bi->hitBank, tage_scl_bi->hitBankIndex) : 0;
394  bool bias = (bi->tageBranchInfo->longestMatchPred !=
395  bi->tageBranchInfo->altTaken);
396 
397  pred_taken = statisticalCorrector->scPredict(tid, branch_pc, cond_branch,
398  bi->scBranchInfo, pred_taken, bias, use_tage_ctr, tage_ctr,
399  tage->getTageCtrBits(), bi->tageBranchInfo->hitBank,
400  bi->tageBranchInfo->altBank, tage->getPathHist(tid));
401 
402  if (bi->scBranchInfo->usedScPred) {
403  bi->tageBranchInfo->provider = SC;
404  }
405 
406  // record final prediction
407  bi->lpBranchInfo->predTaken = pred_taken;
408 
409  return pred_taken;
410 }
411 
412 void
413 TAGE_SC_L::update(ThreadID tid, Addr branch_pc, bool taken, void *bp_history,
414  bool squashed, const StaticInstPtr & inst, Addr corrTarget)
415 {
416  assert(bp_history);
417 
418  TageSCLBranchInfo* bi = static_cast<TageSCLBranchInfo*>(bp_history);
419  TAGE_SC_L_TAGE::BranchInfo* tage_bi =
420  static_cast<TAGE_SC_L_TAGE::BranchInfo *>(bi->tageBranchInfo);
421 
422  if (squashed) {
424  // This restores the global history, then update it
425  // and recomputes the folded histories.
426  tage->squash(tid, taken, tage_bi, corrTarget);
427  if (bi->tageBranchInfo->condBranch) {
428  loopPredictor->squashLoop(bi->lpBranchInfo);
429  }
430  }
431  return;
432  }
433 
434  int nrand = random_mt.random<int>() & 3;
435  if (tage_bi->condBranch) {
436  DPRINTF(TageSCL, "Updating tables for branch:%lx; taken?:%d\n",
437  branch_pc, taken);
438  tage->updateStats(taken, bi->tageBranchInfo);
439 
440  loopPredictor->updateStats(taken, bi->lpBranchInfo);
441 
442  statisticalCorrector->updateStats(taken, bi->scBranchInfo);
443 
444  bool bias = (bi->tageBranchInfo->longestMatchPred !=
445  bi->tageBranchInfo->altTaken);
446  statisticalCorrector->condBranchUpdate(tid, branch_pc, taken,
447  bi->scBranchInfo, corrTarget, bias, bi->tageBranchInfo->hitBank,
448  bi->tageBranchInfo->altBank, tage->getPathHist(tid));
449 
450  loopPredictor->condBranchUpdate(tid, branch_pc, taken,
451  bi->tageBranchInfo->tagePred, bi->lpBranchInfo, instShiftAmt);
452 
453  tage->condBranchUpdate(tid, branch_pc, taken, bi->tageBranchInfo,
454  nrand, corrTarget, bi->lpBranchInfo->predTaken);
455  }
456 
458  statisticalCorrector->scHistoryUpdate(branch_pc, inst, taken,
459  bi->scBranchInfo, corrTarget);
460 
461  tage->updateHistories(tid, branch_pc, taken, bi->tageBranchInfo, false,
462  inst, corrTarget);
463  }
464 
465  delete bi;
466 }
467 
468 void
470 {
471  LTAGE::regStats();
472 }
TAGE_SC_L_TAGE::buildTageTables
void buildTageTables() override
Instantiates the TAGE table entries.
Definition: tage_sc_l.cc:111
fatal
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:183
TAGEBase::tagTableTagWidths
std::vector< unsigned > tagTableTagWidths
Definition: tage_base.hh:425
StaticInst::isDirectCtrl
bool isDirectCtrl() const
Definition: static_inst.hh:178
TAGE_SC_L_TAGE::BranchInfo::highConf
bool highConf
Definition: tage_sc_l.hh:67
LTAGE::regStats
virtual void regStats() override
Callback to set stat parameters.
Definition: ltage.cc:145
TAGEBase::nHistoryTables
const unsigned nHistoryTables
Definition: tage_base.hh:417
MipsISA::index
Bitfield< 30, 0 > index
Definition: pra_constants.hh:44
LoopPredictor::updateStats
void updateStats(bool taken, BranchInfo *bi)
Update the stats.
Definition: loop_predictor.cc:315
TAGE_SC_L_TAGE::logTagTableSize
const unsigned logTagTableSize
Definition: tage_sc_l.hh:57
TAGEBase::histLengths
int * histLengths
Definition: tage_base.hh:462
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
TAGEBase::ThreadHistory::ptGhist
int ptGhist
Definition: tage_base.hh:448
TAGEBase::getTageCtrBits
unsigned getTageCtrBits() const
Definition: tage_base.cc:760
ThreadID
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:227
TAGE_SC_L_TAGE::truncatePathHist
const bool truncatePathHist
Definition: tage_sc_l.hh:62
TAGE_SC_L_LoopPredictor
Definition: tage_sc_l.hh:137
TAGE_SC_L::regStats
void regStats() override
Callback to set stat parameters.
Definition: tage_sc_l.cc:469
TAGE_SC_L_TAGE::shortTagsTageFactor
const unsigned shortTagsTageFactor
Definition: tage_sc_l.hh:59
TAGEBase::minHist
const unsigned minHist
Definition: tage_base.hh:421
TAGE_SC_L_TAGE::calcDep
int calcDep(TAGEBase::BranchInfo *bi)
Definition: tage_sc_l.cc:305
random.hh
LTAGE
Definition: ltage.hh:60
TAGEBase::ThreadHistory::computeTags
FoldedHistory * computeTags[2]
Definition: tage_base.hh:452
TAGE_SC_L_TAGE::squash
void squash(ThreadID tid, bool taken, TAGEBase::BranchInfo *bi, Addr target) override
Restores speculatively updated path and direction histories.
Definition: tage_sc_l.cc:289
TAGEBase::BranchInfo
Definition: tage_base.hh:120
TAGE_SC_L::statisticalCorrector
StatisticalCorrector * statisticalCorrector
Definition: tage_sc_l.hh:150
ArmISA::tbi
Bitfield< 20 > tbi
Definition: miscregs_types.hh:509
TAGE_SC_L::TAGE_SC_L
TAGE_SC_L(const TAGE_SC_LParams *params)
Definition: tage_sc_l.cc:67
TAGEBase::ThreadHistory
Definition: tage_base.hh:434
TAGE_SC_L_TAGE::BranchInfo::medConf
bool medConf
Definition: tage_sc_l.hh:69
TAGEBase::noSkip
std::vector< bool > noSkip
Definition: tage_base.hh:477
TAGEBase::getBimodePred
virtual bool getBimodePred(Addr pc, BranchInfo *bi) const
Get a branch prediction from the bimodal predictor.
Definition: tage_base.cc:287
LTAGE::LOOP
@ LOOP
Definition: ltage.hh:80
BPredUnit::instShiftAmt
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
Definition: bpred_unit.hh:312
TAGE_SC_L_TAGE::bindex
int bindex(Addr pc_in) const override
Computes the index used to access the bimodal table.
Definition: tage_sc_l.cc:223
LoopPredictor::calcConf
virtual bool calcConf(int index) const
Definition: loop_predictor.cc:150
TAGEBase::getCtr
int8_t getCtr(int hitBank, int hitBankIndex) const
Definition: tage_base.cc:754
TAGE_SC_L_TAGE::calculateParameters
void calculateParameters() override
Calculates the history lengths and some other paramters in derived classes.
Definition: tage_sc_l.cc:78
TAGE_SC_L_TAGE::BranchInfo::lowConf
bool lowConf
Definition: tage_sc_l.hh:66
random_mt
Random random_mt
Definition: random.cc:96
TAGEBase::threadHistory
std::vector< ThreadHistory > threadHistory
Definition: tage_base.hh:455
TAGE_SC_L_TAGE::gindex
int gindex(ThreadID tid, Addr pc, int bank) const override
Computes the index used to access a partially tagged table.
Definition: tage_sc_l.cc:180
TAGEBase::btableHysteresis
std::vector< bool > btableHysteresis
Definition: tage_base.hh:429
PowerISA::bi
Bitfield< 20, 16 > bi
Definition: types.hh:63
TAGEBase::condBranchUpdate
virtual void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi, int nrand, Addr corrTarget, bool pred, bool preAdjustAlloc=false)
Update TAGE for conditional branches.
Definition: tage_base.cc:508
ArmISA::j
Bitfield< 24 > j
Definition: miscregs_types.hh:54
TAGEBase::tableIndices
int * tableIndices
Definition: tage_base.hh:463
TAGEBase::tCounter
int64_t tCounter
Definition: tage_base.hh:467
TAGEBase::ThreadHistory::globalHistory
uint8_t * globalHistory
Definition: tage_base.hh:442
TAGEBase::btablePrediction
std::vector< bool > btablePrediction
Definition: tage_base.hh:428
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
TAGEBase::pathHistBits
const unsigned pathHistBits
Definition: tage_base.hh:423
TAGE_SC_L_TAGE::getBimodePred
bool getBimodePred(Addr branch_pc, TAGEBase::BranchInfo *tage_bi) const override
Get a branch prediction from the bimodal predictor.
Definition: tage_sc_l.cc:340
LoopPredictor::ltable
LoopEntry * ltable
Definition: loop_predictor.hh:73
TAGE::tage
TAGEBase * tage
Definition: tage.hh:61
TAGEBase::tableTags
int * tableTags
Definition: tage_base.hh:464
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:234
TAGEBase::BranchInfo::hitBank
int hitBank
Definition: tage_base.hh:124
MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:240
TAGE_SC_L_TAGE::calculateIndicesAndTags
void calculateIndicesAndTags(ThreadID tid, Addr branch_pc, TAGEBase::BranchInfo *bi) override
On a prediction, calculates the TAGE indices and tags for all the different history lengths.
Definition: tage_sc_l.cc:128
StatisticalCorrector::updateStats
void updateStats(bool taken, BranchInfo *bi)
Definition: statistical_corrector.cc:377
TAGE_SC_L_TAGE::F
int F(int phist, int size, int bank) const override
Utility function to shuffle the path history depending on which tagged table we are accessing.
Definition: tage_sc_l.cc:199
TAGE_SC_L::predict
bool predict(ThreadID tid, Addr branch_pc, bool cond_branch, void *&b) override
Get a branch prediction from LTAGE.
Definition: tage_sc_l.cc:365
LoopPredictor::squashLoop
void squashLoop(BranchInfo *bi)
Definition: loop_predictor.cc:304
TAGE_SC_L_TAGE::handleUReset
void handleUReset() override
Handles the U bits reset.
Definition: tage_sc_l.cc:316
TAGEBase::TageEntry::ctr
int8_t ctr
Definition: tage_base.hh:70
TAGE_SC_L::SC
@ SC
Definition: tage_sc_l.hh:182
TAGE_SC_L_LoopPredictor::optionalAgeInc
virtual bool optionalAgeInc() const override
Definition: tage_sc_l.cc:56
TAGEBase::resetUctr
virtual void resetUctr(uint8_t &u)
Algorithm for resetting a single U counter.
Definition: tage_base.cc:502
tage_sc_l.hh
TAGEBase::updateHistories
virtual void updateHistories(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *b, bool speculative, const StaticInstPtr &inst=StaticInst::nullStaticInstPtr, Addr target=MaxAddr)
(Speculatively) updates global histories (path and direction).
Definition: tage_base.cc:582
TAGE_SC_L_TAGE::gtag
virtual uint16_t gtag(ThreadID tid, Addr pc, int bank) const override=0
Computes the partial tag of a tagged table.
TAGEBase::logUResetPeriod
uint64_t logUResetPeriod
Definition: tage_base.hh:468
LoopPredictor::LoopEntry::confidence
uint8_t confidence
Definition: loop_predictor.hh:64
TAGEBase::TageEntry
Definition: tage_base.hh:68
TAGEBase::logTagTableSizes
std::vector< int > logTagTableSizes
Definition: tage_base.hh:426
TAGEBase::updateStats
virtual void updateStats(bool taken, BranchInfo *bi)
Update the stats.
Definition: tage_base.cc:656
TAGE_SC_L_TAGE::getUseAltIdx
unsigned getUseAltIdx(TAGEBase::BranchInfo *bi, Addr branch_pc) override
Calculation of the index for useAltPredForNewlyAllocated On this base TAGE implementation it is alway...
Definition: tage_sc_l.cc:171
LoopPredictor::loopPredict
bool loopPredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, unsigned instShiftAmt)
Get the loop prediction.
Definition: loop_predictor.cc:271
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
TAGE_SC_L_TAGE::updateHistories
void updateHistories(ThreadID tid, Addr branch_pc, bool taken, TAGEBase::BranchInfo *b, bool speculative, const StaticInstPtr &inst, Addr target) override
(Speculatively) updates global histories (path and direction).
Definition: tage_sc_l.cc:265
TAGEBase::squash
virtual void squash(ThreadID tid, bool taken, BranchInfo *bi, Addr target)
Restores speculatively updated path and direction histories.
Definition: tage_base.cc:623
StatisticalCorrector::scPredict
virtual bool scPredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi, bool prev_pred_taken, bool bias_bit, bool use_conf_ctr, int8_t conf_ctr, unsigned conf_bits, int hitBank, int altBank, int64_t phist, int init_lsum=0)
Definition: statistical_corrector.cc:224
TAGE_SC_L_TAGE::BranchInfo::altConf
bool altConf
Definition: tage_sc_l.hh:68
StatisticalCorrector::scHistoryUpdate
virtual void scHistoryUpdate(Addr branch_pc, const StaticInstPtr &inst, bool taken, BranchInfo *tage_bi, Addr corrTarget)
Definition: statistical_corrector.cc:289
LoopPredictor::LoopEntry::numIter
uint16_t numIter
Definition: loop_predictor.hh:61
TAGEBase::logRatioBiModalHystEntries
const unsigned logRatioBiModalHystEntries
Definition: tage_base.hh:416
TAGEBase::isSpeculativeUpdateEnabled
bool isSpeculativeUpdateEnabled() const
Definition: tage_base.cc:772
TAGE_SC_L_TAGE::gindex_ext
virtual int gindex_ext(int index, int bank) const =0
TAGEBase::gtable
TageEntry ** gtable
Definition: tage_base.hh:430
TAGE_SC_L_LoopPredictor::calcConf
virtual bool calcConf(int index) const override
Definition: tage_sc_l.cc:49
ArmISA::u
Bitfield< 22 > u
Definition: miscregs_types.hh:348
TAGEBase::BranchInfo::hitBankIndex
int hitBankIndex
Definition: tage_base.hh:125
LTAGE::loopPredictor
LoopPredictor * loopPredictor
The loop predictor object.
Definition: ltage.hh:76
TAGEBase::maxHist
const unsigned maxHist
Definition: tage_base.hh:422
ArmISA::b
Bitfield< 7 > b
Definition: miscregs_types.hh:376
TAGEBase::instShiftAmt
const unsigned instShiftAmt
Definition: tage_base.hh:481
ArmISA::t
Bitfield< 5 > t
Definition: miscregs_types.hh:67
TAGE_SC_L_TAGE::longTagsSize
const unsigned longTagsSize
Definition: tage_sc_l.hh:54
TAGE_SC_L_TAGE::firstLongTagTable
const unsigned firstLongTagTable
Definition: tage_sc_l.hh:53
TAGE_SC_L_TAGE::adjustAlloc
void adjustAlloc(bool &alloc, bool taken, bool pred_taken) override
Extra calculation to tell whether TAGE allocaitons may happen or not on an update For this base TAGE ...
Definition: tage_sc_l.cc:296
StatisticalCorrector::condBranchUpdate
virtual void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, BranchInfo *bi, Addr corrTarget, bool bias_bit, int hitBank, int altBank, int64_t phist)
Definition: statistical_corrector.cc:318
TAGE_SC_L_TAGE::shortTagsSize
const unsigned shortTagsSize
Definition: tage_sc_l.hh:55
LoopPredictor::condBranchUpdate
void condBranchUpdate(ThreadID tid, Addr branch_pc, bool taken, bool tage_pred, BranchInfo *bi, unsigned instShiftAmt)
Update LTAGE for conditional branches.
Definition: loop_predictor.cc:325
TAGE_SC_L_TAGE::extraAltCalc
void extraAltCalc(TAGEBase::BranchInfo *bi) override
Extra steps for calculating altTaken For this base TAGE class it does nothing.
Definition: tage_sc_l.cc:356
TAGEBase::tagePredict
bool tagePredict(ThreadID tid, Addr branch_pc, bool cond_branch, BranchInfo *bi)
TAGE prediction called from TAGE::predict.
Definition: tage_base.cc:354
TAGEBase::FoldedHistory::update
void update(uint8_t *h)
Definition: tage_base.hh:99
Random::random
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
Definition: random.hh:86
TAGEBase::ThreadHistory::pathHist
int pathHist
Definition: tage_base.hh:437
TAGE_SC_L::TageSCLBranchInfo
Definition: tage_sc_l.hh:165
RefCountingPtr< StaticInst >
TAGE_SC_L_TAGE::updatePathAndGlobalHistory
void updatePathAndGlobalHistory(ThreadHistory &tHist, int brtype, bool taken, Addr branch_pc, Addr target)
Definition: tage_sc_l.cc:230
TAGE_SC_L_TAGE::BranchInfo
Definition: tage_sc_l.hh:65
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
TAGE_SC_L_TAGE::makeBranchInfo
virtual TAGEBase::BranchInfo * makeBranchInfo() override
Definition: tage_sc_l.cc:73
TAGEBase::numUseAltOnNa
unsigned numUseAltOnNa
Definition: tage_base.hh:470
TAGEBase::ThreadHistory::computeIndices
FoldedHistory * computeIndices
Definition: tage_base.hh:451
TAGEBase::BranchInfo::condBranch
bool condBranch
Definition: tage_base.hh:132
Serializable::path
static std::stack< std::string > path
Definition: serialize.hh:319
TAGE_SC_L_TAGE::longTagsTageFactor
const unsigned longTagsTageFactor
Definition: tage_sc_l.hh:60
TAGE_SC_L::update
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed, const StaticInstPtr &inst, Addr corrTarget) override
Updates the BP with taken/not taken information.
Definition: tage_sc_l.cc:413
ULL
#define ULL(N)
uint64_t constant
Definition: types.hh:50
StaticInst::isUncondCtrl
bool isUncondCtrl() const
Definition: static_inst.hh:181
TAGEBase::ThreadHistory::gHist
uint8_t * gHist
Definition: tage_base.hh:445
TAGEBase::updateGHist
void updateGHist(uint8_t *&h, bool dir, uint8_t *tab, int &PT)
(Speculatively) updates the global branch history.
Definition: tage_base.cc:316
TAGEBase::getPathHist
int getPathHist(ThreadID tid) const
Definition: tage_base.cc:766
ArmISA::a1
Bitfield< 22 > a1
Definition: miscregs_types.hh:495
TAGEBase::speculativeHistUpdate
const bool speculativeHistUpdate
Definition: tage_base.hh:479

Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17