Prefetcher.py revision 13991
14997Sgblack@eecs.umich.edu# Copyright (c) 2012, 2014, 2019 ARM Limited 24997Sgblack@eecs.umich.edu# All rights reserved. 34997Sgblack@eecs.umich.edu# 44997Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall 54997Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual 64997Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating 74997Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software 84997Sgblack@eecs.umich.edu# licensed hereunder. You may use the software subject to the license 94997Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated 104997Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software, 114997Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form. 124997Sgblack@eecs.umich.edu# 134997Sgblack@eecs.umich.edu# Copyright (c) 2005 The Regents of The University of Michigan 144997Sgblack@eecs.umich.edu# All rights reserved. 154997Sgblack@eecs.umich.edu# 164997Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 174997Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 184997Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 194997Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 204997Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 214997Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 224997Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 234997Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 244997Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 254997Sgblack@eecs.umich.edu# this software without specific prior written permission. 264997Sgblack@eecs.umich.edu# 274997Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 284997Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 294997Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 304997Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 314997Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 324997Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 334997Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 344997Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 354997Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 364997Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 374997Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 384997Sgblack@eecs.umich.edu# 394997Sgblack@eecs.umich.edu# Authors: Ron Dreslinski 404997Sgblack@eecs.umich.edu# Mitch Hayenga 414997Sgblack@eecs.umich.edu 424997Sgblack@eecs.umich.edufrom m5.SimObject import * 434997Sgblack@eecs.umich.edufrom m5.params import * 444997Sgblack@eecs.umich.edufrom m5.proxy import * 454997Sgblack@eecs.umich.edu 464997Sgblack@eecs.umich.edufrom m5.objects.ClockedObject import ClockedObject 474997Sgblack@eecs.umich.edufrom m5.objects.IndexingPolicies import * 484997Sgblack@eecs.umich.edufrom m5.objects.ReplacementPolicies import * 494997Sgblack@eecs.umich.edu 504997Sgblack@eecs.umich.educlass HWPProbeEvent(object): 514997Sgblack@eecs.umich.edu def __init__(self, prefetcher, obj, *listOfNames): 524997Sgblack@eecs.umich.edu self.obj = obj 534997Sgblack@eecs.umich.edu self.prefetcher = prefetcher 544997Sgblack@eecs.umich.edu self.names = listOfNames 554997Sgblack@eecs.umich.edu 564997Sgblack@eecs.umich.edu def register(self): 574997Sgblack@eecs.umich.edu if self.obj: 584997Sgblack@eecs.umich.edu for name in self.names: 594997Sgblack@eecs.umich.edu self.prefetcher.getCCObject().addEventProbe( 605086Sgblack@eecs.umich.edu self.obj.getCCObject(), name) 615086Sgblack@eecs.umich.edu 625086Sgblack@eecs.umich.educlass BasePrefetcher(ClockedObject): 635086Sgblack@eecs.umich.edu type = 'BasePrefetcher' 645086Sgblack@eecs.umich.edu abstract = True 655086Sgblack@eecs.umich.edu cxx_header = "mem/cache/prefetch/base.hh" 665086Sgblack@eecs.umich.edu cxx_exports = [ 675086Sgblack@eecs.umich.edu PyBindMethod("addEventProbe"), 685086Sgblack@eecs.umich.edu ] 695086Sgblack@eecs.umich.edu sys = Param.System(Parent.any, "System this prefetcher belongs to") 705086Sgblack@eecs.umich.edu 715086Sgblack@eecs.umich.edu # Get the block size from the parent (system) 725086Sgblack@eecs.umich.edu block_size = Param.Int(Parent.cache_line_size, "Block size in bytes") 735086Sgblack@eecs.umich.edu 745086Sgblack@eecs.umich.edu on_miss = Param.Bool(False, "Only notify prefetcher on misses") 755086Sgblack@eecs.umich.edu on_read = Param.Bool(True, "Notify prefetcher on reads") 765086Sgblack@eecs.umich.edu on_write = Param.Bool(True, "Notify prefetcher on writes") 775086Sgblack@eecs.umich.edu on_data = Param.Bool(True, "Notify prefetcher on data accesses") 785086Sgblack@eecs.umich.edu on_inst = Param.Bool(True, "Notify prefetcher on instruction accesses") 795086Sgblack@eecs.umich.edu prefetch_on_access = Param.Bool(Parent.prefetch_on_access, 805086Sgblack@eecs.umich.edu "Notify the hardware prefetcher on every access (not just misses)") 815086Sgblack@eecs.umich.edu use_virtual_addresses = Param.Bool(False, 825086Sgblack@eecs.umich.edu "Use virtual addresses for prefetching") 835086Sgblack@eecs.umich.edu 845086Sgblack@eecs.umich.edu _events = [] 855086Sgblack@eecs.umich.edu def addEvent(self, newObject): 865086Sgblack@eecs.umich.edu self._events.append(newObject) 875086Sgblack@eecs.umich.edu 885086Sgblack@eecs.umich.edu # Override the normal SimObject::regProbeListeners method and 895086Sgblack@eecs.umich.edu # register deferred event handlers. 905086Sgblack@eecs.umich.edu def regProbeListeners(self): 915086Sgblack@eecs.umich.edu for event in self._events: 925086Sgblack@eecs.umich.edu event.register() 935086Sgblack@eecs.umich.edu self.getCCObject().regProbeListeners() 945086Sgblack@eecs.umich.edu 955086Sgblack@eecs.umich.edu def listenFromProbe(self, simObj, *probeNames): 965086Sgblack@eecs.umich.edu if not isinstance(simObj, SimObject): 975086Sgblack@eecs.umich.edu raise TypeError("argument must be of SimObject type") 985086Sgblack@eecs.umich.edu if len(probeNames) <= 0: 995086Sgblack@eecs.umich.edu raise TypeError("probeNames must have at least one element") 1005086Sgblack@eecs.umich.edu self.addEvent(HWPProbeEvent(self, simObj, *probeNames)) 1015086Sgblack@eecs.umich.edu 1025086Sgblack@eecs.umich.educlass MultiPrefetcher(BasePrefetcher): 1035086Sgblack@eecs.umich.edu type = 'MultiPrefetcher' 1045086Sgblack@eecs.umich.edu cxx_class = 'MultiPrefetcher' 1055086Sgblack@eecs.umich.edu cxx_header = 'mem/cache/prefetch/multi.hh' 1065086Sgblack@eecs.umich.edu 1075086Sgblack@eecs.umich.edu prefetchers = VectorParam.BasePrefetcher([], "Array of prefetchers") 1085086Sgblack@eecs.umich.edu 1095086Sgblack@eecs.umich.educlass QueuedPrefetcher(BasePrefetcher): 1105086Sgblack@eecs.umich.edu type = "QueuedPrefetcher" 1115086Sgblack@eecs.umich.edu abstract = True 1125086Sgblack@eecs.umich.edu cxx_class = "QueuedPrefetcher" 1135086Sgblack@eecs.umich.edu cxx_header = "mem/cache/prefetch/queued.hh" 1145086Sgblack@eecs.umich.edu latency = Param.Int(1, "Latency for generated prefetches") 1155086Sgblack@eecs.umich.edu queue_size = Param.Int(32, "Maximum number of queued prefetches") 1165086Sgblack@eecs.umich.edu queue_squash = Param.Bool(True, "Squash queued prefetch on demand access") 1175086Sgblack@eecs.umich.edu queue_filter = Param.Bool(True, "Don't queue redundant prefetches") 1185086Sgblack@eecs.umich.edu cache_snoop = Param.Bool(False, "Snoop cache to eliminate redundant request") 1195086Sgblack@eecs.umich.edu 1205086Sgblack@eecs.umich.edu tag_prefetch = Param.Bool(True, "Tag prefetch with PC of generating access") 1215086Sgblack@eecs.umich.edu 1225086Sgblack@eecs.umich.educlass StridePrefetcher(QueuedPrefetcher): 1235086Sgblack@eecs.umich.edu type = 'StridePrefetcher' 1245086Sgblack@eecs.umich.edu cxx_class = 'StridePrefetcher' 1255086Sgblack@eecs.umich.edu cxx_header = "mem/cache/prefetch/stride.hh" 1265086Sgblack@eecs.umich.edu 1275086Sgblack@eecs.umich.edu # Do not consult stride prefetcher on instruction accesses 1285086Sgblack@eecs.umich.edu on_inst = False 1295086Sgblack@eecs.umich.edu 1305086Sgblack@eecs.umich.edu max_conf = Param.Int(7, "Maximum confidence level") 1315086Sgblack@eecs.umich.edu thresh_conf = Param.Int(4, "Threshold confidence level") 1325086Sgblack@eecs.umich.edu min_conf = Param.Int(0, "Minimum confidence level") 1335086Sgblack@eecs.umich.edu start_conf = Param.Int(4, "Starting confidence for new entries") 1345086Sgblack@eecs.umich.edu 1355086Sgblack@eecs.umich.edu table_sets = Param.Int(16, "Number of sets in PC lookup table") 1365086Sgblack@eecs.umich.edu table_assoc = Param.Int(4, "Associativity of PC lookup table") 1374997Sgblack@eecs.umich.edu use_master_id = Param.Bool(True, "Use master id based history") 1384997Sgblack@eecs.umich.edu 1394997Sgblack@eecs.umich.edu degree = Param.Int(4, "Number of prefetches to generate") 1405004Sgblack@eecs.umich.edu 1414997Sgblack@eecs.umich.edu # Get replacement policy 1424997Sgblack@eecs.umich.edu replacement_policy = Param.BaseReplacementPolicy(RandomRP(), 1435004Sgblack@eecs.umich.edu "Replacement policy") 1445004Sgblack@eecs.umich.edu 1455004Sgblack@eecs.umich.educlass TaggedPrefetcher(QueuedPrefetcher): 1465004Sgblack@eecs.umich.edu type = 'TaggedPrefetcher' 1475004Sgblack@eecs.umich.edu cxx_class = 'TaggedPrefetcher' 1485004Sgblack@eecs.umich.edu cxx_header = "mem/cache/prefetch/tagged.hh" 1495004Sgblack@eecs.umich.edu 1505004Sgblack@eecs.umich.edu degree = Param.Int(2, "Number of prefetches to generate") 1515004Sgblack@eecs.umich.edu 1525004Sgblack@eecs.umich.educlass IndirectMemoryPrefetcher(QueuedPrefetcher): 1535004Sgblack@eecs.umich.edu type = 'IndirectMemoryPrefetcher' 1544997Sgblack@eecs.umich.edu cxx_class = 'IndirectMemoryPrefetcher' 1554997Sgblack@eecs.umich.edu cxx_header = "mem/cache/prefetch/indirect_memory.hh" 1565086Sgblack@eecs.umich.edu pt_table_entries = Param.MemorySize("16", 1575086Sgblack@eecs.umich.edu "Number of entries of the Prefetch Table") 1584997Sgblack@eecs.umich.edu pt_table_assoc = Param.Unsigned(16, "Associativity of the Prefetch Table") 1594997Sgblack@eecs.umich.edu pt_table_indexing_policy = Param.BaseIndexingPolicy( 1604997Sgblack@eecs.umich.edu SetAssociative(entry_size = 1, assoc = Parent.pt_table_assoc, 1615038Sgblack@eecs.umich.edu size = Parent.pt_table_entries), 1624997Sgblack@eecs.umich.edu "Indexing policy of the pattern table") 1634997Sgblack@eecs.umich.edu pt_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 1644997Sgblack@eecs.umich.edu "Replacement policy of the pattern table") 1654997Sgblack@eecs.umich.edu max_prefetch_distance = Param.Unsigned(16, "Maximum prefetch distance") 1664997Sgblack@eecs.umich.edu num_indirect_counter_bits = Param.Unsigned(3, 1675038Sgblack@eecs.umich.edu "Number of bits of the indirect counter") 1684997Sgblack@eecs.umich.edu ipd_table_entries = Param.MemorySize("4", 169 "Number of entries of the Indirect Pattern Detector") 170 ipd_table_assoc = Param.Unsigned(4, 171 "Associativity of the Indirect Pattern Detector") 172 ipd_table_indexing_policy = Param.BaseIndexingPolicy( 173 SetAssociative(entry_size = 1, assoc = Parent.ipd_table_assoc, 174 size = Parent.ipd_table_entries), 175 "Indexing policy of the Indirect Pattern Detector") 176 ipd_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 177 "Replacement policy of the Indirect Pattern Detector") 178 shift_values = VectorParam.Int([2, 3, 4, -3], "Shift values to evaluate") 179 addr_array_len = Param.Unsigned(4, "Number of misses tracked") 180 prefetch_threshold = Param.Unsigned(2, 181 "Counter threshold to start the indirect prefetching") 182 stream_counter_threshold = Param.Unsigned(4, 183 "Counter threshold to enable the stream prefetcher") 184 streaming_distance = Param.Unsigned(4, 185 "Number of prefetches to generate when using the stream prefetcher") 186 187class SignaturePathPrefetcher(QueuedPrefetcher): 188 type = 'SignaturePathPrefetcher' 189 cxx_class = 'SignaturePathPrefetcher' 190 cxx_header = "mem/cache/prefetch/signature_path.hh" 191 192 signature_shift = Param.UInt8(3, 193 "Number of bits to shift when calculating a new signature"); 194 signature_bits = Param.UInt16(12, 195 "Size of the signature, in bits"); 196 signature_table_entries = Param.MemorySize("1024", 197 "Number of entries of the signature table") 198 signature_table_assoc = Param.Unsigned(2, 199 "Associativity of the signature table") 200 signature_table_indexing_policy = Param.BaseIndexingPolicy( 201 SetAssociative(entry_size = 1, assoc = Parent.signature_table_assoc, 202 size = Parent.signature_table_entries), 203 "Indexing policy of the signature table") 204 signature_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 205 "Replacement policy of the signature table") 206 207 num_counter_bits = Param.UInt8(3, 208 "Number of bits of the saturating counters") 209 pattern_table_entries = Param.MemorySize("4096", 210 "Number of entries of the pattern table") 211 pattern_table_assoc = Param.Unsigned(1, 212 "Associativity of the pattern table") 213 strides_per_pattern_entry = Param.Unsigned(4, 214 "Number of strides stored in each pattern entry") 215 pattern_table_indexing_policy = Param.BaseIndexingPolicy( 216 SetAssociative(entry_size = 1, assoc = Parent.pattern_table_assoc, 217 size = Parent.pattern_table_entries), 218 "Indexing policy of the pattern table") 219 pattern_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 220 "Replacement policy of the pattern table") 221 222 prefetch_confidence_threshold = Param.Float(0.5, 223 "Minimum confidence to issue prefetches") 224 lookahead_confidence_threshold = Param.Float(0.75, 225 "Minimum confidence to continue exploring lookahead entries") 226 227class SignaturePathPrefetcherV2(SignaturePathPrefetcher): 228 type = 'SignaturePathPrefetcherV2' 229 cxx_class = 'SignaturePathPrefetcherV2' 230 cxx_header = "mem/cache/prefetch/signature_path_v2.hh" 231 232 signature_table_entries = "256" 233 signature_table_assoc = 1 234 pattern_table_entries = "512" 235 pattern_table_assoc = 1 236 num_counter_bits = 4 237 prefetch_confidence_threshold = 0.25 238 lookahead_confidence_threshold = 0.25 239 240 global_history_register_entries = Param.MemorySize("8", 241 "Number of entries of global history register") 242 global_history_register_indexing_policy = Param.BaseIndexingPolicy( 243 SetAssociative(entry_size = 1, 244 assoc = Parent.global_history_register_entries, 245 size = Parent.global_history_register_entries), 246 "Indexing policy of the global history register") 247 global_history_register_replacement_policy = Param.BaseReplacementPolicy( 248 LRURP(), "Replacement policy of the global history register") 249 250class AccessMapPatternMatching(ClockedObject): 251 type = 'AccessMapPatternMatching' 252 cxx_class = 'AccessMapPatternMatching' 253 cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 254 255 block_size = Param.Unsigned(Parent.block_size, 256 "Cacheline size used by the prefetcher using this object") 257 258 limit_stride = Param.Unsigned(0, 259 "Limit the strides checked up to -X/X, if 0, disable the limit") 260 start_degree = Param.Unsigned(4, 261 "Initial degree (Maximum number of prefetches generated") 262 hot_zone_size = Param.MemorySize("2kB", "Memory covered by a hot zone") 263 access_map_table_entries = Param.MemorySize("256", 264 "Number of entries in the access map table") 265 access_map_table_assoc = Param.Unsigned(8, 266 "Associativity of the access map table") 267 access_map_table_indexing_policy = Param.BaseIndexingPolicy( 268 SetAssociative(entry_size = 1, assoc = Parent.access_map_table_assoc, 269 size = Parent.access_map_table_entries), 270 "Indexing policy of the access map table") 271 access_map_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 272 "Replacement policy of the access map table") 273 high_coverage_threshold = Param.Float(0.25, 274 "A prefetch coverage factor bigger than this is considered high") 275 low_coverage_threshold = Param.Float(0.125, 276 "A prefetch coverage factor smaller than this is considered low") 277 high_accuracy_threshold = Param.Float(0.5, 278 "A prefetch accuracy factor bigger than this is considered high") 279 low_accuracy_threshold = Param.Float(0.25, 280 "A prefetch accuracy factor smaller than this is considered low") 281 high_cache_hit_threshold = Param.Float(0.875, 282 "A cache hit ratio bigger than this is considered high") 283 low_cache_hit_threshold = Param.Float(0.75, 284 "A cache hit ratio smaller than this is considered low") 285 epoch_cycles = Param.Cycles(256000, "Cycles in an epoch period") 286 offchip_memory_latency = Param.Latency("30ns", 287 "Memory latency used to compute the required memory bandwidth") 288 289class AMPMPrefetcher(QueuedPrefetcher): 290 type = 'AMPMPrefetcher' 291 cxx_class = 'AMPMPrefetcher' 292 cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 293 ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(), 294 "Access Map Pattern Matching object") 295 296class DeltaCorrelatingPredictionTables(SimObject): 297 type = 'DeltaCorrelatingPredictionTables' 298 cxx_class = 'DeltaCorrelatingPredictionTables' 299 cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 300 deltas_per_entry = Param.Unsigned(20, 301 "Number of deltas stored in each table entry") 302 delta_bits = Param.Unsigned(12, "Bits per delta") 303 delta_mask_bits = Param.Unsigned(8, 304 "Lower bits to mask when comparing deltas") 305 table_entries = Param.MemorySize("128", 306 "Number of entries in the table") 307 table_assoc = Param.Unsigned(128, 308 "Associativity of the table") 309 table_indexing_policy = Param.BaseIndexingPolicy( 310 SetAssociative(entry_size = 1, assoc = Parent.table_assoc, 311 size = Parent.table_entries), 312 "Indexing policy of the table") 313 table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 314 "Replacement policy of the table") 315 316class DCPTPrefetcher(QueuedPrefetcher): 317 type = 'DCPTPrefetcher' 318 cxx_class = 'DCPTPrefetcher' 319 cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 320 dcpt = Param.DeltaCorrelatingPredictionTables( 321 DeltaCorrelatingPredictionTables(), 322 "Delta Correlating Prediction Tables object") 323 324class IrregularStreamBufferPrefetcher(QueuedPrefetcher): 325 type = "IrregularStreamBufferPrefetcher" 326 cxx_class = "IrregularStreamBufferPrefetcher" 327 cxx_header = "mem/cache/prefetch/irregular_stream_buffer.hh" 328 329 num_counter_bits = Param.Unsigned(2, 330 "Number of bits of the confidence counter") 331 chunk_size = Param.Unsigned(256, 332 "Maximum number of addresses in a temporal stream") 333 degree = Param.Unsigned(4, "Number of prefetches to generate") 334 training_unit_assoc = Param.Unsigned(128, 335 "Associativity of the training unit") 336 training_unit_entries = Param.MemorySize("128", 337 "Number of entries of the training unit") 338 training_unit_indexing_policy = Param.BaseIndexingPolicy( 339 SetAssociative(entry_size = 1, assoc = Parent.training_unit_assoc, 340 size = Parent.training_unit_entries), 341 "Indexing policy of the training unit") 342 training_unit_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 343 "Replacement policy of the training unit") 344 345 prefetch_candidates_per_entry = Param.Unsigned(16, 346 "Number of prefetch candidates stored in a SP-AMC entry") 347 address_map_cache_assoc = Param.Unsigned(128, 348 "Associativity of the PS/SP AMCs") 349 address_map_cache_entries = Param.MemorySize("128", 350 "Number of entries of the PS/SP AMCs") 351 ps_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 Physical-to-Structural Address Map Cache") 356 ps_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 357 LRURP(), 358 "Replacement policy of the Physical-to-Structural Address Map Cache") 359 sp_address_map_cache_indexing_policy = Param.BaseIndexingPolicy( 360 SetAssociative(entry_size = 1, 361 assoc = Parent.address_map_cache_assoc, 362 size = Parent.address_map_cache_entries), 363 "Indexing policy of the Structural-to-Physical Address Mao Cache") 364 sp_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 365 LRURP(), 366 "Replacement policy of the Structural-to-Physical Address Map Cache") 367 368class SlimAccessMapPatternMatching(AccessMapPatternMatching): 369 start_degree = 2 370 limit_stride = 4 371 372class SlimDeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTables): 373 table_entries = "256" 374 table_assoc = 256 375 deltas_per_entry = 9 376 377class SlimAMPMPrefetcher(QueuedPrefetcher): 378 type = 'SlimAMPMPrefetcher' 379 cxx_class = 'SlimAMPMPrefetcher' 380 cxx_header = "mem/cache/prefetch/slim_ampm.hh" 381 382 ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(), 383 "Access Map Pattern Matching object") 384 dcpt = Param.DeltaCorrelatingPredictionTables( 385 SlimDeltaCorrelatingPredictionTables(), 386 "Delta Correlating Prediction Tables object") 387 388class BOPPrefetcher(QueuedPrefetcher): 389 type = "BOPPrefetcher" 390 cxx_class = "BOPPrefetcher" 391 cxx_header = "mem/cache/prefetch/bop.hh" 392 score_max = Param.Unsigned(31, "Max. score to update the best offset") 393 round_max = Param.Unsigned(100, "Max. round to update the best offset") 394 bad_score = Param.Unsigned(10, "Score at which the HWP is disabled") 395 rr_size = Param.Unsigned(64, "Number of entries of each RR bank") 396 tag_bits = Param.Unsigned(12, "Bits used to store the tag") 397 offset_list_size = Param.Unsigned(46, 398 "Number of entries in the offsets list") 399 negative_offsets_enable = Param.Bool(True, 400 "Initialize the offsets list also with negative values \ 401 (i.e. the table will have half of the entries with positive \ 402 offsets and the other half with negative ones)") 403 delay_queue_enable = Param.Bool(True, "Enable the delay queue") 404 delay_queue_size = Param.Unsigned(15, 405 "Number of entries in the delay queue") 406 delay_queue_cycles = Param.Cycles(60, 407 "Cycles to delay a write in the left RR table from the delay \ 408 queue") 409 410class SBOOEPrefetcher(QueuedPrefetcher): 411 type = 'SBOOEPrefetcher' 412 cxx_class = 'SBOOEPrefetcher' 413 cxx_header = "mem/cache/prefetch/sbooe.hh" 414 latency_buffer_size = Param.Int(32, "Entries in the latency buffer") 415 sequential_prefetchers = Param.Int(9, "Number of sequential prefetchers") 416 sandbox_entries = Param.Int(1024, "Size of the address buffer") 417 score_threshold_pct = Param.Percent(25, "Min. threshold to issue a \ 418 prefetch. The value is the percentage of sandbox entries to use") 419 420class STeMSPrefetcher(QueuedPrefetcher): 421 type = "STeMSPrefetcher" 422 cxx_class = "STeMSPrefetcher" 423 cxx_header = "mem/cache/prefetch/spatio_temporal_memory_streaming.hh" 424 425 spatial_region_size = Param.MemorySize("2kB", 426 "Memory covered by a hot zone") 427 active_generation_table_entries = Param.MemorySize("64", 428 "Number of entries in the active generation table") 429 active_generation_table_assoc = Param.Unsigned(64, 430 "Associativity of the active generation table") 431 active_generation_table_indexing_policy = Param.BaseIndexingPolicy( 432 SetAssociative(entry_size = 1, 433 assoc = Parent.active_generation_table_assoc, 434 size = Parent.active_generation_table_entries), 435 "Indexing policy of the active generation table") 436 active_generation_table_replacement_policy = Param.BaseReplacementPolicy( 437 LRURP(), "Replacement policy of the active generation table") 438 439 pattern_sequence_table_entries = Param.MemorySize("16384", 440 "Number of entries in the pattern sequence table") 441 pattern_sequence_table_assoc = Param.Unsigned(16384, 442 "Associativity of the pattern sequence table") 443 pattern_sequence_table_indexing_policy = Param.BaseIndexingPolicy( 444 SetAssociative(entry_size = 1, 445 assoc = Parent.pattern_sequence_table_assoc, 446 size = Parent.pattern_sequence_table_entries), 447 "Indexing policy of the pattern sequence table") 448 pattern_sequence_table_replacement_policy = Param.BaseReplacementPolicy( 449 LRURP(), "Replacement policy of the pattern sequence table") 450 451 region_miss_order_buffer_entries = Param.Unsigned(131072, 452 "Number of entries of the Region Miss Order Buffer") 453 reconstruction_entries = Param.Unsigned(256, 454 "Number of reconstruction entries") 455 456class HWPProbeEventRetiredInsts(HWPProbeEvent): 457 def register(self): 458 if self.obj: 459 for name in self.names: 460 self.prefetcher.getCCObject().addEventProbeRetiredInsts( 461 self.obj.getCCObject(), name) 462 463class PIFPrefetcher(QueuedPrefetcher): 464 type = 'PIFPrefetcher' 465 cxx_class = 'PIFPrefetcher' 466 cxx_header = "mem/cache/prefetch/pif.hh" 467 cxx_exports = [ 468 PyBindMethod("addEventProbeRetiredInsts"), 469 ] 470 471 prec_spatial_region_bits = Param.Unsigned(2, 472 "Number of preceding addresses in the spatial region") 473 succ_spatial_region_bits = Param.Unsigned(8, 474 "Number of subsequent addresses in the spatial region") 475 compactor_entries = Param.Unsigned(2, "Entries in the temp. compactor") 476 stream_address_buffer_entries = Param.Unsigned(7, "Entries in the SAB") 477 history_buffer_size = Param.Unsigned(16, "Entries in the history buffer") 478 479 index_entries = Param.MemorySize("64", 480 "Number of entries in the index") 481 index_assoc = Param.Unsigned(64, 482 "Associativity of the index") 483 index_indexing_policy = Param.BaseIndexingPolicy( 484 SetAssociative(entry_size = 1, assoc = Parent.index_assoc, 485 size = Parent.index_entries), 486 "Indexing policy of the index") 487 index_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 488 "Replacement policy of the index") 489 490 def listenFromProbeRetiredInstructions(self, simObj): 491 if not isinstance(simObj, SimObject): 492 raise TypeError("argument must be of SimObject type") 493 self.addEvent(HWPProbeEventRetiredInsts(self, simObj,"RetiredInstsPC")) 494