configs: Added list types of replacement policy.
authorJiasen <jiasen.hjs@alibaba-inc.com>
Fri, 15 Jan 2021 03:57:17 +0000 (11:57 +0800)
committerJIASEN_HUANG <jiasen.hjs@alibaba-inc.com>
Tue, 26 Jan 2021 02:18:56 +0000 (02:18 +0000)
Replacement policy is one of the key points in CPU performance. For ease
of checking the avliable replacment types for any cpu architects,
"replacment policy list" is added in Options.py and ObjectList.py.
Just like Branch Prediction Policies, adding such list would make it efficient for compare cpu performance
regarding different replacment policies especially for Cache.

Jira Issue: https://gem5.atlassian.net/browse/GEM5-853

Change-Id: I97358617038fdcec79fa7e59baba8926284727b4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39195
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
configs/common/ObjectList.py
configs/common/Options.py

index c91ea0c6535d70a9f0a45cae1a6e42aaf568d19f..82e4df8fe19fcfdea91d82ed5a81446261dd3eb4 100644 (file)
@@ -162,7 +162,7 @@ class EnumList(ObjectList):
             if not key.startswith("Num_"):
                 self._sub_classes[key] = value
 
-
+rp_list = ObjectList(getattr(m5.objects, 'BaseReplacementPolicy', None))
 bp_list = ObjectList(getattr(m5.objects, 'BranchPredictor', None))
 cpu_list = CPUList(getattr(m5.objects, 'BaseCPU', None))
 hwp_list = ObjectList(getattr(m5.objects, 'BasePrefetcher', None))
index f37b1306acf17930e3388fd439b5c6fb82868c92..d02535f524e24f3667c23b37f9d9c73fc90d2725 100644 (file)
@@ -68,6 +68,10 @@ def _listHWPTypes(option, opt, value, parser):
     ObjectList.hwp_list.print()
     sys.exit(0)
 
+def _listRPTypes(option, opt, value, parser):
+    ObjectList.rp_list.print()
+    sys.exit(0)
+
 def _listIndirectBPTypes(option, opt, value, parser):
     ObjectList.indirect_bp_list.print()
     sys.exit(0)
@@ -186,6 +190,11 @@ def addCommonOptions(parser):
     parser.add_option("--indirect-bp-type", type="choice", default=None,
                       choices=ObjectList.indirect_bp_list.get_names(),
                       help = "type of indirect branch predictor to run with")
+
+    parser.add_option("--list-rp-types",
+                      action="callback", callback=_listRPTypes,
+                      help="List available replacement policy types")
+
     parser.add_option("--list-hwp-types",
                       action="callback", callback=_listHWPTypes,
                       help="List available hardware prefetcher types")