mem-ruby: Allow Ruby to use all replacement policies in Classic
authorJingQuJQ <jqu32@wisc.edu>
Fri, 14 Jun 2019 02:29:56 +0000 (21:29 -0500)
committerMingyuan Xiang <mxiang6@wisc.edu>
Fri, 11 Oct 2019 03:29:29 +0000 (03:29 +0000)
commit211869ea950f3cc3116655f06b1d46d3fa39fb3a
tree9a72e6d9797f0c98835514bdb2dbad44f96251ee
parentdd2b3bde4c3d067af68e1f2d10db81d9d0af9cb5
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>
49 files changed:
configs/ruby/AMD_Base_Constructor.py
configs/ruby/GPU_RfO.py
configs/ruby/GPU_VIPER.py
configs/ruby/GPU_VIPER_Baseline.py
configs/ruby/GPU_VIPER_Region.py
configs/ruby/MESI_Three_Level.py
configs/ruby/MOESI_AMD_Base.py
src/learning_gem5/part3/MSI-dir.sm
src/mem/cache/replacement_policies/replaceable_entry.hh
src/mem/ruby/SConscript
src/mem/ruby/protocol/Garnet_standalone-dir.sm
src/mem/ruby/protocol/MESI_Two_Level-dir.sm
src/mem/ruby/protocol/MI_example-dir.sm
src/mem/ruby/protocol/MOESI_AMD_Base-Region-dir.sm
src/mem/ruby/protocol/MOESI_AMD_Base-dir.sm
src/mem/ruby/protocol/MOESI_AMD_Base-probeFilter.sm
src/mem/ruby/protocol/MOESI_CMP_directory-L2cache.sm
src/mem/ruby/protocol/MOESI_CMP_directory-dir.sm
src/mem/ruby/protocol/MOESI_CMP_token-L2cache.sm
src/mem/ruby/protocol/MOESI_CMP_token-dir.sm
src/mem/ruby/protocol/MOESI_hammer-dir.sm
src/mem/ruby/protocol/RubySlicc_Types.sm
src/mem/ruby/slicc_interface/AbstractCacheEntry.cc
src/mem/ruby/slicc_interface/AbstractCacheEntry.hh
src/mem/ruby/slicc_interface/AbstractEntry.cc [deleted file]
src/mem/ruby/slicc_interface/AbstractEntry.hh [deleted file]
src/mem/ruby/slicc_interface/SConscript
src/mem/ruby/structures/AbstractReplacementPolicy.cc [deleted file]
src/mem/ruby/structures/AbstractReplacementPolicy.hh [deleted file]
src/mem/ruby/structures/CacheMemory.cc
src/mem/ruby/structures/CacheMemory.hh
src/mem/ruby/structures/DirectoryMemory.cc
src/mem/ruby/structures/DirectoryMemory.hh
src/mem/ruby/structures/LRUPolicy.cc [deleted file]
src/mem/ruby/structures/LRUPolicy.hh [deleted file]
src/mem/ruby/structures/LRUReplacementPolicy.py [deleted file]
src/mem/ruby/structures/PseudoLRUPolicy.cc [deleted file]
src/mem/ruby/structures/PseudoLRUPolicy.hh [deleted file]
src/mem/ruby/structures/PseudoLRUReplacementPolicy.py [deleted file]
src/mem/ruby/structures/ReplacementPolicy.py [deleted file]
src/mem/ruby/structures/RubyCache.py
src/mem/ruby/structures/SConscript
src/mem/ruby/system/WeightedLRUPolicy.cc
src/mem/ruby/system/WeightedLRUPolicy.hh
src/mem/ruby/system/WeightedLRUReplacementPolicy.py
src/mem/slicc/ast/FormalParamAST.py
src/mem/slicc/ast/LocalVariableAST.py
src/mem/slicc/ast/MemberExprAST.py
src/mem/slicc/ast/MethodCallExprAST.py