Davide Basilio Bartolini has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/36776 )

Change subject: misc: Do not ignore options set to None
......................................................................

misc: Do not ignore options set to None

Otherwise, it's not possible to disable hardware prefetchers in case one is
set in the default core configuration.
Also correctly handle disabling the default hwp in case the corresponding
option is set to None.

Change-Id: Id0e807c3fa224180d682f366c7307941bab8ce59
---
M configs/common/CacheConfig.py
1 file changed, 11 insertions(+), 19 deletions(-)



diff --git a/configs/common/CacheConfig.py b/configs/common/CacheConfig.py
index 4117261..d0cb077 100644
--- a/configs/common/CacheConfig.py
+++ b/configs/common/CacheConfig.py
@@ -48,12 +48,6 @@
 from common.Caches import *
 from common import ObjectList

-def _print_hwp_warning(cacheString, hwpClass, prefetcher):
- print("Warning:", cacheString, "-hwp-type is set (", hwpClass, "), but",
-          "the current", cacheString, " has a default Hardware Prefetcher",
- "of type", type(prefetcher), ", using the prefetcher type specified",
-          "by the flag option.")
-
 def _get_cache_opts(level, options):
         opts = {}

@@ -67,7 +61,14 @@
         return opts

 def _is_opt_defined(opt, options):
-  return hasattr(options, opt) and getattr(options, opt) is not None
+  return hasattr(options, opt)
+
+def _get_hwp(hwp_option):
+  if hwp_option == None:
+    return NULL
+
+  hwpClass = ObjectList.hwp_list.get(hwp_option)
+  return hwpClass()

 def config_cache(options, system):
if options.external_memory_system and (options.caches or options.l2cache):
@@ -125,10 +126,7 @@
         system.l2.cpu_side = system.tol2bus.master
         system.l2.mem_side = system.membus.slave
         if _is_opt_defined('l2_hwp_type', options):
-            hwpClass = ObjectList.hwp_list.get(options.l2_hwp_type)
-            if system.l2.prefetcher != "Null":
-                _print_hwp_warning("l2", hwpClass, system.l2.prefetcher)
-            system.l2.prefetcher = hwpClass()
+            system.l2.prefetcher = _get_hwp(options.l2_hwp_type)

     if options.memchecker:
         system.memchecker = MemChecker()
@@ -163,16 +161,10 @@
                 dcache = dcache_mon

             if _is_opt_defined('l1d_hwp_type', options):
-                hwpClass = ObjectList.hwp_list.get(options.l1d_hwp_type)
-                if dcache.prefetcher != m5.params.NULL:
-                    _print_hwp_warning("l1d", hwpClass, dcache.prefetcher)
-                dcache.prefetcher = hwpClass()
+                dcache.prefetcher = _get_hwp(options.l1d_hwp_type)

             if _is_opt_defined('l1i_hwp_type', options):
-                hwpClass = ObjectList.hwp_list.get(options.l1i_hwp_type)
-                if icache.prefetcher != m5.params.NULL:
-                    _print_hwp_warning("l1d", hwpClass, dcache.prefetcher)
-                icache.prefetcher = hwpClass()
+                icache.prefetcher = _get_hwp(options.l1i_hwp_type)

             # When connecting the caches, the clock is also inherited
             # from the CPU in question

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/36776
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id0e807c3fa224180d682f366c7307941bab8ce59
Gerrit-Change-Number: 36776
Gerrit-PatchSet: 1
Gerrit-Owner: Davide Basilio Bartolini <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to