1# Copyright (c) 2012 Mark D. Hill and David A. Wood 2# Copyright (c) 2015 The University of Wisconsin 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; 9# redistributions in binary form must reproduce the above copyright 10# notice, this list of conditions and the following disclaimer in the 11# documentation and/or other materials provided with the distribution; 12# neither the name of the copyright holders nor the names of its 13# contributors may be used to endorse or promote products derived from 14# this software without specific prior written permission. 15# 16# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27# 28# Authors: Nilay Vaish and Dibakar Gope 29 30from m5.SimObject import SimObject 31from m5.params import * 32from m5.proxy import * 33 34class IndirectPredictor(SimObject): 35 type = 'IndirectPredictor' 36 cxx_class = 'IndirectPredictor' 37 cxx_header = "cpu/pred/indirect.hh" 38 abstract = True 39 40 numThreads = Param.Unsigned(Parent.numThreads, "Number of threads") 41 42class SimpleIndirectPredictor(IndirectPredictor): 43 type = 'SimpleIndirectPredictor' 44 cxx_class = 'SimpleIndirectPredictor' 45 cxx_header = "cpu/pred/simple_indirect.hh" 46 47 indirectHashGHR = Param.Bool(True, "Hash branch predictor GHR") 48 indirectHashTargets = Param.Bool(True, "Hash path history targets") 49 indirectSets = Param.Unsigned(256, "Cache sets for indirect predictor") 50 indirectWays = Param.Unsigned(2, "Ways for indirect predictor") 51 indirectTagSize = Param.Unsigned(16, "Indirect target cache tag bits") 52 indirectPathLength = Param.Unsigned(3, 53 "Previous indirect targets to use for path history") 54 indirectGHRBits = Param.Unsigned(13, "Indirect GHR number of bits") 55 instShiftAmt = Param.Unsigned(2, "Number of bits to shift instructions by") 56 57class BranchPredictor(SimObject): 58 type = 'BranchPredictor' 59 cxx_class = 'BPredUnit' 60 cxx_header = "cpu/pred/bpred_unit.hh" 61 abstract = True 62 63 numThreads = Param.Unsigned(Parent.numThreads, "Number of threads") 64 BTBEntries = Param.Unsigned(4096, "Number of BTB entries") 65 BTBTagSize = Param.Unsigned(16, "Size of the BTB tags, in bits") 66 RASSize = Param.Unsigned(16, "RAS size") 67 instShiftAmt = Param.Unsigned(2, "Number of bits to shift instructions by") 68 69 indirectBranchPred = Param.IndirectPredictor(SimpleIndirectPredictor(), 70 "Indirect branch predictor, set to NULL to disable indirect predictions") 71 72class LocalBP(BranchPredictor): 73 type = 'LocalBP' 74 cxx_class = 'LocalBP' 75 cxx_header = "cpu/pred/2bit_local.hh" 76 77 localPredictorSize = Param.Unsigned(2048, "Size of local predictor") 78 localCtrBits = Param.Unsigned(2, "Bits per counter") 79 80 81class TournamentBP(BranchPredictor): 82 type = 'TournamentBP' 83 cxx_class = 'TournamentBP' 84 cxx_header = "cpu/pred/tournament.hh" 85 86 localPredictorSize = Param.Unsigned(2048, "Size of local predictor") 87 localCtrBits = Param.Unsigned(2, "Bits per counter") 88 localHistoryTableSize = Param.Unsigned(2048, "size of local history table") 89 globalPredictorSize = Param.Unsigned(8192, "Size of global predictor") 90 globalCtrBits = Param.Unsigned(2, "Bits per counter") 91 choicePredictorSize = Param.Unsigned(8192, "Size of choice predictor") 92 choiceCtrBits = Param.Unsigned(2, "Bits of choice counters") 93 94 95class BiModeBP(BranchPredictor): 96 type = 'BiModeBP' 97 cxx_class = 'BiModeBP' 98 cxx_header = "cpu/pred/bi_mode.hh" 99 100 globalPredictorSize = Param.Unsigned(8192, "Size of global predictor") 101 globalCtrBits = Param.Unsigned(2, "Bits per counter") 102 choicePredictorSize = Param.Unsigned(8192, "Size of choice predictor") 103 choiceCtrBits = Param.Unsigned(2, "Bits of choice counters") 104 105class TAGEBase(SimObject): 106 type = 'TAGEBase' 107 cxx_class = 'TAGEBase' 108 cxx_header = "cpu/pred/tage_base.hh" 109 110 numThreads = Param.Unsigned(Parent.numThreads, "Number of threads") 111 instShiftAmt = Param.Unsigned(Parent.instShiftAmt, 112 "Number of bits to shift instructions by") 113 114 nHistoryTables = Param.Unsigned(7, "Number of history tables") 115 minHist = Param.Unsigned(5, "Minimum history size of TAGE") 116 maxHist = Param.Unsigned(130, "Maximum history size of TAGE") 117 118 tagTableTagWidths = VectorParam.Unsigned( 119 [0, 9, 9, 10, 10, 11, 11, 12], "Tag size in TAGE tag tables") 120 logTagTableSizes = VectorParam.Int( 121 [13, 9, 9, 9, 9, 9, 9, 9], "Log2 of TAGE table sizes") 122 logRatioBiModalHystEntries = Param.Unsigned(2, 123 "Log num of prediction entries for a shared hysteresis bit " \ 124 "for the Bimodal") 125 126 tagTableCounterBits = Param.Unsigned(3, "Number of tag table counter bits") 127 tagTableUBits = Param.Unsigned(2, "Number of tag table u bits") 128 129 histBufferSize = Param.Unsigned(2097152, 130 "A large number to track all branch histories(2MEntries default)") 131 132 pathHistBits = Param.Unsigned(16, "Path history size") 133 logUResetPeriod = Param.Unsigned(18, 134 "Log period in number of branches to reset TAGE useful counters") 135 numUseAltOnNa = Param.Unsigned(1, "Number of USE_ALT_ON_NA counters") 136 initialTCounterValue = Param.Int(1 << 17, "Initial value of tCounter") 137 useAltOnNaBits = Param.Unsigned(4, "Size of the USE_ALT_ON_NA counter(s)") 138 139 maxNumAlloc = Param.Unsigned(1, 140 "Max number of TAGE entries allocted on mispredict") 141 142 # List of enabled TAGE tables. If empty, all are enabled 143 noSkip = VectorParam.Bool([], "Vector of enabled TAGE tables") 144 145 speculativeHistUpdate = Param.Bool(True, 146 "Use speculative update for histories") 147 148# TAGE branch predictor as described in https://www.jilp.org/vol8/v8paper1.pdf 149# The default sizes below are for the 8C-TAGE configuration (63.5 Kbits) 150class TAGE(BranchPredictor): 151 type = 'TAGE' 152 cxx_class = 'TAGE' 153 cxx_header = "cpu/pred/tage.hh" 154 tage = Param.TAGEBase(TAGEBase(), "Tage object") 155 156class LTAGE_TAGE(TAGEBase): 157 nHistoryTables = 12 158 minHist = 4 159 maxHist = 640 160 tagTableTagWidths = [0, 7, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15] 161 logTagTableSizes = [14, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 9, 9] 162 logUResetPeriod = 19 163 164class LoopPredictor(SimObject): 165 type = 'LoopPredictor' 166 cxx_class = 'LoopPredictor' 167 cxx_header = 'cpu/pred/loop_predictor.hh' 168 169 logSizeLoopPred = Param.Unsigned(8, "Log size of the loop predictor") 170 withLoopBits = Param.Unsigned(7, "Size of the WITHLOOP counter") 171 loopTableAgeBits = Param.Unsigned(8, "Number of age bits per loop entry") 172 loopTableConfidenceBits = Param.Unsigned(2, 173 "Number of confidence bits per loop entry") 174 loopTableTagBits = Param.Unsigned(14, "Number of tag bits per loop entry") 175 loopTableIterBits = Param.Unsigned(14, "Nuber of iteration bits per loop") 176 logLoopTableAssoc = Param.Unsigned(2, "Log loop predictor associativity") 177 178 # Parameters for enabling modifications to the loop predictor 179 # They have been copied from TAGE-GSC-IMLI 180 # (http://www.irisa.fr/alf/downloads/seznec/TAGE-GSC-IMLI.tar) 181 # 182 # All of them should be disabled to match the original LTAGE implementation 183 # (http://hpca23.cse.tamu.edu/taco/camino/cbp2/cbp-src/realistic-seznec.h) 184 185 # Add speculation 186 useSpeculation = Param.Bool(False, "Use speculation") 187 188 # Add hashing for calculating the loop table index 189 useHashing = Param.Bool(False, "Use hashing") 190 191 # Add a direction bit to the loop table entries 192 useDirectionBit = Param.Bool(False, "Use direction info") 193 194 # If true, use random to decide whether to allocate or not, and only try 195 # with one entry 196 restrictAllocation = Param.Bool(False, 197 "Restrict the allocation conditions") 198 199 initialLoopIter = Param.Unsigned(1, "Initial iteration number") 200 initialLoopAge = Param.Unsigned(255, "Initial age value") 201 optionalAgeReset = Param.Bool(True, 202 "Reset age bits optionally in some cases") 203 204class TAGE_SC_L_TAGE(TAGEBase): 205 type = 'TAGE_SC_L_TAGE' 206 cxx_class = 'TAGE_SC_L_TAGE' 207 cxx_header = "cpu/pred/tage_sc_l.hh" 208 abstract = True 209 tagTableTagWidths = [0] 210 numUseAltOnNa = 16 211 pathHistBits = 27 212 maxNumAlloc = 2 213 logUResetPeriod = 10 214 initialTCounterValue = 1 << 9 215 useAltOnNaBits = 5 216 # TODO No speculation implemented as of now 217 speculativeHistUpdate = False 218 219 # This size does not set the final sizes of the tables (it is just used 220 # for some calculations) 221 # Instead, the number of TAGE entries comes from shortTagsTageEntries and 222 # longTagsTageEntries 223 logTagTableSize = Param.Unsigned("Log size of each tag table") 224 225 shortTagsTageFactor = Param.Unsigned( 226 "Factor for calculating the total number of short tags TAGE entries") 227 228 longTagsTageFactor = Param.Unsigned( 229 "Factor for calculating the total number of long tags TAGE entries") 230 231 shortTagsSize = Param.Unsigned(8, "Size of the short tags") 232 233 longTagsSize = Param.Unsigned("Size of the long tags") 234 235 firstLongTagTable = Param.Unsigned("First table with long tags") 236 237 truncatePathHist = Param.Bool(True, 238 "Truncate the path history to its configured size") 239 240 241class TAGE_SC_L_TAGE_64KB(TAGE_SC_L_TAGE): 242 type = 'TAGE_SC_L_TAGE_64KB' 243 cxx_class = 'TAGE_SC_L_TAGE_64KB' 244 cxx_header = "cpu/pred/tage_sc_l_64KB.hh" 245 nHistoryTables = 36 246 247 minHist = 6 248 maxHist = 3000 249 250 tagTableUBits = 1 251 252 logTagTableSizes = [13] 253 254 # This is used to handle the 2-way associativity 255 # (all odd entries are set to one, and if the corresponding even entry 256 # is set to one, then there is a 2-way associativity for this pair) 257 # Entry 0 is for the bimodal and it is ignored 258 # Note: For this implementation, some odd entries are also set to 0 to save 259 # some bits 260 noSkip = [0,0,1,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1, 261 1,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1] 262 263 logTagTableSize = 10 264 shortTagsTageFactor = 10 265 longTagsTageFactor = 20 266 267 longTagsSize = 12 268 269 firstLongTagTable = 13 270 271class TAGE_SC_L_TAGE_8KB(TAGE_SC_L_TAGE): 272 type = 'TAGE_SC_L_TAGE_8KB' 273 cxx_class = 'TAGE_SC_L_TAGE_8KB' 274 cxx_header = "cpu/pred/tage_sc_l_8KB.hh" 275 276 nHistoryTables = 30 277 278 minHist = 4 279 maxHist = 1000 280 281 logTagTableSize = 7 282 shortTagsTageFactor = 9 283 longTagsTageFactor = 17 284 longTagsSize = 12 285 286 logTagTableSizes = [12] 287 288 firstLongTagTable = 11 289 290 truncatePathHist = False 291 292 noSkip = [0,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1] 293 294 tagTableUBits = 2 295 296# LTAGE branch predictor as described in 297# https://www.irisa.fr/caps/people/seznec/L-TAGE.pdf 298# It is basically a TAGE predictor plus a loop predictor 299# The differnt TAGE sizes are updated according to the paper values (256 Kbits) 300class LTAGE(TAGE): 301 type = 'LTAGE' 302 cxx_class = 'LTAGE' 303 cxx_header = "cpu/pred/ltage.hh" 304 305 tage = LTAGE_TAGE() 306 307 loop_predictor = Param.LoopPredictor(LoopPredictor(), "Loop predictor") 308 309class TAGE_SC_L_LoopPredictor(LoopPredictor): 310 type = 'TAGE_SC_L_LoopPredictor' 311 cxx_class = 'TAGE_SC_L_LoopPredictor' 312 cxx_header = "cpu/pred/tage_sc_l.hh" 313 loopTableAgeBits = 4 314 loopTableConfidenceBits = 4 315 loopTableTagBits = 10 316 loopTableIterBits = 10 317 useSpeculation = False 318 useHashing = True 319 useDirectionBit = True 320 restrictAllocation = True 321 initialLoopIter = 0 322 initialLoopAge = 7 323 optionalAgeReset = False 324 325class StatisticalCorrector(SimObject): 326 type = 'StatisticalCorrector' 327 cxx_class = 'StatisticalCorrector' 328 cxx_header = "cpu/pred/statistical_corrector.hh" 329 abstract = True 330 331 # Statistical corrector parameters 332 333 numEntriesFirstLocalHistories = Param.Unsigned( 334 "Number of entries for first local histories") 335 336 bwnb = Param.Unsigned("Num global backward branch GEHL lengths") 337 bwm = VectorParam.Int("Global backward branch GEHL lengths") 338 logBwnb = Param.Unsigned("Log num of global backward branch GEHL entries") 339 bwWeightInitValue = Param.Int( 340 "Initial value of the weights of the global backward branch GEHL entries") 341 342 lnb = Param.Unsigned("Num first local history GEHL lenghts") 343 lm = VectorParam.Int("First local history GEHL lengths") 344 logLnb = Param.Unsigned("Log number of first local history GEHL entries") 345 lWeightInitValue = Param.Int( 346 "Initial value of the weights of the first local history GEHL entries") 347 348 inb = Param.Unsigned(1, "Num IMLI GEHL lenghts") 349 im = VectorParam.Int([8], "IMLI history GEHL lengths") 350 logInb = Param.Unsigned("Log number of IMLI GEHL entries") 351 iWeightInitValue = Param.Int( 352 "Initial value of the weights of the IMLI history GEHL entries") 353 354 logBias = Param.Unsigned("Log size of Bias tables") 355 356 logSizeUp = Param.Unsigned(6, 357 "Log size of update threshold counters tables") 358 359 chooserConfWidth = Param.Unsigned(7, 360 "Number of bits for the chooser counters") 361 362 updateThresholdWidth = Param.Unsigned(12, 363 "Number of bits for the update threshold counter") 364 365 pUpdateThresholdWidth = Param.Unsigned(8, 366 "Number of bits for the pUpdate threshold counters") 367 368 extraWeightsWidth = Param.Unsigned(6, 369 "Number of bits for the extra weights") 370 371 scCountersWidth = Param.Unsigned(6, "Statistical corrector counters width") 372 373 initialUpdateThresholdValue = Param.Int(0, 374 "Initial pUpdate threshold counter value") 375 376# TAGE-SC-L branch predictor as desribed in 377# https://www.jilp.org/cbp2016/paper/AndreSeznecLimited.pdf 378# It is a modified LTAGE predictor plus a statistical corrector predictor 379# The TAGE modifications include bank interleaving and partial associativity 380# Two different sizes are proposed in the paper: 381# 8KB => See TAGE_SC_L_8KB below 382# 64KB => See TAGE_SC_L_64KB below 383# The TAGE_SC_L_8KB and TAGE_SC_L_64KB classes differ not only on the values 384# of some parameters, but also in some implementation details 385# Given this, the TAGE_SC_L class is left abstract 386# Note that as it is now, this branch predictor does not handle any type 387# of speculation: All the structures/histories are updated at commit time 388class TAGE_SC_L(LTAGE): 389 type = 'TAGE_SC_L' 390 cxx_class = 'TAGE_SC_L' 391 cxx_header = "cpu/pred/tage_sc_l.hh" 392 abstract = True 393 394 statistical_corrector = Param.StatisticalCorrector( 395 "Statistical Corrector") 396 397class TAGE_SC_L_64KB_LoopPredictor(TAGE_SC_L_LoopPredictor): 398 logSizeLoopPred = 5 399 400class TAGE_SC_L_8KB_LoopPredictor(TAGE_SC_L_LoopPredictor): 401 logSizeLoopPred = 3 402 403class TAGE_SC_L_64KB_StatisticalCorrector(StatisticalCorrector): 404 type = 'TAGE_SC_L_64KB_StatisticalCorrector' 405 cxx_class = 'TAGE_SC_L_64KB_StatisticalCorrector' 406 cxx_header = "cpu/pred/tage_sc_l_64KB.hh" 407 408 pnb = Param.Unsigned(3, "Num variation global branch GEHL lengths") 409 pm = VectorParam.Int([25, 16, 9], "Variation global branch GEHL lengths") 410 logPnb = Param.Unsigned(9, 411 "Log number of variation global branch GEHL entries") 412 413 snb = Param.Unsigned(3, "Num second local history GEHL lenghts") 414 sm = VectorParam.Int([16, 11, 6], "Second local history GEHL lengths") 415 logSnb = Param.Unsigned(9, 416 "Log number of second local history GEHL entries") 417 418 tnb = Param.Unsigned(2, "Num third local history GEHL lenghts") 419 tm = VectorParam.Int([9, 4], "Third local history GEHL lengths") 420 logTnb = Param.Unsigned(10, 421 "Log number of third local history GEHL entries") 422 423 imnb = Param.Unsigned(2, "Num second IMLI GEHL lenghts") 424 imm = VectorParam.Int([10, 4], "Second IMLI history GEHL lengths") 425 logImnb = Param.Unsigned(9, "Log number of second IMLI GEHL entries") 426 427 numEntriesSecondLocalHistories = Param.Unsigned(16, 428 "Number of entries for second local histories") 429 numEntriesThirdLocalHistories = Param.Unsigned(16, 430 "Number of entries for second local histories") 431 432 numEntriesFirstLocalHistories = 256 433 434 logBias = 8 435 436 bwnb = 3 437 bwm = [40, 24, 10] 438 logBwnb = 10 439 bwWeightInitValue = 7 440 441 lnb = 3 442 lm = [11, 6, 3] 443 logLnb = 10 444 lWeightInitValue = 7 445 446 logInb = 8 447 iWeightInitValue = 7 448 449class TAGE_SC_L_8KB_StatisticalCorrector(StatisticalCorrector): 450 type = 'TAGE_SC_L_8KB_StatisticalCorrector' 451 cxx_class = 'TAGE_SC_L_8KB_StatisticalCorrector' 452 cxx_header = "cpu/pred/tage_sc_l_8KB.hh" 453 gnb = Param.Unsigned(2, "Num global branch GEHL lengths") 454 gm = VectorParam.Int([6, 3], "Global branch GEHL lengths") 455 logGnb = Param.Unsigned(7, "Log number of global branch GEHL entries") 456 457 numEntriesFirstLocalHistories = 64 458 459 logBias = 7 460 461 bwnb = 2 462 logBwnb = 7 463 bwm = [16, 8] 464 bwWeightInitValue = 7 465 466 lnb = 2 467 logLnb = 7 468 lm = [6, 3] 469 lWeightInitValue = 7 470 471 logInb = 7 472 iWeightInitValue = 7 473 474# 64KB TAGE-SC-L branch predictor as described in 475# http://www.jilp.org/cbp2016/paper/AndreSeznecLimited.pdf 476class TAGE_SC_L_64KB(TAGE_SC_L): 477 type = 'TAGE_SC_L_64KB' 478 cxx_class = 'TAGE_SC_L_64KB' 479 cxx_header = "cpu/pred/tage_sc_l_64KB.hh" 480 481 tage = TAGE_SC_L_TAGE_64KB() 482 loop_predictor = TAGE_SC_L_64KB_LoopPredictor() 483 statistical_corrector = TAGE_SC_L_64KB_StatisticalCorrector() 484 485# 8KB TAGE-SC-L branch predictor as described in 486# http://www.jilp.org/cbp2016/paper/AndreSeznecLimited.pdf 487class TAGE_SC_L_8KB(TAGE_SC_L): 488 type = 'TAGE_SC_L_8KB' 489 cxx_class = 'TAGE_SC_L_8KB' 490 cxx_header = "cpu/pred/tage_sc_l_8KB.hh" 491 492 tage = TAGE_SC_L_TAGE_8KB() 493 loop_predictor = TAGE_SC_L_8KB_LoopPredictor() 494 statistical_corrector = TAGE_SC_L_8KB_StatisticalCorrector() 495 496class MultiperspectivePerceptron(BranchPredictor): 497 type = 'MultiperspectivePerceptron' 498 cxx_class = 'MultiperspectivePerceptron' 499 cxx_header = 'cpu/pred/multiperspective_perceptron.hh' 500 abstract = True 501 502 num_filter_entries = Param.Int("Number of filter entries") 503 num_local_histories = Param.Int("Number of local history entries") 504 local_history_length = Param.Int(11, 505 "Length in bits of each history entry") 506 507 block_size = Param.Int(21, 508 "number of ghist bits in a 'block'; this is the width of an initial " 509 "hash of ghist") 510 pcshift = Param.Int(-10, "Shift for hashing PC") 511 threshold = Param.Int(1, "Threshold for deciding low/high confidence") 512 bias0 = Param.Int(-5, 513 "Bias perceptron output this much on all-bits-zero local history") 514 bias1 = Param.Int(5, 515 "Bias perceptron output this much on all-bits-one local history") 516 biasmostly0 = Param.Int(-1, 517 "Bias perceptron output this much on almost-all-bits-zero local " 518 "history") 519 biasmostly1 = Param.Int(1, 520 "Bias perceptron output this much on almost-all-bits-one local " 521 "history") 522 nbest = Param.Int(20, 523 "Use this many of the top performing tables on a low-confidence " 524 "branch") 525 tunebits = Param.Int(24, "Number of bits in misprediction counters") 526 hshift = Param.Int(-6, 527 "How much to shift initial feauture hash before XORing with PC bits") 528 imli_mask1 = Param.UInt64( 529 "Which tables should have their indices hashed with the first IMLI " 530 "counter") 531 imli_mask4 = Param.UInt64( 532 "Which tables should have their indices hashed with the fourth IMLI " 533 "counter") 534 recencypos_mask = Param.UInt64( 535 "Which tables should have their indices hashed with the recency " 536 "position") 537 fudge = Param.Float(0.245, "Fudge factor to multiply by perceptron output") 538 n_sign_bits = Param.Int(2, "Number of sign bits per magnitude") 539 pcbit = Param.Int(2, "Bit from the PC to use for hashing global history") 540 decay = Param.Int(0, "Whether and how often to decay a random weight") 541 record_mask = Param.Int(191, 542 "Which histories are updated with filtered branch outcomes") 543 hash_taken = Param.Bool(False, 544 "Hash the taken/not taken value with a PC bit") 545 tuneonly = Param.Bool(True, 546 "If true, only count mispredictions of low-confidence branches") 547 extra_rounds = Param.Int(1, 548 "Number of extra rounds of training a single weight on a " 549 "low-confidence prediction") 550 speed = Param.Int(9, "Adaptive theta learning speed") 551 initial_theta = Param.Int(10, "Initial theta") 552 budgetbits = Param.Int("Hardware budget in bits") 553 speculative_update = Param.Bool(False, 554 "Use speculative update for histories") 555 556 initial_ghist_length = Param.Int(1, "Initial GHist length value") 557 ignore_path_size = Param.Bool(False, "Ignore the path storage") 558 559class MultiperspectivePerceptron8KB(MultiperspectivePerceptron): 560 type = 'MultiperspectivePerceptron8KB' 561 cxx_class = 'MultiperspectivePerceptron8KB' 562 cxx_header = 'cpu/pred/multiperspective_perceptron_8KB.hh' 563 budgetbits = 8192 * 8 + 2048 564 num_local_histories = 48 565 num_filter_entries = 0 566 imli_mask1 = 0x6 567 imli_mask4 = 0x4400 568 recencypos_mask = 0x100000090 569 570class MultiperspectivePerceptron64KB(MultiperspectivePerceptron): 571 type = 'MultiperspectivePerceptron64KB' 572 cxx_class = 'MultiperspectivePerceptron64KB' 573 cxx_header = 'cpu/pred/multiperspective_perceptron_64KB.hh' 574 budgetbits = 65536 * 8 + 2048 575 num_local_histories = 510 576 num_filter_entries = 18025 577 imli_mask1 = 0xc1000 578 imli_mask4 = 0x80008000 579 recencypos_mask = 0x100000090 580 581class MPP_TAGE(TAGEBase): 582 type = 'MPP_TAGE' 583 cxx_class = 'MPP_TAGE' 584 cxx_header = 'cpu/pred/multiperspective_perceptron_tage.hh' 585 nHistoryTables = 15 586 pathHistBits = 27 587 instShiftAmt = 0 588 histBufferSize = 16384 589 maxHist = 4096; 590 tagTableTagWidths = [0, 7, 9, 9, 9, 10, 11, 11, 12, 12, 591 12, 13, 14, 15, 15, 15] 592 logTagTableSizes = [14, 10, 11, 11, 11, 11, 11, 12, 12, 593 10, 11, 11, 9, 7, 7, 8] 594 tunedHistoryLengths = VectorParam.Unsigned([0, 5, 12, 15, 21, 31, 43, 64, 595 93, 137, 200, 292, 424, 612, 877, 1241], "Tuned history lengths") 596 597 logUResetPeriod = 10 598 initialTCounterValue = 0 599 numUseAltOnNa = 512 600 speculativeHistUpdate = False 601 602class MPP_LoopPredictor(LoopPredictor): 603 type = 'MPP_LoopPredictor' 604 cxx_class = 'MPP_LoopPredictor' 605 cxx_header = 'cpu/pred/multiperspective_perceptron_tage.hh' 606 useDirectionBit = True 607 useHashing = True 608 useSpeculation = False 609 loopTableConfidenceBits = 4 610 loopTableAgeBits = 4 611 initialLoopAge = 7 612 initialLoopIter = 0 613 loopTableIterBits = 12 614 optionalAgeReset = False 615 restrictAllocation = True 616 logSizeLoopPred = 6 617 loopTableTagBits = 10 618 619class MPP_StatisticalCorrector(StatisticalCorrector): 620 type = 'MPP_StatisticalCorrector' 621 cxx_class = 'MPP_StatisticalCorrector' 622 cxx_header = 'cpu/pred/multiperspective_perceptron_tage.hh' 623 abstract = True 624 625 # Unused in this Statistical Corrector 626 bwnb = 0 627 bwm = [ ] 628 logBwnb = 0 629 bwWeightInitValue = -1 630 631 # Unused in this Statistical Corrector 632 logInb = 0 633 iWeightInitValue = -1 634 635 extraWeightsWidth = 0 636 pUpdateThresholdWidth = 10 637 initialUpdateThresholdValue = 35 638 logSizeUp = 5 639 640 lnb = 3 641 lm = [11, 6, 3] 642 logLnb = 10 643 lWeightInitValue = -1 644 645 gnb = Param.Unsigned(4, "Num global branch GEHL lengths") 646 gm = VectorParam.Int([27, 22, 17, 14], "Global branch GEHL lengths") 647 logGnb = Param.Unsigned(10, "Log number of global branch GEHL entries") 648 649 pnb = Param.Unsigned(4, "Num variation global branch GEHL lengths") 650 pm = VectorParam.Int([16, 11, 6, 3], 651 "Variation global branch GEHL lengths") 652 logPnb = Param.Unsigned(9, 653 "Log number of variation global branch GEHL entries") 654 655class MultiperspectivePerceptronTAGE(MultiperspectivePerceptron): 656 type = 'MultiperspectivePerceptronTAGE' 657 cxx_class = 'MultiperspectivePerceptronTAGE' 658 cxx_header = 'cpu/pred/multiperspective_perceptron_tage.hh' 659 abstract = True 660 instShiftAmt = 4 661 662 imli_mask1 = 0x70 663 imli_mask4 = 0 664 num_filter_entries = 0 665 num_local_histories = 0 666 recencypos_mask = 0 # Unused 667 threshold = -1 668 initial_ghist_length = 0 669 ignore_path_size = True 670 n_sign_bits = 1; 671 672 tage = Param.TAGEBase("Tage object") 673 loop_predictor = Param.LoopPredictor("Loop predictor") 674 statistical_corrector = Param.StatisticalCorrector("Statistical Corrector") 675 676class MPP_StatisticalCorrector_64KB(MPP_StatisticalCorrector): 677 type = 'MPP_StatisticalCorrector_64KB' 678 cxx_class = 'MPP_StatisticalCorrector_64KB' 679 cxx_header = 'cpu/pred/multiperspective_perceptron_tage_64KB.hh' 680 681 logBias = 8 682 683 snb = Param.Unsigned(4, "Num second local history GEHL lenghts") 684 sm = VectorParam.Int([16, 11, 6, 3], "Second local history GEHL lengths") 685 logSnb = Param.Unsigned(9, 686 "Log number of second local history GEHL entries") 687 688 tnb = Param.Unsigned(3, "Num third local history GEHL lenghts") 689 tm = VectorParam.Int([22, 17, 14], "Third local history GEHL lengths") 690 logTnb = Param.Unsigned(9, 691 "Log number of third local history GEHL entries") 692 693 numEntriesSecondLocalHistories = Param.Unsigned(16, 694 "Number of entries for second local histories") 695 numEntriesThirdLocalHistories = Param.Unsigned(16, 696 "Number of entries for second local histories") 697 698 numEntriesFirstLocalHistories = 256 699 700class MultiperspectivePerceptronTAGE64KB(MultiperspectivePerceptronTAGE): 701 type = 'MultiperspectivePerceptronTAGE64KB' 702 cxx_class = 'MultiperspectivePerceptronTAGE64KB' 703 cxx_header = 'cpu/pred/multiperspective_perceptron_tage_64KB.hh' 704 705 budgetbits = 65536 * 8 + 2048 706 707 tage = MPP_TAGE() 708 loop_predictor = MPP_LoopPredictor() 709 statistical_corrector = MPP_StatisticalCorrector_64KB() 710 711class MPP_TAGE_8KB(MPP_TAGE): 712 type = 'MPP_TAGE_8KB' 713 cxx_class = 'MPP_TAGE_8KB' 714 cxx_header = 'cpu/pred/multiperspective_perceptron_tage_8KB.hh' 715 nHistoryTables = 10 716 tagTableTagWidths = [0, 7, 7, 7, 8, 9, 10, 10, 11, 13, 13] 717 logTagTableSizes = [12, 8, 8, 9, 9, 8, 8, 8, 7, 6, 7] 718 tunedHistoryLengths = [0, 4, 8, 13, 23, 36, 56, 93, 145, 226, 359] 719 720class MPP_LoopPredictor_8KB(MPP_LoopPredictor): 721 type = 'MPP_LoopPredictor_8KB' 722 cxx_class = 'MPP_LoopPredictor_8KB' 723 cxx_header = 'cpu/pred/multiperspective_perceptron_tage_8KB.hh' 724 loopTableIterBits = 10 725 logSizeLoopPred = 4 726 727class MPP_StatisticalCorrector_8KB(MPP_StatisticalCorrector): 728 type = 'MPP_StatisticalCorrector_8KB' 729 cxx_class = 'MPP_StatisticalCorrector_8KB' 730 cxx_header = 'cpu/pred/multiperspective_perceptron_tage_8KB.hh' 731 732 logBias = 7 733 734 lnb = 2 735 lm = [8, 3] 736 logLnb = 9 737 738 logGnb = 9 739 740 logPnb = 7 741 742 numEntriesFirstLocalHistories = 64 743 744class MultiperspectivePerceptronTAGE8KB(MultiperspectivePerceptronTAGE): 745 type = 'MultiperspectivePerceptronTAGE8KB' 746 cxx_class = 'MultiperspectivePerceptronTAGE8KB' 747 cxx_header = 'cpu/pred/multiperspective_perceptron_tage_8KB.hh' 748 749 budgetbits = 8192 * 8 + 2048 750 751 tage = MPP_TAGE_8KB() 752 loop_predictor = MPP_LoopPredictor_8KB() 753 statistical_corrector = MPP_StatisticalCorrector_8KB() 754