46from m5.objects.ClockedObject import ClockedObject 47from m5.objects.IndexingPolicies import * 48from m5.objects.ReplacementPolicies import * 49 50class HWPProbeEvent(object): 51 def __init__(self, prefetcher, obj, *listOfNames): 52 self.obj = obj 53 self.prefetcher = prefetcher 54 self.names = listOfNames 55 56 def register(self): 57 if self.obj: 58 for name in self.names: 59 self.prefetcher.getCCObject().addEventProbe( 60 self.obj.getCCObject(), name) 61 62class BasePrefetcher(ClockedObject): 63 type = 'BasePrefetcher' 64 abstract = True 65 cxx_header = "mem/cache/prefetch/base.hh" 66 cxx_exports = [ 67 PyBindMethod("addEventProbe"), 68 ] 69 sys = Param.System(Parent.any, "System this prefetcher belongs to") 70 71 # Get the block size from the parent (system) 72 block_size = Param.Int(Parent.cache_line_size, "Block size in bytes") 73 74 on_miss = Param.Bool(False, "Only notify prefetcher on misses") 75 on_read = Param.Bool(True, "Notify prefetcher on reads") 76 on_write = Param.Bool(True, "Notify prefetcher on writes") 77 on_data = Param.Bool(True, "Notify prefetcher on data accesses") 78 on_inst = Param.Bool(True, "Notify prefetcher on instruction accesses") 79 prefetch_on_access = Param.Bool(Parent.prefetch_on_access, 80 "Notify the hardware prefetcher on every access (not just misses)") 81 use_virtual_addresses = Param.Bool(False, 82 "Use virtual addresses for prefetching") 83 84 _events = [] 85 def addEvent(self, newObject): 86 self._events.append(newObject) 87 88 # Override the normal SimObject::regProbeListeners method and 89 # register deferred event handlers. 90 def regProbeListeners(self): 91 for event in self._events: 92 event.register() 93 self.getCCObject().regProbeListeners() 94 95 def listenFromProbe(self, simObj, *probeNames): 96 if not isinstance(simObj, SimObject): 97 raise TypeError("argument must be of SimObject type") 98 if len(probeNames) <= 0: 99 raise TypeError("probeNames must have at least one element") 100 self.addEvent(HWPProbeEvent(self, simObj, *probeNames)) 101 102class QueuedPrefetcher(BasePrefetcher): 103 type = "QueuedPrefetcher" 104 abstract = True 105 cxx_class = "QueuedPrefetcher" 106 cxx_header = "mem/cache/prefetch/queued.hh" 107 latency = Param.Int(1, "Latency for generated prefetches") 108 queue_size = Param.Int(32, "Maximum number of queued prefetches") 109 queue_squash = Param.Bool(True, "Squash queued prefetch on demand access") 110 queue_filter = Param.Bool(True, "Don't queue redundant prefetches") 111 cache_snoop = Param.Bool(False, "Snoop cache to eliminate redundant request") 112 113 tag_prefetch = Param.Bool(True, "Tag prefetch with PC of generating access") 114 115class StridePrefetcher(QueuedPrefetcher): 116 type = 'StridePrefetcher' 117 cxx_class = 'StridePrefetcher' 118 cxx_header = "mem/cache/prefetch/stride.hh" 119 120 # Do not consult stride prefetcher on instruction accesses 121 on_inst = False 122 123 max_conf = Param.Int(7, "Maximum confidence level") 124 thresh_conf = Param.Int(4, "Threshold confidence level") 125 min_conf = Param.Int(0, "Minimum confidence level") 126 start_conf = Param.Int(4, "Starting confidence for new entries") 127 128 table_sets = Param.Int(16, "Number of sets in PC lookup table") 129 table_assoc = Param.Int(4, "Associativity of PC lookup table") 130 use_master_id = Param.Bool(True, "Use master id based history") 131 132 degree = Param.Int(4, "Number of prefetches to generate") 133 134 # Get replacement policy 135 replacement_policy = Param.BaseReplacementPolicy(RandomRP(), 136 "Replacement policy") 137 138class TaggedPrefetcher(QueuedPrefetcher): 139 type = 'TaggedPrefetcher' 140 cxx_class = 'TaggedPrefetcher' 141 cxx_header = "mem/cache/prefetch/tagged.hh" 142 143 degree = Param.Int(2, "Number of prefetches to generate") 144 145class IndirectMemoryPrefetcher(QueuedPrefetcher): 146 type = 'IndirectMemoryPrefetcher' 147 cxx_class = 'IndirectMemoryPrefetcher' 148 cxx_header = "mem/cache/prefetch/indirect_memory.hh" 149 pt_table_entries = Param.MemorySize("16", 150 "Number of entries of the Prefetch Table") 151 pt_table_assoc = Param.Unsigned(16, "Associativity of the Prefetch Table") 152 pt_table_indexing_policy = Param.BaseIndexingPolicy( 153 SetAssociative(entry_size = 1, assoc = Parent.pt_table_assoc, 154 size = Parent.pt_table_entries), 155 "Indexing policy of the pattern table") 156 pt_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 157 "Replacement policy of the pattern table") 158 max_prefetch_distance = Param.Unsigned(16, "Maximum prefetch distance") 159 max_indirect_counter_value = Param.Unsigned(8, 160 "Maximum value of the indirect counter") 161 ipd_table_entries = Param.MemorySize("4", 162 "Number of entries of the Indirect Pattern Detector") 163 ipd_table_assoc = Param.Unsigned(4, 164 "Associativity of the Indirect Pattern Detector") 165 ipd_table_indexing_policy = Param.BaseIndexingPolicy( 166 SetAssociative(entry_size = 1, assoc = Parent.ipd_table_assoc, 167 size = Parent.ipd_table_entries), 168 "Indexing policy of the Indirect Pattern Detector") 169 ipd_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 170 "Replacement policy of the Indirect Pattern Detector") 171 shift_values = VectorParam.Int([2, 3, 4, -3], "Shift values to evaluate") 172 addr_array_len = Param.Unsigned(4, "Number of misses tracked") 173 prefetch_threshold = Param.Unsigned(2, 174 "Counter threshold to start the indirect prefetching") 175 stream_counter_threshold = Param.Unsigned(4, 176 "Counter threshold to enable the stream prefetcher") 177 streaming_distance = Param.Unsigned(4, 178 "Number of prefetches to generate when using the stream prefetcher") 179 180class SignaturePathPrefetcher(QueuedPrefetcher): 181 type = 'SignaturePathPrefetcher' 182 cxx_class = 'SignaturePathPrefetcher' 183 cxx_header = "mem/cache/prefetch/signature_path.hh" 184 185 signature_shift = Param.UInt8(3, 186 "Number of bits to shift when calculating a new signature"); 187 signature_bits = Param.UInt16(12, 188 "Size of the signature, in bits"); 189 signature_table_entries = Param.MemorySize("1024", 190 "Number of entries of the signature table") 191 signature_table_assoc = Param.Unsigned(2, 192 "Associativity of the signature table") 193 signature_table_indexing_policy = Param.BaseIndexingPolicy( 194 SetAssociative(entry_size = 1, assoc = Parent.signature_table_assoc, 195 size = Parent.signature_table_entries), 196 "Indexing policy of the signature table") 197 signature_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 198 "Replacement policy of the signature table") 199 200 max_counter_value = Param.UInt8(7, "Maximum pattern counter value") 201 pattern_table_entries = Param.MemorySize("4096", 202 "Number of entries of the pattern table") 203 pattern_table_assoc = Param.Unsigned(1, 204 "Associativity of the pattern table") 205 strides_per_pattern_entry = Param.Unsigned(4, 206 "Number of strides stored in each pattern entry") 207 pattern_table_indexing_policy = Param.BaseIndexingPolicy( 208 SetAssociative(entry_size = 1, assoc = Parent.pattern_table_assoc, 209 size = Parent.pattern_table_entries), 210 "Indexing policy of the pattern table") 211 pattern_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 212 "Replacement policy of the pattern table") 213 214 prefetch_confidence_threshold = Param.Float(0.5, 215 "Minimum confidence to issue prefetches") 216 lookahead_confidence_threshold = Param.Float(0.75, 217 "Minimum confidence to continue exploring lookahead entries") 218 219class SignaturePathPrefetcherV2(SignaturePathPrefetcher): 220 type = 'SignaturePathPrefetcherV2' 221 cxx_class = 'SignaturePathPrefetcherV2' 222 cxx_header = "mem/cache/prefetch/signature_path_v2.hh" 223 224 signature_table_entries = "256" 225 signature_table_assoc = 1 226 pattern_table_entries = "512" 227 pattern_table_assoc = 1 228 max_counter_value = 15 229 prefetch_confidence_threshold = 0.25 230 lookahead_confidence_threshold = 0.25 231 232 global_history_register_entries = Param.MemorySize("8", 233 "Number of entries of global history register") 234 global_history_register_indexing_policy = Param.BaseIndexingPolicy( 235 SetAssociative(entry_size = 1, 236 assoc = Parent.global_history_register_entries, 237 size = Parent.global_history_register_entries), 238 "Indexing policy of the global history register") 239 global_history_register_replacement_policy = Param.BaseReplacementPolicy( 240 LRURP(), "Replacement policy of the global history register") 241 242class AccessMapPatternMatching(ClockedObject): 243 type = 'AccessMapPatternMatching' 244 cxx_class = 'AccessMapPatternMatching' 245 cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 246 247 block_size = Param.Unsigned(Parent.block_size, 248 "Cacheline size used by the prefetcher using this object") 249 250 limit_stride = Param.Unsigned(0, 251 "Limit the strides checked up to -X/X, if 0, disable the limit") 252 start_degree = Param.Unsigned(4, 253 "Initial degree (Maximum number of prefetches generated") 254 hot_zone_size = Param.MemorySize("2kB", "Memory covered by a hot zone") 255 access_map_table_entries = Param.MemorySize("256", 256 "Number of entries in the access map table") 257 access_map_table_assoc = Param.Unsigned(8, 258 "Associativity of the access map table") 259 access_map_table_indexing_policy = Param.BaseIndexingPolicy( 260 SetAssociative(entry_size = 1, assoc = Parent.access_map_table_assoc, 261 size = Parent.access_map_table_entries), 262 "Indexing policy of the access map table") 263 access_map_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 264 "Replacement policy of the access map table") 265 high_coverage_threshold = Param.Float(0.25, 266 "A prefetch coverage factor bigger than this is considered high") 267 low_coverage_threshold = Param.Float(0.125, 268 "A prefetch coverage factor smaller than this is considered low") 269 high_accuracy_threshold = Param.Float(0.5, 270 "A prefetch accuracy factor bigger than this is considered high") 271 low_accuracy_threshold = Param.Float(0.25, 272 "A prefetch accuracy factor smaller than this is considered low") 273 high_cache_hit_threshold = Param.Float(0.875, 274 "A cache hit ratio bigger than this is considered high") 275 low_cache_hit_threshold = Param.Float(0.75, 276 "A cache hit ratio smaller than this is considered low") 277 epoch_cycles = Param.Cycles(256000, "Cycles in an epoch period") 278 offchip_memory_latency = Param.Latency("30ns", 279 "Memory latency used to compute the required memory bandwidth") 280 281class AMPMPrefetcher(QueuedPrefetcher): 282 type = 'AMPMPrefetcher' 283 cxx_class = 'AMPMPrefetcher' 284 cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 285 ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(), 286 "Access Map Pattern Matching object") 287 288class DeltaCorrelatingPredictionTables(SimObject): 289 type = 'DeltaCorrelatingPredictionTables' 290 cxx_class = 'DeltaCorrelatingPredictionTables' 291 cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 292 deltas_per_entry = Param.Unsigned(20, 293 "Number of deltas stored in each table entry") 294 delta_bits = Param.Unsigned(12, "Bits per delta") 295 delta_mask_bits = Param.Unsigned(8, 296 "Lower bits to mask when comparing deltas") 297 table_entries = Param.MemorySize("128", 298 "Number of entries in the table") 299 table_assoc = Param.Unsigned(128, 300 "Associativity of the table") 301 table_indexing_policy = Param.BaseIndexingPolicy( 302 SetAssociative(entry_size = 1, assoc = Parent.table_assoc, 303 size = Parent.table_entries), 304 "Indexing policy of the table") 305 table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 306 "Replacement policy of the table") 307 308class DCPTPrefetcher(QueuedPrefetcher): 309 type = 'DCPTPrefetcher' 310 cxx_class = 'DCPTPrefetcher' 311 cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 312 dcpt = Param.DeltaCorrelatingPredictionTables( 313 DeltaCorrelatingPredictionTables(), 314 "Delta Correlating Prediction Tables object") 315 316class IrregularStreamBufferPrefetcher(QueuedPrefetcher): 317 type = "IrregularStreamBufferPrefetcher" 318 cxx_class = "IrregularStreamBufferPrefetcher" 319 cxx_header = "mem/cache/prefetch/irregular_stream_buffer.hh" 320 321 max_counter_value = Param.Unsigned(3, 322 "Maximum value of the confidence counter") 323 chunk_size = Param.Unsigned(256, 324 "Maximum number of addresses in a temporal stream") 325 degree = Param.Unsigned(4, "Number of prefetches to generate") 326 training_unit_assoc = Param.Unsigned(128, 327 "Associativity of the training unit") 328 training_unit_entries = Param.MemorySize("128", 329 "Number of entries of the training unit") 330 training_unit_indexing_policy = Param.BaseIndexingPolicy( 331 SetAssociative(entry_size = 1, assoc = Parent.training_unit_assoc, 332 size = Parent.training_unit_entries), 333 "Indexing policy of the training unit") 334 training_unit_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 335 "Replacement policy of the training unit") 336 337 prefetch_candidates_per_entry = Param.Unsigned(16, 338 "Number of prefetch candidates stored in a SP-AMC entry") 339 address_map_cache_assoc = Param.Unsigned(128, 340 "Associativity of the PS/SP AMCs") 341 address_map_cache_entries = Param.MemorySize("128", 342 "Number of entries of the PS/SP AMCs") 343 ps_address_map_cache_indexing_policy = Param.BaseIndexingPolicy( 344 SetAssociative(entry_size = 1, 345 assoc = Parent.address_map_cache_assoc, 346 size = Parent.address_map_cache_entries), 347 "Indexing policy of the Physical-to-Structural Address Map Cache") 348 ps_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 349 LRURP(), 350 "Replacement policy of the Physical-to-Structural Address Map Cache") 351 sp_address_map_cache_indexing_policy = Param.BaseIndexingPolicy( 352 SetAssociative(entry_size = 1, 353 assoc = Parent.address_map_cache_assoc, 354 size = Parent.address_map_cache_entries), 355 "Indexing policy of the Structural-to-Physical Address Mao Cache") 356 sp_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 357 LRURP(), 358 "Replacement policy of the Structural-to-Physical Address Map Cache") 359 360class SlimAccessMapPatternMatching(AccessMapPatternMatching): 361 start_degree = 2 362 limit_stride = 4 363 364class SlimDeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTables): 365 table_entries = "256" 366 table_assoc = 256 367 deltas_per_entry = 9 368 369class SlimAMPMPrefetcher(QueuedPrefetcher): 370 type = 'SlimAMPMPrefetcher' 371 cxx_class = 'SlimAMPMPrefetcher' 372 cxx_header = "mem/cache/prefetch/slim_ampm.hh" 373 374 ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(), 375 "Access Map Pattern Matching object") 376 dcpt = Param.DeltaCorrelatingPredictionTables( 377 SlimDeltaCorrelatingPredictionTables(), 378 "Delta Correlating Prediction Tables object") 379 380class BOPPrefetcher(QueuedPrefetcher): 381 type = "BOPPrefetcher" 382 cxx_class = "BOPPrefetcher" 383 cxx_header = "mem/cache/prefetch/bop.hh" 384 score_max = Param.Unsigned(31, "Max. score to update the best offset") 385 round_max = Param.Unsigned(100, "Max. round to update the best offset") 386 bad_score = Param.Unsigned(10, "Score at which the HWP is disabled") 387 rr_size = Param.Unsigned(64, "Number of entries of each RR bank") 388 tag_bits = Param.Unsigned(12, "Bits used to store the tag") 389 offset_list_size = Param.Unsigned(46, 390 "Number of entries in the offsets list") 391 negative_offsets_enable = Param.Bool(True, 392 "Initialize the offsets list also with negative values \ 393 (i.e. the table will have half of the entries with positive \ 394 offsets and the other half with negative ones)") 395 delay_queue_enable = Param.Bool(True, "Enable the delay queue") 396 delay_queue_size = Param.Unsigned(15, 397 "Number of entries in the delay queue") 398 delay_queue_cycles = Param.Cycles(60, 399 "Cycles to delay a write in the left RR table from the delay \ 400 queue") 401 402class SBOOEPrefetcher(QueuedPrefetcher): 403 type = 'SBOOEPrefetcher' 404 cxx_class = 'SBOOEPrefetcher' 405 cxx_header = "mem/cache/prefetch/sbooe.hh" 406 latency_buffer_size = Param.Int(32, "Entries in the latency buffer") 407 sequential_prefetchers = Param.Int(9, "Number of sequential prefetchers") 408 sandbox_entries = Param.Int(1024, "Size of the address buffer") 409 score_threshold_pct = Param.Percent(25, "Min. threshold to issue a \ 410 prefetch. The value is the percentage of sandbox entries to use") 411 412class STeMSPrefetcher(QueuedPrefetcher): 413 type = "STeMSPrefetcher" 414 cxx_class = "STeMSPrefetcher" 415 cxx_header = "mem/cache/prefetch/spatio_temporal_memory_streaming.hh" 416 417 spatial_region_size = Param.MemorySize("2kB", 418 "Memory covered by a hot zone") 419 active_generation_table_entries = Param.MemorySize("64", 420 "Number of entries in the active generation table") 421 active_generation_table_assoc = Param.Unsigned(64, 422 "Associativity of the active generation table") 423 active_generation_table_indexing_policy = Param.BaseIndexingPolicy( 424 SetAssociative(entry_size = 1, 425 assoc = Parent.active_generation_table_assoc, 426 size = Parent.active_generation_table_entries), 427 "Indexing policy of the active generation table") 428 active_generation_table_replacement_policy = Param.BaseReplacementPolicy( 429 LRURP(), "Replacement policy of the active generation table") 430 431 pattern_sequence_table_entries = Param.MemorySize("16384", 432 "Number of entries in the pattern sequence table") 433 pattern_sequence_table_assoc = Param.Unsigned(16384, 434 "Associativity of the pattern sequence table") 435 pattern_sequence_table_indexing_policy = Param.BaseIndexingPolicy( 436 SetAssociative(entry_size = 1, 437 assoc = Parent.pattern_sequence_table_assoc, 438 size = Parent.pattern_sequence_table_entries), 439 "Indexing policy of the pattern sequence table") 440 pattern_sequence_table_replacement_policy = Param.BaseReplacementPolicy( 441 LRURP(), "Replacement policy of the pattern sequence table") 442 443 region_miss_order_buffer_entries = Param.Unsigned(131072, 444 "Number of entries of the Region Miss Order Buffer") 445 reconstruction_entries = Param.Unsigned(256, 446 "Number of reconstruction entries")
| 47from m5.objects.ClockedObject import ClockedObject 48from m5.objects.IndexingPolicies import * 49from m5.objects.ReplacementPolicies import * 50 51class HWPProbeEvent(object): 52 def __init__(self, prefetcher, obj, *listOfNames): 53 self.obj = obj 54 self.prefetcher = prefetcher 55 self.names = listOfNames 56 57 def register(self): 58 if self.obj: 59 for name in self.names: 60 self.prefetcher.getCCObject().addEventProbe( 61 self.obj.getCCObject(), name) 62 63class BasePrefetcher(ClockedObject): 64 type = 'BasePrefetcher' 65 abstract = True 66 cxx_header = "mem/cache/prefetch/base.hh" 67 cxx_exports = [ 68 PyBindMethod("addEventProbe"), 69 ] 70 sys = Param.System(Parent.any, "System this prefetcher belongs to") 71 72 # Get the block size from the parent (system) 73 block_size = Param.Int(Parent.cache_line_size, "Block size in bytes") 74 75 on_miss = Param.Bool(False, "Only notify prefetcher on misses") 76 on_read = Param.Bool(True, "Notify prefetcher on reads") 77 on_write = Param.Bool(True, "Notify prefetcher on writes") 78 on_data = Param.Bool(True, "Notify prefetcher on data accesses") 79 on_inst = Param.Bool(True, "Notify prefetcher on instruction accesses") 80 prefetch_on_access = Param.Bool(Parent.prefetch_on_access, 81 "Notify the hardware prefetcher on every access (not just misses)") 82 use_virtual_addresses = Param.Bool(False, 83 "Use virtual addresses for prefetching") 84 85 _events = [] 86 def addEvent(self, newObject): 87 self._events.append(newObject) 88 89 # Override the normal SimObject::regProbeListeners method and 90 # register deferred event handlers. 91 def regProbeListeners(self): 92 for event in self._events: 93 event.register() 94 self.getCCObject().regProbeListeners() 95 96 def listenFromProbe(self, simObj, *probeNames): 97 if not isinstance(simObj, SimObject): 98 raise TypeError("argument must be of SimObject type") 99 if len(probeNames) <= 0: 100 raise TypeError("probeNames must have at least one element") 101 self.addEvent(HWPProbeEvent(self, simObj, *probeNames)) 102 103class QueuedPrefetcher(BasePrefetcher): 104 type = "QueuedPrefetcher" 105 abstract = True 106 cxx_class = "QueuedPrefetcher" 107 cxx_header = "mem/cache/prefetch/queued.hh" 108 latency = Param.Int(1, "Latency for generated prefetches") 109 queue_size = Param.Int(32, "Maximum number of queued prefetches") 110 queue_squash = Param.Bool(True, "Squash queued prefetch on demand access") 111 queue_filter = Param.Bool(True, "Don't queue redundant prefetches") 112 cache_snoop = Param.Bool(False, "Snoop cache to eliminate redundant request") 113 114 tag_prefetch = Param.Bool(True, "Tag prefetch with PC of generating access") 115 116class StridePrefetcher(QueuedPrefetcher): 117 type = 'StridePrefetcher' 118 cxx_class = 'StridePrefetcher' 119 cxx_header = "mem/cache/prefetch/stride.hh" 120 121 # Do not consult stride prefetcher on instruction accesses 122 on_inst = False 123 124 max_conf = Param.Int(7, "Maximum confidence level") 125 thresh_conf = Param.Int(4, "Threshold confidence level") 126 min_conf = Param.Int(0, "Minimum confidence level") 127 start_conf = Param.Int(4, "Starting confidence for new entries") 128 129 table_sets = Param.Int(16, "Number of sets in PC lookup table") 130 table_assoc = Param.Int(4, "Associativity of PC lookup table") 131 use_master_id = Param.Bool(True, "Use master id based history") 132 133 degree = Param.Int(4, "Number of prefetches to generate") 134 135 # Get replacement policy 136 replacement_policy = Param.BaseReplacementPolicy(RandomRP(), 137 "Replacement policy") 138 139class TaggedPrefetcher(QueuedPrefetcher): 140 type = 'TaggedPrefetcher' 141 cxx_class = 'TaggedPrefetcher' 142 cxx_header = "mem/cache/prefetch/tagged.hh" 143 144 degree = Param.Int(2, "Number of prefetches to generate") 145 146class IndirectMemoryPrefetcher(QueuedPrefetcher): 147 type = 'IndirectMemoryPrefetcher' 148 cxx_class = 'IndirectMemoryPrefetcher' 149 cxx_header = "mem/cache/prefetch/indirect_memory.hh" 150 pt_table_entries = Param.MemorySize("16", 151 "Number of entries of the Prefetch Table") 152 pt_table_assoc = Param.Unsigned(16, "Associativity of the Prefetch Table") 153 pt_table_indexing_policy = Param.BaseIndexingPolicy( 154 SetAssociative(entry_size = 1, assoc = Parent.pt_table_assoc, 155 size = Parent.pt_table_entries), 156 "Indexing policy of the pattern table") 157 pt_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 158 "Replacement policy of the pattern table") 159 max_prefetch_distance = Param.Unsigned(16, "Maximum prefetch distance") 160 max_indirect_counter_value = Param.Unsigned(8, 161 "Maximum value of the indirect counter") 162 ipd_table_entries = Param.MemorySize("4", 163 "Number of entries of the Indirect Pattern Detector") 164 ipd_table_assoc = Param.Unsigned(4, 165 "Associativity of the Indirect Pattern Detector") 166 ipd_table_indexing_policy = Param.BaseIndexingPolicy( 167 SetAssociative(entry_size = 1, assoc = Parent.ipd_table_assoc, 168 size = Parent.ipd_table_entries), 169 "Indexing policy of the Indirect Pattern Detector") 170 ipd_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 171 "Replacement policy of the Indirect Pattern Detector") 172 shift_values = VectorParam.Int([2, 3, 4, -3], "Shift values to evaluate") 173 addr_array_len = Param.Unsigned(4, "Number of misses tracked") 174 prefetch_threshold = Param.Unsigned(2, 175 "Counter threshold to start the indirect prefetching") 176 stream_counter_threshold = Param.Unsigned(4, 177 "Counter threshold to enable the stream prefetcher") 178 streaming_distance = Param.Unsigned(4, 179 "Number of prefetches to generate when using the stream prefetcher") 180 181class SignaturePathPrefetcher(QueuedPrefetcher): 182 type = 'SignaturePathPrefetcher' 183 cxx_class = 'SignaturePathPrefetcher' 184 cxx_header = "mem/cache/prefetch/signature_path.hh" 185 186 signature_shift = Param.UInt8(3, 187 "Number of bits to shift when calculating a new signature"); 188 signature_bits = Param.UInt16(12, 189 "Size of the signature, in bits"); 190 signature_table_entries = Param.MemorySize("1024", 191 "Number of entries of the signature table") 192 signature_table_assoc = Param.Unsigned(2, 193 "Associativity of the signature table") 194 signature_table_indexing_policy = Param.BaseIndexingPolicy( 195 SetAssociative(entry_size = 1, assoc = Parent.signature_table_assoc, 196 size = Parent.signature_table_entries), 197 "Indexing policy of the signature table") 198 signature_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 199 "Replacement policy of the signature table") 200 201 max_counter_value = Param.UInt8(7, "Maximum pattern counter value") 202 pattern_table_entries = Param.MemorySize("4096", 203 "Number of entries of the pattern table") 204 pattern_table_assoc = Param.Unsigned(1, 205 "Associativity of the pattern table") 206 strides_per_pattern_entry = Param.Unsigned(4, 207 "Number of strides stored in each pattern entry") 208 pattern_table_indexing_policy = Param.BaseIndexingPolicy( 209 SetAssociative(entry_size = 1, assoc = Parent.pattern_table_assoc, 210 size = Parent.pattern_table_entries), 211 "Indexing policy of the pattern table") 212 pattern_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 213 "Replacement policy of the pattern table") 214 215 prefetch_confidence_threshold = Param.Float(0.5, 216 "Minimum confidence to issue prefetches") 217 lookahead_confidence_threshold = Param.Float(0.75, 218 "Minimum confidence to continue exploring lookahead entries") 219 220class SignaturePathPrefetcherV2(SignaturePathPrefetcher): 221 type = 'SignaturePathPrefetcherV2' 222 cxx_class = 'SignaturePathPrefetcherV2' 223 cxx_header = "mem/cache/prefetch/signature_path_v2.hh" 224 225 signature_table_entries = "256" 226 signature_table_assoc = 1 227 pattern_table_entries = "512" 228 pattern_table_assoc = 1 229 max_counter_value = 15 230 prefetch_confidence_threshold = 0.25 231 lookahead_confidence_threshold = 0.25 232 233 global_history_register_entries = Param.MemorySize("8", 234 "Number of entries of global history register") 235 global_history_register_indexing_policy = Param.BaseIndexingPolicy( 236 SetAssociative(entry_size = 1, 237 assoc = Parent.global_history_register_entries, 238 size = Parent.global_history_register_entries), 239 "Indexing policy of the global history register") 240 global_history_register_replacement_policy = Param.BaseReplacementPolicy( 241 LRURP(), "Replacement policy of the global history register") 242 243class AccessMapPatternMatching(ClockedObject): 244 type = 'AccessMapPatternMatching' 245 cxx_class = 'AccessMapPatternMatching' 246 cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 247 248 block_size = Param.Unsigned(Parent.block_size, 249 "Cacheline size used by the prefetcher using this object") 250 251 limit_stride = Param.Unsigned(0, 252 "Limit the strides checked up to -X/X, if 0, disable the limit") 253 start_degree = Param.Unsigned(4, 254 "Initial degree (Maximum number of prefetches generated") 255 hot_zone_size = Param.MemorySize("2kB", "Memory covered by a hot zone") 256 access_map_table_entries = Param.MemorySize("256", 257 "Number of entries in the access map table") 258 access_map_table_assoc = Param.Unsigned(8, 259 "Associativity of the access map table") 260 access_map_table_indexing_policy = Param.BaseIndexingPolicy( 261 SetAssociative(entry_size = 1, assoc = Parent.access_map_table_assoc, 262 size = Parent.access_map_table_entries), 263 "Indexing policy of the access map table") 264 access_map_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 265 "Replacement policy of the access map table") 266 high_coverage_threshold = Param.Float(0.25, 267 "A prefetch coverage factor bigger than this is considered high") 268 low_coverage_threshold = Param.Float(0.125, 269 "A prefetch coverage factor smaller than this is considered low") 270 high_accuracy_threshold = Param.Float(0.5, 271 "A prefetch accuracy factor bigger than this is considered high") 272 low_accuracy_threshold = Param.Float(0.25, 273 "A prefetch accuracy factor smaller than this is considered low") 274 high_cache_hit_threshold = Param.Float(0.875, 275 "A cache hit ratio bigger than this is considered high") 276 low_cache_hit_threshold = Param.Float(0.75, 277 "A cache hit ratio smaller than this is considered low") 278 epoch_cycles = Param.Cycles(256000, "Cycles in an epoch period") 279 offchip_memory_latency = Param.Latency("30ns", 280 "Memory latency used to compute the required memory bandwidth") 281 282class AMPMPrefetcher(QueuedPrefetcher): 283 type = 'AMPMPrefetcher' 284 cxx_class = 'AMPMPrefetcher' 285 cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 286 ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(), 287 "Access Map Pattern Matching object") 288 289class DeltaCorrelatingPredictionTables(SimObject): 290 type = 'DeltaCorrelatingPredictionTables' 291 cxx_class = 'DeltaCorrelatingPredictionTables' 292 cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 293 deltas_per_entry = Param.Unsigned(20, 294 "Number of deltas stored in each table entry") 295 delta_bits = Param.Unsigned(12, "Bits per delta") 296 delta_mask_bits = Param.Unsigned(8, 297 "Lower bits to mask when comparing deltas") 298 table_entries = Param.MemorySize("128", 299 "Number of entries in the table") 300 table_assoc = Param.Unsigned(128, 301 "Associativity of the table") 302 table_indexing_policy = Param.BaseIndexingPolicy( 303 SetAssociative(entry_size = 1, assoc = Parent.table_assoc, 304 size = Parent.table_entries), 305 "Indexing policy of the table") 306 table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 307 "Replacement policy of the table") 308 309class DCPTPrefetcher(QueuedPrefetcher): 310 type = 'DCPTPrefetcher' 311 cxx_class = 'DCPTPrefetcher' 312 cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 313 dcpt = Param.DeltaCorrelatingPredictionTables( 314 DeltaCorrelatingPredictionTables(), 315 "Delta Correlating Prediction Tables object") 316 317class IrregularStreamBufferPrefetcher(QueuedPrefetcher): 318 type = "IrregularStreamBufferPrefetcher" 319 cxx_class = "IrregularStreamBufferPrefetcher" 320 cxx_header = "mem/cache/prefetch/irregular_stream_buffer.hh" 321 322 max_counter_value = Param.Unsigned(3, 323 "Maximum value of the confidence counter") 324 chunk_size = Param.Unsigned(256, 325 "Maximum number of addresses in a temporal stream") 326 degree = Param.Unsigned(4, "Number of prefetches to generate") 327 training_unit_assoc = Param.Unsigned(128, 328 "Associativity of the training unit") 329 training_unit_entries = Param.MemorySize("128", 330 "Number of entries of the training unit") 331 training_unit_indexing_policy = Param.BaseIndexingPolicy( 332 SetAssociative(entry_size = 1, assoc = Parent.training_unit_assoc, 333 size = Parent.training_unit_entries), 334 "Indexing policy of the training unit") 335 training_unit_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 336 "Replacement policy of the training unit") 337 338 prefetch_candidates_per_entry = Param.Unsigned(16, 339 "Number of prefetch candidates stored in a SP-AMC entry") 340 address_map_cache_assoc = Param.Unsigned(128, 341 "Associativity of the PS/SP AMCs") 342 address_map_cache_entries = Param.MemorySize("128", 343 "Number of entries of the PS/SP AMCs") 344 ps_address_map_cache_indexing_policy = Param.BaseIndexingPolicy( 345 SetAssociative(entry_size = 1, 346 assoc = Parent.address_map_cache_assoc, 347 size = Parent.address_map_cache_entries), 348 "Indexing policy of the Physical-to-Structural Address Map Cache") 349 ps_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 350 LRURP(), 351 "Replacement policy of the Physical-to-Structural Address Map Cache") 352 sp_address_map_cache_indexing_policy = Param.BaseIndexingPolicy( 353 SetAssociative(entry_size = 1, 354 assoc = Parent.address_map_cache_assoc, 355 size = Parent.address_map_cache_entries), 356 "Indexing policy of the Structural-to-Physical Address Mao Cache") 357 sp_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 358 LRURP(), 359 "Replacement policy of the Structural-to-Physical Address Map Cache") 360 361class SlimAccessMapPatternMatching(AccessMapPatternMatching): 362 start_degree = 2 363 limit_stride = 4 364 365class SlimDeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTables): 366 table_entries = "256" 367 table_assoc = 256 368 deltas_per_entry = 9 369 370class SlimAMPMPrefetcher(QueuedPrefetcher): 371 type = 'SlimAMPMPrefetcher' 372 cxx_class = 'SlimAMPMPrefetcher' 373 cxx_header = "mem/cache/prefetch/slim_ampm.hh" 374 375 ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(), 376 "Access Map Pattern Matching object") 377 dcpt = Param.DeltaCorrelatingPredictionTables( 378 SlimDeltaCorrelatingPredictionTables(), 379 "Delta Correlating Prediction Tables object") 380 381class BOPPrefetcher(QueuedPrefetcher): 382 type = "BOPPrefetcher" 383 cxx_class = "BOPPrefetcher" 384 cxx_header = "mem/cache/prefetch/bop.hh" 385 score_max = Param.Unsigned(31, "Max. score to update the best offset") 386 round_max = Param.Unsigned(100, "Max. round to update the best offset") 387 bad_score = Param.Unsigned(10, "Score at which the HWP is disabled") 388 rr_size = Param.Unsigned(64, "Number of entries of each RR bank") 389 tag_bits = Param.Unsigned(12, "Bits used to store the tag") 390 offset_list_size = Param.Unsigned(46, 391 "Number of entries in the offsets list") 392 negative_offsets_enable = Param.Bool(True, 393 "Initialize the offsets list also with negative values \ 394 (i.e. the table will have half of the entries with positive \ 395 offsets and the other half with negative ones)") 396 delay_queue_enable = Param.Bool(True, "Enable the delay queue") 397 delay_queue_size = Param.Unsigned(15, 398 "Number of entries in the delay queue") 399 delay_queue_cycles = Param.Cycles(60, 400 "Cycles to delay a write in the left RR table from the delay \ 401 queue") 402 403class SBOOEPrefetcher(QueuedPrefetcher): 404 type = 'SBOOEPrefetcher' 405 cxx_class = 'SBOOEPrefetcher' 406 cxx_header = "mem/cache/prefetch/sbooe.hh" 407 latency_buffer_size = Param.Int(32, "Entries in the latency buffer") 408 sequential_prefetchers = Param.Int(9, "Number of sequential prefetchers") 409 sandbox_entries = Param.Int(1024, "Size of the address buffer") 410 score_threshold_pct = Param.Percent(25, "Min. threshold to issue a \ 411 prefetch. The value is the percentage of sandbox entries to use") 412 413class STeMSPrefetcher(QueuedPrefetcher): 414 type = "STeMSPrefetcher" 415 cxx_class = "STeMSPrefetcher" 416 cxx_header = "mem/cache/prefetch/spatio_temporal_memory_streaming.hh" 417 418 spatial_region_size = Param.MemorySize("2kB", 419 "Memory covered by a hot zone") 420 active_generation_table_entries = Param.MemorySize("64", 421 "Number of entries in the active generation table") 422 active_generation_table_assoc = Param.Unsigned(64, 423 "Associativity of the active generation table") 424 active_generation_table_indexing_policy = Param.BaseIndexingPolicy( 425 SetAssociative(entry_size = 1, 426 assoc = Parent.active_generation_table_assoc, 427 size = Parent.active_generation_table_entries), 428 "Indexing policy of the active generation table") 429 active_generation_table_replacement_policy = Param.BaseReplacementPolicy( 430 LRURP(), "Replacement policy of the active generation table") 431 432 pattern_sequence_table_entries = Param.MemorySize("16384", 433 "Number of entries in the pattern sequence table") 434 pattern_sequence_table_assoc = Param.Unsigned(16384, 435 "Associativity of the pattern sequence table") 436 pattern_sequence_table_indexing_policy = Param.BaseIndexingPolicy( 437 SetAssociative(entry_size = 1, 438 assoc = Parent.pattern_sequence_table_assoc, 439 size = Parent.pattern_sequence_table_entries), 440 "Indexing policy of the pattern sequence table") 441 pattern_sequence_table_replacement_policy = Param.BaseReplacementPolicy( 442 LRURP(), "Replacement policy of the pattern sequence table") 443 444 region_miss_order_buffer_entries = Param.Unsigned(131072, 445 "Number of entries of the Region Miss Order Buffer") 446 reconstruction_entries = Param.Unsigned(256, 447 "Number of reconstruction entries")
|