diff options
author | JingQuJQ <jqu32@wisc.edu> | 2019-06-13 21:29:56 -0500 |
---|---|---|
committer | Mingyuan Xiang <mxiang6@wisc.edu> | 2019-10-11 03:29:29 +0000 |
commit | 211869ea950f3cc3116655f06b1d46d3fa39fb3a (patch) | |
tree | 9a72e6d9797f0c98835514bdb2dbad44f96251ee /configs/ruby | |
parent | dd2b3bde4c3d067af68e1f2d10db81d9d0af9cb5 (diff) | |
download | gem5-211869ea950f3cc3116655f06b1d46d3fa39fb3a.tar.xz |
mem-ruby: Allow Ruby to use all replacement policies in Classic
Add support in Ruby to use all replacement policies in Classic.
Furthermore, if new replacement policies are added to the
Classic system, the Ruby system will recognize new policies
without any other changes in Ruby system. The following list
all the major changes:
* Make Ruby cache entries (AbstractCacheEntry) inherit from
Classic cache entries (ReplaceableEntry). By doing this,
replacement policies can use cache entries from Ruby caches.
AccessPermission and print function are moved from
AbstractEntry to AbstractCacheEntry, so AbstractEntry is no
longer needed.
* DirectoryMemory and all SLICC files are changed to use
AbstractCacheEntry as their cache entry interface. So do the
python files in mem/slicc/ast which check the entry
interface.
* "main='false'" argument is added to the protocol files where
the DirectoryEntry is defined. This change helps
differentiate DirectoryEntry from CacheEntry because they are
both the instances of AbstractCacheEntry now.
* Use BaseReplacementPolicy in Ruby caches instead of
AbstractReplacementPolicy so that Ruby caches will recognize
the replacement policies from Classic.
* Add getLastAccess() and useOccupancy() function to Classic
system so that Ruby caches can use them. Move lastTouchTick
to ReplacementData struct because it's needed by
getLastAccess() to return the correct value.
* Add a 2-dimensional array of ReplacementData in Ruby caches
to store information for different replacement policies. Note
that, unlike Classic caches, where policy information is
stored in cache entries, the policy information needs to be
stored in a new 2-dimensional array. This is due to Ruby
caches deleting the cache entry every time the corresponding
cache line get evicted.
Change-Id: Idff6fdd2102a552c103e9d5f31f779aae052943f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20879
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'configs/ruby')
-rw-r--r-- | configs/ruby/AMD_Base_Constructor.py | 4 | ||||
-rw-r--r-- | configs/ruby/GPU_RfO.py | 16 | ||||
-rw-r--r-- | configs/ruby/GPU_VIPER.py | 12 | ||||
-rw-r--r-- | configs/ruby/GPU_VIPER_Baseline.py | 14 | ||||
-rw-r--r-- | configs/ruby/GPU_VIPER_Region.py | 16 | ||||
-rw-r--r-- | configs/ruby/MESI_Three_Level.py | 4 | ||||
-rw-r--r-- | configs/ruby/MOESI_AMD_Base.py | 8 |
7 files changed, 37 insertions, 37 deletions
diff --git a/configs/ruby/AMD_Base_Constructor.py b/configs/ruby/AMD_Base_Constructor.py index a8a0e0dde..6ba5547f9 100644 --- a/configs/ruby/AMD_Base_Constructor.py +++ b/configs/ruby/AMD_Base_Constructor.py @@ -52,7 +52,7 @@ class L1Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() # # Note: the L2 Cache latency is not currently used @@ -63,7 +63,7 @@ class L2Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class CPCntrl(AMD_Base_Controller, CntrlBase): def create(self, options, ruby_system, system): diff --git a/configs/ruby/GPU_RfO.py b/configs/ruby/GPU_RfO.py index 1f4df38ea..3e0002f04 100644 --- a/configs/ruby/GPU_RfO.py +++ b/configs/ruby/GPU_RfO.py @@ -76,28 +76,28 @@ class TccDirCache(RubyCache): options.tcc_dir_factor) / long(options.num_tccs) self.start_index_bit = math.log(options.cacheline_size, 2) + \ math.log(options.num_tccs, 2) - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L1DCache(RubyCache): resourceStalls = False def create(self, options): self.size = MemorySize(options.l1d_size) self.assoc = options.l1d_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L1ICache(RubyCache): resourceStalls = False def create(self, options): self.size = MemorySize(options.l1i_size) self.assoc = options.l1i_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L2Cache(RubyCache): resourceStalls = False def create(self, options): self.size = MemorySize(options.l2_size) self.assoc = options.l2_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class CPCntrl(CorePair_Controller, CntrlBase): @@ -149,7 +149,7 @@ class TCPCache(RubyCache): tagAccessLatency = 1 def create(self, options): self.size = MemorySize(options.tcp_size) - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class TCPCntrl(TCP_Controller, CntrlBase): @@ -222,7 +222,7 @@ class SQCCache(RubyCache): dataAccessLatency = 4 tagAccessLatency = 1 def create(self, options): - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class SQCCntrl(SQC_Controller, CntrlBase): @@ -282,7 +282,7 @@ class TCC(RubyCache): self.size.value = long(128 * self.assoc) self.start_index_bit = math.log(options.cacheline_size, 2) + \ math.log(options.num_tccs, 2) - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class TCCCntrl(TCC_Controller, CntrlBase): def create(self, options, ruby_system, system): @@ -347,7 +347,7 @@ class L3Cache(RubyCache): self.dataAccessLatency = options.l3_data_latency self.tagAccessLatency = options.l3_tag_latency self.resourceStalls = options.no_resource_stalls - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L3Cntrl(L3Cache_Controller, CntrlBase): def create(self, options, ruby_system, system): diff --git a/configs/ruby/GPU_VIPER.py b/configs/ruby/GPU_VIPER.py index 52b6c28ab..535c7f921 100644 --- a/configs/ruby/GPU_VIPER.py +++ b/configs/ruby/GPU_VIPER.py @@ -74,7 +74,7 @@ class L1Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L2Cache(RubyCache): resourceStalls = False @@ -84,7 +84,7 @@ class L2Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class CPCntrl(CorePair_Controller, CntrlBase): @@ -135,7 +135,7 @@ class TCPCache(RubyCache): self.size = MemorySize(options.tcp_size) self.assoc = options.tcp_assoc self.resourceStalls = options.no_tcc_resource_stalls - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class TCPCntrl(TCP_Controller, CntrlBase): @@ -210,7 +210,7 @@ class SQCCache(RubyCache): def create(self, options): self.size = MemorySize(options.sqc_size) self.assoc = options.sqc_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class SQCCntrl(SQC_Controller, CntrlBase): @@ -259,7 +259,7 @@ class TCC(RubyCache): self.size.value = long(128 * self.assoc) self.start_index_bit = math.log(options.cacheline_size, 2) + \ math.log(options.num_tccs, 2) - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class TCCCntrl(TCC_Controller, CntrlBase): @@ -289,7 +289,7 @@ class L3Cache(RubyCache): self.dataAccessLatency = options.l3_data_latency self.tagAccessLatency = options.l3_tag_latency self.resourceStalls = False - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L3Cntrl(L3Cache_Controller, CntrlBase): def create(self, options, ruby_system, system): diff --git a/configs/ruby/GPU_VIPER_Baseline.py b/configs/ruby/GPU_VIPER_Baseline.py index 5c713ce2d..a33a99a2e 100644 --- a/configs/ruby/GPU_VIPER_Baseline.py +++ b/configs/ruby/GPU_VIPER_Baseline.py @@ -74,7 +74,7 @@ class L1Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L2Cache(RubyCache): resourceStalls = False @@ -84,7 +84,7 @@ class L2Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class CPCntrl(CorePair_Controller, CntrlBase): @@ -138,7 +138,7 @@ class TCPCache(RubyCache): self.dataAccessLatency = 4 self.tagAccessLatency = 1 self.resourceStalls = options.no_tcc_resource_stalls - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class TCPCntrl(TCP_Controller, CntrlBase): @@ -178,7 +178,7 @@ class SQCCache(RubyCache): def create(self, options): self.size = MemorySize(options.sqc_size) self.assoc = options.sqc_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class SQCCntrl(SQC_Controller, CntrlBase): @@ -222,7 +222,7 @@ class TCC(RubyCache): self.size.value = long(128 * self.assoc) self.start_index_bit = math.log(options.cacheline_size, 2) + \ math.log(options.num_tccs, 2) - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class TCCCntrl(TCC_Controller, CntrlBase): def create(self, options, ruby_system, system): @@ -250,7 +250,7 @@ class L3Cache(RubyCache): self.dataAccessLatency = options.l3_data_latency self.tagAccessLatency = options.l3_tag_latency self.resourceStalls = False - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class ProbeFilter(RubyCache): size = "4MB" @@ -268,7 +268,7 @@ class ProbeFilter(RubyCache): self.dataAccessLatency = 1 self.resourceStalls = options.no_resource_stalls self.start_index_bit = 6 + int(math.log(options.blocks_per_region, 2)) - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L3Cntrl(L3Cache_Controller, CntrlBase): def create(self, options, ruby_system, system): diff --git a/configs/ruby/GPU_VIPER_Region.py b/configs/ruby/GPU_VIPER_Region.py index 8b317fbaf..e3f717634 100644 --- a/configs/ruby/GPU_VIPER_Region.py +++ b/configs/ruby/GPU_VIPER_Region.py @@ -75,7 +75,7 @@ class L1Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L2Cache(RubyCache): resourceStalls = False @@ -85,7 +85,7 @@ class L2Cache(RubyCache): def create(self, size, assoc, options): self.size = MemorySize(size) self.assoc = assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class CPCntrl(CorePair_Controller, CntrlBase): @@ -139,7 +139,7 @@ class TCPCache(RubyCache): self.dataAccessLatency = 4 self.tagAccessLatency = 1 self.resourceStalls = options.no_tcc_resource_stalls - self.replacement_policy = PseudoLRUReplacementPolicy(assoc = self.assoc) + self.replacement_policy = TreePLRURP(num_leaves = self.assoc) class TCPCntrl(TCP_Controller, CntrlBase): @@ -179,7 +179,7 @@ class SQCCache(RubyCache): def create(self, options): self.size = MemorySize(options.sqc_size) self.assoc = options.sqc_assoc - self.replacement_policy = PseudoLRUReplacementPolicy(assoc = self.assoc) + self.replacement_policy = TreePLRURP(num_leaves = self.assoc) class SQCCntrl(SQC_Controller, CntrlBase): @@ -223,7 +223,7 @@ class TCC(RubyCache): self.size.value = long(128 * self.assoc) self.start_index_bit = math.log(options.cacheline_size, 2) + \ math.log(options.num_tccs, 2) - self.replacement_policy = PseudoLRUReplacementPolicy(assoc = self.assoc) + self.replacement_policy = TreePLRURP(num_leaves = self.assoc) class TCCCntrl(TCC_Controller, CntrlBase): def create(self, options, ruby_system, system): @@ -249,7 +249,7 @@ class L3Cache(RubyCache): self.dataAccessLatency = options.l3_data_latency self.tagAccessLatency = options.l3_tag_latency self.resourceStalls = False - self.replacement_policy = PseudoLRUReplacementPolicy(assoc = self.assoc) + self.replacement_policy = TreePLRURP(num_leaves = self.assoc) class L3Cntrl(L3Cache_Controller, CntrlBase): def create(self, options, ruby_system, system): @@ -328,7 +328,7 @@ class RegionDir(RubyCache): self.dataAccessLatency = 1 self.resourceStalls = options.no_resource_stalls self.start_index_bit = 6 + int(math.log(options.blocks_per_region, 2)) - self.replacement_policy = PseudoLRUReplacementPolicy(assoc = self.assoc) + self.replacement_policy = TreePLRURP(num_leaves = self.assoc) # Region directory controller : Contains region directory and associated state # machine for dealing with region coherence requests. class RegionCntrl(RegionDir_Controller, CntrlBase): @@ -386,7 +386,7 @@ class RBCntrl(RegionBuffer_Controller, CntrlBase): if options.recycle_latency: self.recycle_latency = options.recycle_latency self.cacheMemory.replacement_policy = \ - PseudoLRUReplacementPolicy(assoc = self.cacheMemory.assoc) + TreePLRURP(num_leaves = self.cacheMemory.assoc) def define_options(parser): parser.add_option("--num-subcaches", type="int", default=4) diff --git a/configs/ruby/MESI_Three_Level.py b/configs/ruby/MESI_Three_Level.py index 20f48db32..22b02fa35 100644 --- a/configs/ruby/MESI_Three_Level.py +++ b/configs/ruby/MESI_Three_Level.py @@ -91,11 +91,11 @@ def create_system(options, full_system, system, dma_ports, bootmem, # l0i_cache = L0Cache(size = '4096B', assoc = 1, is_icache = True, start_index_bit = block_size_bits, - replacement_policy = LRUReplacementPolicy()) + replacement_policy = LRURP()) l0d_cache = L0Cache(size = '4096B', assoc = 1, is_icache = False, start_index_bit = block_size_bits, - replacement_policy = LRUReplacementPolicy()) + replacement_policy = LRURP()) # the ruby random tester reuses num_cpus to specify the # number of cpu ports connected to the tester object, which diff --git a/configs/ruby/MOESI_AMD_Base.py b/configs/ruby/MOESI_AMD_Base.py index 0475dcb0c..2757f3d60 100644 --- a/configs/ruby/MOESI_AMD_Base.py +++ b/configs/ruby/MOESI_AMD_Base.py @@ -71,21 +71,21 @@ class L1DCache(RubyCache): def create(self, options): self.size = MemorySize(options.l1d_size) self.assoc = options.l1d_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L1ICache(RubyCache): resourceStalls = False def create(self, options): self.size = MemorySize(options.l1i_size) self.assoc = options.l1i_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L2Cache(RubyCache): resourceStalls = False def create(self, options): self.size = MemorySize(options.l2_size) self.assoc = options.l2_assoc - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class CPCntrl(CorePair_Controller, CntrlBase): @@ -143,7 +143,7 @@ class L3Cache(RubyCache): self.dataAccessLatency = options.l3_data_latency self.tagAccessLatency = options.l3_tag_latency self.resourceStalls = options.no_resource_stalls - self.replacement_policy = PseudoLRUReplacementPolicy() + self.replacement_policy = TreePLRURP() class L3Cntrl(L3Cache_Controller, CntrlBase): def create(self, options, ruby_system, system): |