113991Sandreas.sandberg@arm.com# Copyright (c) 2012, 2014, 2019 ARM Limited 29288Sandreas.hansson@arm.com# All rights reserved. 39288Sandreas.hansson@arm.com# 49288Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall 59288Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual 69288Sandreas.hansson@arm.com# property including but not limited to intellectual property relating 79288Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software 89288Sandreas.hansson@arm.com# licensed hereunder. You may use the software subject to the license 99288Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated 109288Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software, 119288Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form. 129288Sandreas.hansson@arm.com# 139288Sandreas.hansson@arm.com# Copyright (c) 2005 The Regents of The University of Michigan 149288Sandreas.hansson@arm.com# All rights reserved. 159288Sandreas.hansson@arm.com# 169288Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without 179288Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are 189288Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright 199288Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer; 209288Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright 219288Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the 229288Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution; 239288Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its 249288Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from 259288Sandreas.hansson@arm.com# this software without specific prior written permission. 269288Sandreas.hansson@arm.com# 279288Sandreas.hansson@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 289288Sandreas.hansson@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 299288Sandreas.hansson@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 309288Sandreas.hansson@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 319288Sandreas.hansson@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 329288Sandreas.hansson@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 339288Sandreas.hansson@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 349288Sandreas.hansson@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 359288Sandreas.hansson@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 369288Sandreas.hansson@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 379288Sandreas.hansson@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 389288Sandreas.hansson@arm.com# 399288Sandreas.hansson@arm.com# Authors: Ron Dreslinski 4010623Smitch.hayenga@arm.com# Mitch Hayenga 419288Sandreas.hansson@arm.com 4213416Sjavier.bueno@metempsy.comfrom m5.SimObject import * 438831Smrinmoy.ghosh@arm.comfrom m5.params import * 448832SAli.Saidi@ARM.comfrom m5.proxy import * 4513665Sandreas.sandberg@arm.com 4613665Sandreas.sandberg@arm.comfrom m5.objects.ClockedObject import ClockedObject 4713665Sandreas.sandberg@arm.comfrom m5.objects.IndexingPolicies import * 4813665Sandreas.sandberg@arm.comfrom m5.objects.ReplacementPolicies import * 498832SAli.Saidi@ARM.com 5013416Sjavier.bueno@metempsy.comclass HWPProbeEvent(object): 5113416Sjavier.bueno@metempsy.com def __init__(self, prefetcher, obj, *listOfNames): 5213416Sjavier.bueno@metempsy.com self.obj = obj 5313416Sjavier.bueno@metempsy.com self.prefetcher = prefetcher 5413416Sjavier.bueno@metempsy.com self.names = listOfNames 5513416Sjavier.bueno@metempsy.com 5613416Sjavier.bueno@metempsy.com def register(self): 5713416Sjavier.bueno@metempsy.com if self.obj: 5813416Sjavier.bueno@metempsy.com for name in self.names: 5913416Sjavier.bueno@metempsy.com self.prefetcher.getCCObject().addEventProbe( 6013416Sjavier.bueno@metempsy.com self.obj.getCCObject(), name) 6113416Sjavier.bueno@metempsy.com 629288Sandreas.hansson@arm.comclass BasePrefetcher(ClockedObject): 638831Smrinmoy.ghosh@arm.com type = 'BasePrefetcher' 648831Smrinmoy.ghosh@arm.com abstract = True 659338SAndreas.Sandberg@arm.com cxx_header = "mem/cache/prefetch/base.hh" 6613416Sjavier.bueno@metempsy.com cxx_exports = [ 6713416Sjavier.bueno@metempsy.com PyBindMethod("addEventProbe"), 6814013Sjavier.bueno@metempsy.com PyBindMethod("addTLB"), 6913416Sjavier.bueno@metempsy.com ] 7010466Sandreas.hansson@arm.com sys = Param.System(Parent.any, "System this prefetcher belongs to") 718831Smrinmoy.ghosh@arm.com 7213422Sodanrc@yahoo.com.br # Get the block size from the parent (system) 7313422Sodanrc@yahoo.com.br block_size = Param.Int(Parent.cache_line_size, "Block size in bytes") 7413422Sodanrc@yahoo.com.br 7510623Smitch.hayenga@arm.com on_miss = Param.Bool(False, "Only notify prefetcher on misses") 7610623Smitch.hayenga@arm.com on_read = Param.Bool(True, "Notify prefetcher on reads") 7710623Smitch.hayenga@arm.com on_write = Param.Bool(True, "Notify prefetcher on writes") 7810623Smitch.hayenga@arm.com on_data = Param.Bool(True, "Notify prefetcher on data accesses") 7910623Smitch.hayenga@arm.com on_inst = Param.Bool(True, "Notify prefetcher on instruction accesses") 8013416Sjavier.bueno@metempsy.com prefetch_on_access = Param.Bool(Parent.prefetch_on_access, 8113416Sjavier.bueno@metempsy.com "Notify the hardware prefetcher on every access (not just misses)") 8213551Sjavier.bueno@metempsy.com use_virtual_addresses = Param.Bool(False, 8313551Sjavier.bueno@metempsy.com "Use virtual addresses for prefetching") 8413416Sjavier.bueno@metempsy.com 8513416Sjavier.bueno@metempsy.com _events = [] 8613416Sjavier.bueno@metempsy.com def addEvent(self, newObject): 8713416Sjavier.bueno@metempsy.com self._events.append(newObject) 8813416Sjavier.bueno@metempsy.com 8913416Sjavier.bueno@metempsy.com # Override the normal SimObject::regProbeListeners method and 9013416Sjavier.bueno@metempsy.com # register deferred event handlers. 9113416Sjavier.bueno@metempsy.com def regProbeListeners(self): 9214013Sjavier.bueno@metempsy.com for tlb in self._tlbs: 9314013Sjavier.bueno@metempsy.com self.getCCObject().addTLB(tlb.getCCObject()) 9413416Sjavier.bueno@metempsy.com for event in self._events: 9513416Sjavier.bueno@metempsy.com event.register() 9613416Sjavier.bueno@metempsy.com self.getCCObject().regProbeListeners() 9713416Sjavier.bueno@metempsy.com 9813416Sjavier.bueno@metempsy.com def listenFromProbe(self, simObj, *probeNames): 9913416Sjavier.bueno@metempsy.com if not isinstance(simObj, SimObject): 10013416Sjavier.bueno@metempsy.com raise TypeError("argument must be of SimObject type") 10113416Sjavier.bueno@metempsy.com if len(probeNames) <= 0: 10213416Sjavier.bueno@metempsy.com raise TypeError("probeNames must have at least one element") 10313416Sjavier.bueno@metempsy.com self.addEvent(HWPProbeEvent(self, simObj, *probeNames)) 10414013Sjavier.bueno@metempsy.com _tlbs = [] 10514013Sjavier.bueno@metempsy.com def registerTLB(self, simObj): 10614013Sjavier.bueno@metempsy.com if not isinstance(simObj, SimObject): 10714013Sjavier.bueno@metempsy.com raise TypeError("argument must be a SimObject type") 10814013Sjavier.bueno@metempsy.com self._tlbs.append(simObj) 10910623Smitch.hayenga@arm.com 11013991Sandreas.sandberg@arm.comclass MultiPrefetcher(BasePrefetcher): 11113991Sandreas.sandberg@arm.com type = 'MultiPrefetcher' 11213991Sandreas.sandberg@arm.com cxx_class = 'MultiPrefetcher' 11313991Sandreas.sandberg@arm.com cxx_header = 'mem/cache/prefetch/multi.hh' 11413991Sandreas.sandberg@arm.com 11513991Sandreas.sandberg@arm.com prefetchers = VectorParam.BasePrefetcher([], "Array of prefetchers") 11613991Sandreas.sandberg@arm.com 11710623Smitch.hayenga@arm.comclass QueuedPrefetcher(BasePrefetcher): 11810623Smitch.hayenga@arm.com type = "QueuedPrefetcher" 11910623Smitch.hayenga@arm.com abstract = True 12010623Smitch.hayenga@arm.com cxx_class = "QueuedPrefetcher" 12110623Smitch.hayenga@arm.com cxx_header = "mem/cache/prefetch/queued.hh" 12210623Smitch.hayenga@arm.com latency = Param.Int(1, "Latency for generated prefetches") 12310623Smitch.hayenga@arm.com queue_size = Param.Int(32, "Maximum number of queued prefetches") 12414013Sjavier.bueno@metempsy.com max_prefetch_requests_with_pending_translation = Param.Int(32, 12514013Sjavier.bueno@metempsy.com "Maximum number of queued prefetches that have a missing translation") 12610623Smitch.hayenga@arm.com queue_squash = Param.Bool(True, "Squash queued prefetch on demand access") 12710623Smitch.hayenga@arm.com queue_filter = Param.Bool(True, "Don't queue redundant prefetches") 12810623Smitch.hayenga@arm.com cache_snoop = Param.Bool(False, "Snoop cache to eliminate redundant request") 12910623Smitch.hayenga@arm.com 13010623Smitch.hayenga@arm.com tag_prefetch = Param.Bool(True, "Tag prefetch with PC of generating access") 13110623Smitch.hayenga@arm.com 13214015Sjavier.bueno@metempsy.com # The throttle_control_percentage controls how many of the candidate 13314015Sjavier.bueno@metempsy.com # addresses generated by the prefetcher will be finally turned into 13414015Sjavier.bueno@metempsy.com # prefetch requests 13514015Sjavier.bueno@metempsy.com # - If set to 100, all candidates can be discarded (one request 13614015Sjavier.bueno@metempsy.com # will always be allowed to be generated) 13714015Sjavier.bueno@metempsy.com # - Setting it to 0 will disable the throttle control, so requests are 13814015Sjavier.bueno@metempsy.com # created for all candidates 13914015Sjavier.bueno@metempsy.com # - If set to 60, 40% of candidates will generate a request, and the 14014015Sjavier.bueno@metempsy.com # remaining 60% will be generated depending on the current accuracy 14114015Sjavier.bueno@metempsy.com throttle_control_percentage = Param.Percent(0, "Percentage of requests \ 14214015Sjavier.bueno@metempsy.com that can be throttled depending on the accuracy of the prefetcher.") 14314015Sjavier.bueno@metempsy.com 14410623Smitch.hayenga@arm.comclass StridePrefetcher(QueuedPrefetcher): 1458831Smrinmoy.ghosh@arm.com type = 'StridePrefetcher' 1468831Smrinmoy.ghosh@arm.com cxx_class = 'StridePrefetcher' 1479338SAndreas.Sandberg@arm.com cxx_header = "mem/cache/prefetch/stride.hh" 1488831Smrinmoy.ghosh@arm.com 14913422Sodanrc@yahoo.com.br # Do not consult stride prefetcher on instruction accesses 15013422Sodanrc@yahoo.com.br on_inst = False 15113422Sodanrc@yahoo.com.br 15210623Smitch.hayenga@arm.com max_conf = Param.Int(7, "Maximum confidence level") 15310623Smitch.hayenga@arm.com thresh_conf = Param.Int(4, "Threshold confidence level") 15410623Smitch.hayenga@arm.com min_conf = Param.Int(0, "Minimum confidence level") 15510623Smitch.hayenga@arm.com start_conf = Param.Int(4, "Starting confidence for new entries") 15610623Smitch.hayenga@arm.com 15710623Smitch.hayenga@arm.com table_sets = Param.Int(16, "Number of sets in PC lookup table") 15810623Smitch.hayenga@arm.com table_assoc = Param.Int(4, "Associativity of PC lookup table") 15910623Smitch.hayenga@arm.com use_master_id = Param.Bool(True, "Use master id based history") 16010623Smitch.hayenga@arm.com 16110623Smitch.hayenga@arm.com degree = Param.Int(4, "Number of prefetches to generate") 16210623Smitch.hayenga@arm.com 16313427Sodanrc@yahoo.com.br # Get replacement policy 16413427Sodanrc@yahoo.com.br replacement_policy = Param.BaseReplacementPolicy(RandomRP(), 16513427Sodanrc@yahoo.com.br "Replacement policy") 16613427Sodanrc@yahoo.com.br 16710623Smitch.hayenga@arm.comclass TaggedPrefetcher(QueuedPrefetcher): 1688831Smrinmoy.ghosh@arm.com type = 'TaggedPrefetcher' 1698831Smrinmoy.ghosh@arm.com cxx_class = 'TaggedPrefetcher' 1709338SAndreas.Sandberg@arm.com cxx_header = "mem/cache/prefetch/tagged.hh" 1718831Smrinmoy.ghosh@arm.com 17210623Smitch.hayenga@arm.com degree = Param.Int(2, "Number of prefetches to generate") 17313553Sjavier.bueno@metempsy.com 17413772Sjavier.bueno@metempsy.comclass IndirectMemoryPrefetcher(QueuedPrefetcher): 17513772Sjavier.bueno@metempsy.com type = 'IndirectMemoryPrefetcher' 17613772Sjavier.bueno@metempsy.com cxx_class = 'IndirectMemoryPrefetcher' 17713772Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/indirect_memory.hh" 17813772Sjavier.bueno@metempsy.com pt_table_entries = Param.MemorySize("16", 17913772Sjavier.bueno@metempsy.com "Number of entries of the Prefetch Table") 18013772Sjavier.bueno@metempsy.com pt_table_assoc = Param.Unsigned(16, "Associativity of the Prefetch Table") 18113772Sjavier.bueno@metempsy.com pt_table_indexing_policy = Param.BaseIndexingPolicy( 18213772Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.pt_table_assoc, 18313772Sjavier.bueno@metempsy.com size = Parent.pt_table_entries), 18413772Sjavier.bueno@metempsy.com "Indexing policy of the pattern table") 18513772Sjavier.bueno@metempsy.com pt_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 18613772Sjavier.bueno@metempsy.com "Replacement policy of the pattern table") 18713772Sjavier.bueno@metempsy.com max_prefetch_distance = Param.Unsigned(16, "Maximum prefetch distance") 18813963Sodanrc@yahoo.com.br num_indirect_counter_bits = Param.Unsigned(3, 18913963Sodanrc@yahoo.com.br "Number of bits of the indirect counter") 19013772Sjavier.bueno@metempsy.com ipd_table_entries = Param.MemorySize("4", 19113772Sjavier.bueno@metempsy.com "Number of entries of the Indirect Pattern Detector") 19213772Sjavier.bueno@metempsy.com ipd_table_assoc = Param.Unsigned(4, 19313772Sjavier.bueno@metempsy.com "Associativity of the Indirect Pattern Detector") 19413772Sjavier.bueno@metempsy.com ipd_table_indexing_policy = Param.BaseIndexingPolicy( 19513772Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.ipd_table_assoc, 19613772Sjavier.bueno@metempsy.com size = Parent.ipd_table_entries), 19713772Sjavier.bueno@metempsy.com "Indexing policy of the Indirect Pattern Detector") 19813772Sjavier.bueno@metempsy.com ipd_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 19913772Sjavier.bueno@metempsy.com "Replacement policy of the Indirect Pattern Detector") 20013772Sjavier.bueno@metempsy.com shift_values = VectorParam.Int([2, 3, 4, -3], "Shift values to evaluate") 20113772Sjavier.bueno@metempsy.com addr_array_len = Param.Unsigned(4, "Number of misses tracked") 20213772Sjavier.bueno@metempsy.com prefetch_threshold = Param.Unsigned(2, 20313772Sjavier.bueno@metempsy.com "Counter threshold to start the indirect prefetching") 20413772Sjavier.bueno@metempsy.com stream_counter_threshold = Param.Unsigned(4, 20513772Sjavier.bueno@metempsy.com "Counter threshold to enable the stream prefetcher") 20613772Sjavier.bueno@metempsy.com streaming_distance = Param.Unsigned(4, 20713772Sjavier.bueno@metempsy.com "Number of prefetches to generate when using the stream prefetcher") 20813772Sjavier.bueno@metempsy.com 20913553Sjavier.bueno@metempsy.comclass SignaturePathPrefetcher(QueuedPrefetcher): 21013553Sjavier.bueno@metempsy.com type = 'SignaturePathPrefetcher' 21113553Sjavier.bueno@metempsy.com cxx_class = 'SignaturePathPrefetcher' 21213553Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/signature_path.hh" 21313553Sjavier.bueno@metempsy.com 21413553Sjavier.bueno@metempsy.com signature_shift = Param.UInt8(3, 21513553Sjavier.bueno@metempsy.com "Number of bits to shift when calculating a new signature"); 21613553Sjavier.bueno@metempsy.com signature_bits = Param.UInt16(12, 21713553Sjavier.bueno@metempsy.com "Size of the signature, in bits"); 21813553Sjavier.bueno@metempsy.com signature_table_entries = Param.MemorySize("1024", 21913553Sjavier.bueno@metempsy.com "Number of entries of the signature table") 22013553Sjavier.bueno@metempsy.com signature_table_assoc = Param.Unsigned(2, 22113553Sjavier.bueno@metempsy.com "Associativity of the signature table") 22213553Sjavier.bueno@metempsy.com signature_table_indexing_policy = Param.BaseIndexingPolicy( 22313553Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.signature_table_assoc, 22413553Sjavier.bueno@metempsy.com size = Parent.signature_table_entries), 22513553Sjavier.bueno@metempsy.com "Indexing policy of the signature table") 22613553Sjavier.bueno@metempsy.com signature_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 22713553Sjavier.bueno@metempsy.com "Replacement policy of the signature table") 22813553Sjavier.bueno@metempsy.com 22913963Sodanrc@yahoo.com.br num_counter_bits = Param.UInt8(3, 23013963Sodanrc@yahoo.com.br "Number of bits of the saturating counters") 23113553Sjavier.bueno@metempsy.com pattern_table_entries = Param.MemorySize("4096", 23213553Sjavier.bueno@metempsy.com "Number of entries of the pattern table") 23313553Sjavier.bueno@metempsy.com pattern_table_assoc = Param.Unsigned(1, 23413553Sjavier.bueno@metempsy.com "Associativity of the pattern table") 23513553Sjavier.bueno@metempsy.com strides_per_pattern_entry = Param.Unsigned(4, 23613553Sjavier.bueno@metempsy.com "Number of strides stored in each pattern entry") 23713553Sjavier.bueno@metempsy.com pattern_table_indexing_policy = Param.BaseIndexingPolicy( 23813553Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.pattern_table_assoc, 23913553Sjavier.bueno@metempsy.com size = Parent.pattern_table_entries), 24013553Sjavier.bueno@metempsy.com "Indexing policy of the pattern table") 24113553Sjavier.bueno@metempsy.com pattern_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 24213553Sjavier.bueno@metempsy.com "Replacement policy of the pattern table") 24313553Sjavier.bueno@metempsy.com 24413553Sjavier.bueno@metempsy.com prefetch_confidence_threshold = Param.Float(0.5, 24513553Sjavier.bueno@metempsy.com "Minimum confidence to issue prefetches") 24613553Sjavier.bueno@metempsy.com lookahead_confidence_threshold = Param.Float(0.75, 24713553Sjavier.bueno@metempsy.com "Minimum confidence to continue exploring lookahead entries") 24813554Sjavier.bueno@metempsy.com 24913624Sjavier.bueno@metempsy.comclass SignaturePathPrefetcherV2(SignaturePathPrefetcher): 25013624Sjavier.bueno@metempsy.com type = 'SignaturePathPrefetcherV2' 25113624Sjavier.bueno@metempsy.com cxx_class = 'SignaturePathPrefetcherV2' 25213624Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/signature_path_v2.hh" 25313624Sjavier.bueno@metempsy.com 25413624Sjavier.bueno@metempsy.com signature_table_entries = "256" 25513624Sjavier.bueno@metempsy.com signature_table_assoc = 1 25613624Sjavier.bueno@metempsy.com pattern_table_entries = "512" 25713624Sjavier.bueno@metempsy.com pattern_table_assoc = 1 25813963Sodanrc@yahoo.com.br num_counter_bits = 4 25913624Sjavier.bueno@metempsy.com prefetch_confidence_threshold = 0.25 26013624Sjavier.bueno@metempsy.com lookahead_confidence_threshold = 0.25 26113624Sjavier.bueno@metempsy.com 26213624Sjavier.bueno@metempsy.com global_history_register_entries = Param.MemorySize("8", 26313624Sjavier.bueno@metempsy.com "Number of entries of global history register") 26413624Sjavier.bueno@metempsy.com global_history_register_indexing_policy = Param.BaseIndexingPolicy( 26513624Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, 26613624Sjavier.bueno@metempsy.com assoc = Parent.global_history_register_entries, 26713624Sjavier.bueno@metempsy.com size = Parent.global_history_register_entries), 26813624Sjavier.bueno@metempsy.com "Indexing policy of the global history register") 26913624Sjavier.bueno@metempsy.com global_history_register_replacement_policy = Param.BaseReplacementPolicy( 27013624Sjavier.bueno@metempsy.com LRURP(), "Replacement policy of the global history register") 27113624Sjavier.bueno@metempsy.com 27213700Sjavier.bueno@metempsy.comclass AccessMapPatternMatching(ClockedObject): 27313700Sjavier.bueno@metempsy.com type = 'AccessMapPatternMatching' 27413700Sjavier.bueno@metempsy.com cxx_class = 'AccessMapPatternMatching' 27513554Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 27613554Sjavier.bueno@metempsy.com 27713700Sjavier.bueno@metempsy.com block_size = Param.Unsigned(Parent.block_size, 27813700Sjavier.bueno@metempsy.com "Cacheline size used by the prefetcher using this object") 27913700Sjavier.bueno@metempsy.com 28013700Sjavier.bueno@metempsy.com limit_stride = Param.Unsigned(0, 28113700Sjavier.bueno@metempsy.com "Limit the strides checked up to -X/X, if 0, disable the limit") 28213554Sjavier.bueno@metempsy.com start_degree = Param.Unsigned(4, 28313554Sjavier.bueno@metempsy.com "Initial degree (Maximum number of prefetches generated") 28413554Sjavier.bueno@metempsy.com hot_zone_size = Param.MemorySize("2kB", "Memory covered by a hot zone") 28513554Sjavier.bueno@metempsy.com access_map_table_entries = Param.MemorySize("256", 28613554Sjavier.bueno@metempsy.com "Number of entries in the access map table") 28713554Sjavier.bueno@metempsy.com access_map_table_assoc = Param.Unsigned(8, 28813554Sjavier.bueno@metempsy.com "Associativity of the access map table") 28913554Sjavier.bueno@metempsy.com access_map_table_indexing_policy = Param.BaseIndexingPolicy( 29013554Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.access_map_table_assoc, 29113554Sjavier.bueno@metempsy.com size = Parent.access_map_table_entries), 29213554Sjavier.bueno@metempsy.com "Indexing policy of the access map table") 29313554Sjavier.bueno@metempsy.com access_map_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 29413554Sjavier.bueno@metempsy.com "Replacement policy of the access map table") 29513554Sjavier.bueno@metempsy.com high_coverage_threshold = Param.Float(0.25, 29613554Sjavier.bueno@metempsy.com "A prefetch coverage factor bigger than this is considered high") 29713554Sjavier.bueno@metempsy.com low_coverage_threshold = Param.Float(0.125, 29813554Sjavier.bueno@metempsy.com "A prefetch coverage factor smaller than this is considered low") 29913554Sjavier.bueno@metempsy.com high_accuracy_threshold = Param.Float(0.5, 30013554Sjavier.bueno@metempsy.com "A prefetch accuracy factor bigger than this is considered high") 30113554Sjavier.bueno@metempsy.com low_accuracy_threshold = Param.Float(0.25, 30213554Sjavier.bueno@metempsy.com "A prefetch accuracy factor smaller than this is considered low") 30313554Sjavier.bueno@metempsy.com high_cache_hit_threshold = Param.Float(0.875, 30413554Sjavier.bueno@metempsy.com "A cache hit ratio bigger than this is considered high") 30513554Sjavier.bueno@metempsy.com low_cache_hit_threshold = Param.Float(0.75, 30613554Sjavier.bueno@metempsy.com "A cache hit ratio smaller than this is considered low") 30713554Sjavier.bueno@metempsy.com epoch_cycles = Param.Cycles(256000, "Cycles in an epoch period") 30813554Sjavier.bueno@metempsy.com offchip_memory_latency = Param.Latency("30ns", 30913554Sjavier.bueno@metempsy.com "Memory latency used to compute the required memory bandwidth") 31013667Sjavier.bueno@metempsy.com 31113700Sjavier.bueno@metempsy.comclass AMPMPrefetcher(QueuedPrefetcher): 31213700Sjavier.bueno@metempsy.com type = 'AMPMPrefetcher' 31313700Sjavier.bueno@metempsy.com cxx_class = 'AMPMPrefetcher' 31413700Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh" 31513700Sjavier.bueno@metempsy.com ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(), 31613700Sjavier.bueno@metempsy.com "Access Map Pattern Matching object") 31713700Sjavier.bueno@metempsy.com 31813667Sjavier.bueno@metempsy.comclass DeltaCorrelatingPredictionTables(SimObject): 31913667Sjavier.bueno@metempsy.com type = 'DeltaCorrelatingPredictionTables' 32013667Sjavier.bueno@metempsy.com cxx_class = 'DeltaCorrelatingPredictionTables' 32113667Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 32213667Sjavier.bueno@metempsy.com deltas_per_entry = Param.Unsigned(20, 32313667Sjavier.bueno@metempsy.com "Number of deltas stored in each table entry") 32413667Sjavier.bueno@metempsy.com delta_bits = Param.Unsigned(12, "Bits per delta") 32513667Sjavier.bueno@metempsy.com delta_mask_bits = Param.Unsigned(8, 32613667Sjavier.bueno@metempsy.com "Lower bits to mask when comparing deltas") 32713667Sjavier.bueno@metempsy.com table_entries = Param.MemorySize("128", 32813667Sjavier.bueno@metempsy.com "Number of entries in the table") 32913667Sjavier.bueno@metempsy.com table_assoc = Param.Unsigned(128, 33013667Sjavier.bueno@metempsy.com "Associativity of the table") 33113667Sjavier.bueno@metempsy.com table_indexing_policy = Param.BaseIndexingPolicy( 33213667Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.table_assoc, 33313667Sjavier.bueno@metempsy.com size = Parent.table_entries), 33413667Sjavier.bueno@metempsy.com "Indexing policy of the table") 33513667Sjavier.bueno@metempsy.com table_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 33613667Sjavier.bueno@metempsy.com "Replacement policy of the table") 33713667Sjavier.bueno@metempsy.com 33813667Sjavier.bueno@metempsy.comclass DCPTPrefetcher(QueuedPrefetcher): 33913667Sjavier.bueno@metempsy.com type = 'DCPTPrefetcher' 34013667Sjavier.bueno@metempsy.com cxx_class = 'DCPTPrefetcher' 34113667Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh" 34213667Sjavier.bueno@metempsy.com dcpt = Param.DeltaCorrelatingPredictionTables( 34313667Sjavier.bueno@metempsy.com DeltaCorrelatingPredictionTables(), 34413667Sjavier.bueno@metempsy.com "Delta Correlating Prediction Tables object") 34513667Sjavier.bueno@metempsy.com 34613669Sjavier.bueno@metempsy.comclass IrregularStreamBufferPrefetcher(QueuedPrefetcher): 34713669Sjavier.bueno@metempsy.com type = "IrregularStreamBufferPrefetcher" 34813669Sjavier.bueno@metempsy.com cxx_class = "IrregularStreamBufferPrefetcher" 34913669Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/irregular_stream_buffer.hh" 35013669Sjavier.bueno@metempsy.com 35113963Sodanrc@yahoo.com.br num_counter_bits = Param.Unsigned(2, 35213963Sodanrc@yahoo.com.br "Number of bits of the confidence counter") 35313669Sjavier.bueno@metempsy.com chunk_size = Param.Unsigned(256, 35413669Sjavier.bueno@metempsy.com "Maximum number of addresses in a temporal stream") 35513669Sjavier.bueno@metempsy.com degree = Param.Unsigned(4, "Number of prefetches to generate") 35613669Sjavier.bueno@metempsy.com training_unit_assoc = Param.Unsigned(128, 35713669Sjavier.bueno@metempsy.com "Associativity of the training unit") 35813669Sjavier.bueno@metempsy.com training_unit_entries = Param.MemorySize("128", 35913669Sjavier.bueno@metempsy.com "Number of entries of the training unit") 36013669Sjavier.bueno@metempsy.com training_unit_indexing_policy = Param.BaseIndexingPolicy( 36113669Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.training_unit_assoc, 36213669Sjavier.bueno@metempsy.com size = Parent.training_unit_entries), 36313669Sjavier.bueno@metempsy.com "Indexing policy of the training unit") 36413669Sjavier.bueno@metempsy.com training_unit_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 36513669Sjavier.bueno@metempsy.com "Replacement policy of the training unit") 36613669Sjavier.bueno@metempsy.com 36713669Sjavier.bueno@metempsy.com prefetch_candidates_per_entry = Param.Unsigned(16, 36813669Sjavier.bueno@metempsy.com "Number of prefetch candidates stored in a SP-AMC entry") 36913669Sjavier.bueno@metempsy.com address_map_cache_assoc = Param.Unsigned(128, 37013669Sjavier.bueno@metempsy.com "Associativity of the PS/SP AMCs") 37113669Sjavier.bueno@metempsy.com address_map_cache_entries = Param.MemorySize("128", 37213669Sjavier.bueno@metempsy.com "Number of entries of the PS/SP AMCs") 37313669Sjavier.bueno@metempsy.com ps_address_map_cache_indexing_policy = Param.BaseIndexingPolicy( 37413669Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, 37513669Sjavier.bueno@metempsy.com assoc = Parent.address_map_cache_assoc, 37613669Sjavier.bueno@metempsy.com size = Parent.address_map_cache_entries), 37713669Sjavier.bueno@metempsy.com "Indexing policy of the Physical-to-Structural Address Map Cache") 37813669Sjavier.bueno@metempsy.com ps_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 37913669Sjavier.bueno@metempsy.com LRURP(), 38013669Sjavier.bueno@metempsy.com "Replacement policy of the Physical-to-Structural Address Map Cache") 38113669Sjavier.bueno@metempsy.com sp_address_map_cache_indexing_policy = Param.BaseIndexingPolicy( 38213669Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, 38313669Sjavier.bueno@metempsy.com assoc = Parent.address_map_cache_assoc, 38413669Sjavier.bueno@metempsy.com size = Parent.address_map_cache_entries), 38513669Sjavier.bueno@metempsy.com "Indexing policy of the Structural-to-Physical Address Mao Cache") 38613669Sjavier.bueno@metempsy.com sp_address_map_cache_replacement_policy = Param.BaseReplacementPolicy( 38713669Sjavier.bueno@metempsy.com LRURP(), 38813669Sjavier.bueno@metempsy.com "Replacement policy of the Structural-to-Physical Address Map Cache") 38913700Sjavier.bueno@metempsy.com 39013700Sjavier.bueno@metempsy.comclass SlimAccessMapPatternMatching(AccessMapPatternMatching): 39113700Sjavier.bueno@metempsy.com start_degree = 2 39213700Sjavier.bueno@metempsy.com limit_stride = 4 39313700Sjavier.bueno@metempsy.com 39413700Sjavier.bueno@metempsy.comclass SlimDeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTables): 39513700Sjavier.bueno@metempsy.com table_entries = "256" 39613700Sjavier.bueno@metempsy.com table_assoc = 256 39713700Sjavier.bueno@metempsy.com deltas_per_entry = 9 39813700Sjavier.bueno@metempsy.com 39913700Sjavier.bueno@metempsy.comclass SlimAMPMPrefetcher(QueuedPrefetcher): 40013700Sjavier.bueno@metempsy.com type = 'SlimAMPMPrefetcher' 40113700Sjavier.bueno@metempsy.com cxx_class = 'SlimAMPMPrefetcher' 40213700Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/slim_ampm.hh" 40313700Sjavier.bueno@metempsy.com 40413700Sjavier.bueno@metempsy.com ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(), 40513700Sjavier.bueno@metempsy.com "Access Map Pattern Matching object") 40613700Sjavier.bueno@metempsy.com dcpt = Param.DeltaCorrelatingPredictionTables( 40713700Sjavier.bueno@metempsy.com SlimDeltaCorrelatingPredictionTables(), 40813700Sjavier.bueno@metempsy.com "Delta Correlating Prediction Tables object") 40913717Sivan.pizarro@metempsy.com 41013717Sivan.pizarro@metempsy.comclass BOPPrefetcher(QueuedPrefetcher): 41113717Sivan.pizarro@metempsy.com type = "BOPPrefetcher" 41213717Sivan.pizarro@metempsy.com cxx_class = "BOPPrefetcher" 41313717Sivan.pizarro@metempsy.com cxx_header = "mem/cache/prefetch/bop.hh" 41413717Sivan.pizarro@metempsy.com score_max = Param.Unsigned(31, "Max. score to update the best offset") 41513717Sivan.pizarro@metempsy.com round_max = Param.Unsigned(100, "Max. round to update the best offset") 41613717Sivan.pizarro@metempsy.com bad_score = Param.Unsigned(10, "Score at which the HWP is disabled") 41713717Sivan.pizarro@metempsy.com rr_size = Param.Unsigned(64, "Number of entries of each RR bank") 41813717Sivan.pizarro@metempsy.com tag_bits = Param.Unsigned(12, "Bits used to store the tag") 41913717Sivan.pizarro@metempsy.com offset_list_size = Param.Unsigned(46, 42013717Sivan.pizarro@metempsy.com "Number of entries in the offsets list") 42113717Sivan.pizarro@metempsy.com negative_offsets_enable = Param.Bool(True, 42213717Sivan.pizarro@metempsy.com "Initialize the offsets list also with negative values \ 42313717Sivan.pizarro@metempsy.com (i.e. the table will have half of the entries with positive \ 42413717Sivan.pizarro@metempsy.com offsets and the other half with negative ones)") 42513717Sivan.pizarro@metempsy.com delay_queue_enable = Param.Bool(True, "Enable the delay queue") 42613717Sivan.pizarro@metempsy.com delay_queue_size = Param.Unsigned(15, 42713717Sivan.pizarro@metempsy.com "Number of entries in the delay queue") 42813717Sivan.pizarro@metempsy.com delay_queue_cycles = Param.Cycles(60, 42913717Sivan.pizarro@metempsy.com "Cycles to delay a write in the left RR table from the delay \ 43013717Sivan.pizarro@metempsy.com queue") 43113735Sivan.pizarro@metempsy.com 43213735Sivan.pizarro@metempsy.comclass SBOOEPrefetcher(QueuedPrefetcher): 43313735Sivan.pizarro@metempsy.com type = 'SBOOEPrefetcher' 43413735Sivan.pizarro@metempsy.com cxx_class = 'SBOOEPrefetcher' 43513735Sivan.pizarro@metempsy.com cxx_header = "mem/cache/prefetch/sbooe.hh" 43613735Sivan.pizarro@metempsy.com latency_buffer_size = Param.Int(32, "Entries in the latency buffer") 43713735Sivan.pizarro@metempsy.com sequential_prefetchers = Param.Int(9, "Number of sequential prefetchers") 43813735Sivan.pizarro@metempsy.com sandbox_entries = Param.Int(1024, "Size of the address buffer") 43913735Sivan.pizarro@metempsy.com score_threshold_pct = Param.Percent(25, "Min. threshold to issue a \ 44013735Sivan.pizarro@metempsy.com prefetch. The value is the percentage of sandbox entries to use") 44113786Sjavier.bueno@metempsy.com 44213786Sjavier.bueno@metempsy.comclass STeMSPrefetcher(QueuedPrefetcher): 44313786Sjavier.bueno@metempsy.com type = "STeMSPrefetcher" 44413786Sjavier.bueno@metempsy.com cxx_class = "STeMSPrefetcher" 44513786Sjavier.bueno@metempsy.com cxx_header = "mem/cache/prefetch/spatio_temporal_memory_streaming.hh" 44613786Sjavier.bueno@metempsy.com 44713786Sjavier.bueno@metempsy.com spatial_region_size = Param.MemorySize("2kB", 44813786Sjavier.bueno@metempsy.com "Memory covered by a hot zone") 44913786Sjavier.bueno@metempsy.com active_generation_table_entries = Param.MemorySize("64", 45013786Sjavier.bueno@metempsy.com "Number of entries in the active generation table") 45113786Sjavier.bueno@metempsy.com active_generation_table_assoc = Param.Unsigned(64, 45213786Sjavier.bueno@metempsy.com "Associativity of the active generation table") 45313786Sjavier.bueno@metempsy.com active_generation_table_indexing_policy = Param.BaseIndexingPolicy( 45413786Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, 45513786Sjavier.bueno@metempsy.com assoc = Parent.active_generation_table_assoc, 45613786Sjavier.bueno@metempsy.com size = Parent.active_generation_table_entries), 45713786Sjavier.bueno@metempsy.com "Indexing policy of the active generation table") 45813786Sjavier.bueno@metempsy.com active_generation_table_replacement_policy = Param.BaseReplacementPolicy( 45913786Sjavier.bueno@metempsy.com LRURP(), "Replacement policy of the active generation table") 46013786Sjavier.bueno@metempsy.com 46113786Sjavier.bueno@metempsy.com pattern_sequence_table_entries = Param.MemorySize("16384", 46213786Sjavier.bueno@metempsy.com "Number of entries in the pattern sequence table") 46313786Sjavier.bueno@metempsy.com pattern_sequence_table_assoc = Param.Unsigned(16384, 46413786Sjavier.bueno@metempsy.com "Associativity of the pattern sequence table") 46513786Sjavier.bueno@metempsy.com pattern_sequence_table_indexing_policy = Param.BaseIndexingPolicy( 46613786Sjavier.bueno@metempsy.com SetAssociative(entry_size = 1, 46713786Sjavier.bueno@metempsy.com assoc = Parent.pattern_sequence_table_assoc, 46813786Sjavier.bueno@metempsy.com size = Parent.pattern_sequence_table_entries), 46913786Sjavier.bueno@metempsy.com "Indexing policy of the pattern sequence table") 47013786Sjavier.bueno@metempsy.com pattern_sequence_table_replacement_policy = Param.BaseReplacementPolicy( 47113786Sjavier.bueno@metempsy.com LRURP(), "Replacement policy of the pattern sequence table") 47213786Sjavier.bueno@metempsy.com 47313786Sjavier.bueno@metempsy.com region_miss_order_buffer_entries = Param.Unsigned(131072, 47413786Sjavier.bueno@metempsy.com "Number of entries of the Region Miss Order Buffer") 47513786Sjavier.bueno@metempsy.com reconstruction_entries = Param.Unsigned(256, 47613786Sjavier.bueno@metempsy.com "Number of reconstruction entries") 47713825Sivan.pizarro@metempsy.com 47813825Sivan.pizarro@metempsy.comclass HWPProbeEventRetiredInsts(HWPProbeEvent): 47913825Sivan.pizarro@metempsy.com def register(self): 48013825Sivan.pizarro@metempsy.com if self.obj: 48113825Sivan.pizarro@metempsy.com for name in self.names: 48213825Sivan.pizarro@metempsy.com self.prefetcher.getCCObject().addEventProbeRetiredInsts( 48313825Sivan.pizarro@metempsy.com self.obj.getCCObject(), name) 48413825Sivan.pizarro@metempsy.com 48513825Sivan.pizarro@metempsy.comclass PIFPrefetcher(QueuedPrefetcher): 48613825Sivan.pizarro@metempsy.com type = 'PIFPrefetcher' 48713825Sivan.pizarro@metempsy.com cxx_class = 'PIFPrefetcher' 48813825Sivan.pizarro@metempsy.com cxx_header = "mem/cache/prefetch/pif.hh" 48913825Sivan.pizarro@metempsy.com cxx_exports = [ 49013825Sivan.pizarro@metempsy.com PyBindMethod("addEventProbeRetiredInsts"), 49113825Sivan.pizarro@metempsy.com ] 49213825Sivan.pizarro@metempsy.com 49313825Sivan.pizarro@metempsy.com prec_spatial_region_bits = Param.Unsigned(2, 49413825Sivan.pizarro@metempsy.com "Number of preceding addresses in the spatial region") 49513825Sivan.pizarro@metempsy.com succ_spatial_region_bits = Param.Unsigned(8, 49613825Sivan.pizarro@metempsy.com "Number of subsequent addresses in the spatial region") 49713825Sivan.pizarro@metempsy.com compactor_entries = Param.Unsigned(2, "Entries in the temp. compactor") 49813825Sivan.pizarro@metempsy.com stream_address_buffer_entries = Param.Unsigned(7, "Entries in the SAB") 49913825Sivan.pizarro@metempsy.com history_buffer_size = Param.Unsigned(16, "Entries in the history buffer") 50013825Sivan.pizarro@metempsy.com 50113825Sivan.pizarro@metempsy.com index_entries = Param.MemorySize("64", 50213825Sivan.pizarro@metempsy.com "Number of entries in the index") 50313825Sivan.pizarro@metempsy.com index_assoc = Param.Unsigned(64, 50413825Sivan.pizarro@metempsy.com "Associativity of the index") 50513825Sivan.pizarro@metempsy.com index_indexing_policy = Param.BaseIndexingPolicy( 50613825Sivan.pizarro@metempsy.com SetAssociative(entry_size = 1, assoc = Parent.index_assoc, 50713825Sivan.pizarro@metempsy.com size = Parent.index_entries), 50813825Sivan.pizarro@metempsy.com "Indexing policy of the index") 50913825Sivan.pizarro@metempsy.com index_replacement_policy = Param.BaseReplacementPolicy(LRURP(), 51013825Sivan.pizarro@metempsy.com "Replacement policy of the index") 51113825Sivan.pizarro@metempsy.com 51213825Sivan.pizarro@metempsy.com def listenFromProbeRetiredInstructions(self, simObj): 51313829Sjavier.bueno@metempsy.com if not isinstance(simObj, SimObject): 51413829Sjavier.bueno@metempsy.com raise TypeError("argument must be of SimObject type") 51513825Sivan.pizarro@metempsy.com self.addEvent(HWPProbeEventRetiredInsts(self, simObj,"RetiredInstsPC")) 516