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

Change subject: misc: Fix hdf5 stats + test
......................................................................

misc: Fix hdf5 stats + test

HDF5 stats file creation was not completing correctly due to name
clashes.

Change-Id: Ifc2d52f4bbc62b0c6798ce92f4d027b0ec69a373
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51061
Reviewed-by: Bobby R. Bruce <bbr...@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
---
M tests/gem5/verifier.py
M tests/gem5/stats/test_hdf5.py
M src/mem/mem_interface.cc
M src/base/stats/hdf5.cc
M src/cpu/o3/iew.cc
5 files changed, 47 insertions(+), 12 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/base/stats/hdf5.cc b/src/base/stats/hdf5.cc
index 90bd8cd..d5b7f1e 100644
--- a/src/base/stats/hdf5.cc
+++ b/src/base/stats/hdf5.cc
@@ -39,6 +39,8 @@

 #include "base/logging.hh"
 #include "base/stats/info.hh"
+#include "base/trace.hh"
+#include "debug/Stats.hh"

 namespace gem5
 {
@@ -254,6 +256,8 @@

         fspace = H5::DataSpace(rank, dims, max_dims.data());
         try {
+            DPRINTF(Stats, "Creating dataset %s in group %s\n",
+                info.name, group.getObjName());
             data_set = group.createDataSet(info.name,
                 H5::PredType::NATIVE_DOUBLE, fspace, props);
         } catch (const H5::Exception &e) {
diff --git a/src/cpu/o3/iew.cc b/src/cpu/o3/iew.cc
index 7cdc8d8..d899e8b 100644
--- a/src/cpu/o3/iew.cc
+++ b/src/cpu/o3/iew.cc
@@ -143,7 +143,7 @@
 }

 IEW::IEWStats::IEWStats(CPU *cpu)
-    : statistics::Group(cpu),
+    : statistics::Group(cpu, "iew"),
     ADD_STAT(idleCycles, statistics::units::Cycle::get(),
              "Number of cycles IEW is idle"),
     ADD_STAT(squashCycles, statistics::units::Cycle::get(),
diff --git a/src/mem/mem_interface.cc b/src/mem/mem_interface.cc
index 8036aca..a3e5963 100644
--- a/src/mem/mem_interface.cc
+++ b/src/mem/mem_interface.cc
@@ -1893,10 +1893,6 @@

     ADD_STAT(bytesPerActivate, statistics::units::Byte::get(),
              "Bytes accessed per row activation"),
-    ADD_STAT(bytesRead, statistics::units::Byte::get(),
-             "Total number of bytes read from DRAM"),
-    ADD_STAT(bytesWritten, statistics::units::Byte::get(),
-            "Total number of bytes written to DRAM"),
     ADD_STAT(avgRdBW, statistics::units::Rate<
                 statistics::units::Byte, statistics::units::Second>::get(),
              "Average DRAM read bandwidth in MiBytes/s"),
@@ -2548,10 +2544,6 @@
                 statistics::units::Tick, statistics::units::Count>::get(),
              "Average memory access latency per NVM burst"),

-    ADD_STAT(bytesRead, statistics::units::Byte::get(),
-             "Total number of bytes read from NVM"),
-    ADD_STAT(bytesWritten, statistics::units::Byte::get(),
-             "Total number of bytes written to NVM"),
     ADD_STAT(avgRdBW, statistics::units::Rate<
                 statistics::units::Byte, statistics::units::Second>::get(),
              "Average DRAM read bandwidth in MiBytes/s"),
diff --git a/tests/gem5/stats/test_hdf5.py b/tests/gem5/stats/test_hdf5.py
index ad730f3..545ef58 100644
--- a/tests/gem5/stats/test_hdf5.py
+++ b/tests/gem5/stats/test_hdf5.py
@@ -44,7 +44,6 @@
 import os
 from testlib import *

-
 if config.bin_path:
     resource_path = config.bin_path
 else:
@@ -68,12 +67,20 @@
     ok_exit_regex = re.compile(
r"Exiting @ tick \d+ because exiting with last active thread context"
     )
+    ok_verifier = verifier.MatchRegex(ok_exit_regex)

-    stdout_verifier = verifier.MatchRegex(ok_exit_regex)
+    # FIXME: flaky, should check return code instead...
+    # See: https://gem5.atlassian.net/browse/GEM5-1099
+    err_regex = re.compile(
+        r'RuntimeError: Failed creating H5::DataSet \w+; .*'
+    )
+    err_verifier = verifier.NoMatchRegex(err_regex, True, False)
+
     h5_verifier = verifier.CheckH5StatsExist()
+
     gem5_verify_config(
         name="hdf5_test",
-        verifiers=[stdout_verifier, h5_verifier],
+        verifiers=[ok_verifier, err_verifier, h5_verifier],
         fixtures=(),
         config=joinpath(
             config.base_dir,
@@ -92,3 +99,4 @@
         gem5_args=["--stats-file=h5://stats.h5"],
         valid_isas=(constants.arm_tag,),
     )
+
diff --git a/tests/gem5/verifier.py b/tests/gem5/verifier.py
index f6687f5..c947a62 100644
--- a/tests/gem5/verifier.py
+++ b/tests/gem5/verifier.py
@@ -229,6 +229,21 @@
             filenames.append(constants.gem5_simulation_stderr)
         super(MatchRegex, self).__init__(regex, filenames)

+class NoMatchRegex(MatchRegex):
+    """
+    Checks that the given pattern does *not* match
+    """
+    def __init__(self, regex, match_stderr=True, match_stdout=True):
+ super(NoMatchRegex, self).__init__(regex, match_stderr, match_stdout)
+
+    def test(self, params):
+        fixtures = params.fixtures
+        tempdir = fixtures[constants.tempdir_fixture_name].path
+
+        for fname in self.filenames:
+            if self.parse_file(joinpath(tempdir, fname)):
+                test_util.fail('Could not match regex.')
+
 _re_type = type(re.compile(''))
 def _iterable_regex(regex):
     if isinstance(regex, _re_type) or isinstance(regex, str):

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51061
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: Ifc2d52f4bbc62b0c6798ce92f4d027b0ec69a373
Gerrit-Change-Number: 51061
Gerrit-PatchSet: 4
Gerrit-Owner: Davide Basilio Bartolini <davide.basilio.bartol...@huawei.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Davide Basilio Bartolini <davide.basilio.bartol...@huawei.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-CC: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
  • [gem5-dev] Change in gem5/g... Davide Basilio Bartolini (Gerrit) via gem5-dev
    • [gem5-dev] Change in g... Davide Basilio Bartolini (Gerrit) via gem5-dev

Reply via email to