From 59c4fd07cbc96fa22e4a32ef8c93bd958340ce65 Mon Sep 17 00:00:00 2001 From: CHEN Meng Date: Mon, 20 Sep 2021 04:31:52 +0800 Subject: [PATCH 1/3] base-stats: fix storage initializing Commit (70194795c3f41cc3f1e361b3cac24f839d86dd67) introduced std::vector with resize() to initializing all storages. This method caused data duplication in statistics. Storage is now initialized using loops. Change-Id: I4350863a83671fc10cc02b5cb7d3b38e6cf4f565 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50747 Reviewed-by: Bobby R. Bruce Reviewed-by: Hoa Nguyen Maintainer: Bobby R. Bruce Tested-by: kokoro --- src/base/statistics.hh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/base/statistics.hh b/src/base/statistics.hh index 18f52cb580..8fc71eb52d 100644 --- a/src/base/statistics.hh +++ b/src/base/statistics.hh @@ -952,7 +952,10 @@ class VectorBase : public DataWrapVec fatal_if(s <= 0, "Storage size must be positive"); fatal_if(check(), "Stat has already been initialized"); - storage.resize(s, new Storage(this->info()->getStorageParams())); + storage.reserve(s); + for (size_type i = 0; i < s; ++i) + storage.push_back(new Storage(this->info()->getStorageParams())); + this->setInit(); } @@ -1178,7 +1181,10 @@ class Vector2dBase : public DataWrapVec2d info->x = _x; info->y = _y; - storage.resize(x * y, new Storage(info->getStorageParams())); + storage.reserve(x * y); + for (size_type i = 0; i < x * y; ++i) + storage.push_back(new Storage(this->info()->getStorageParams())); + this->setInit(); return self; @@ -1387,7 +1393,10 @@ class VectorDistBase : public DataWrapVec fatal_if(s <= 0, "Storage size must be positive"); fatal_if(check(), "Stat has already been initialized"); - storage.resize(s, new Storage(this->info()->getStorageParams())); + storage.reserve(s); + for (size_type i = 0; i < s; ++i) + storage.push_back(new Storage(this->info()->getStorageParams())); + this->setInit(); } From ca921387ae27d8595208657872461631f5cf8305 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 21 Sep 2021 12:00:03 -0700 Subject: [PATCH 2/3] misc: Update the version to v21.1.0.2 Change-Id: I4013ed678b367f95bb0f69e4a827ad04995cc3c0 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50750 Maintainer: Bobby R. Bruce Reviewed-by: Matt Sinclair Reviewed-by: Hoa Nguyen Tested-by: kokoro --- src/Doxyfile | 2 +- src/base/version.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Doxyfile b/src/Doxyfile index cee1d0a3c7..4c9f95826b 100644 --- a/src/Doxyfile +++ b/src/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = gem5 # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = v21.1.0.1 +PROJECT_NUMBER = v21.1.0.2 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/src/base/version.cc b/src/base/version.cc index 91048849aa..3a01cb6cf8 100644 --- a/src/base/version.cc +++ b/src/base/version.cc @@ -32,6 +32,6 @@ namespace gem5 /** * @ingroup api_base_utils */ -const char *gem5Version = "21.1.0.1"; +const char *gem5Version = "21.1.0.2"; } // namespace gem5 From 4666a4f9e31eae791ddabc619486c39bdecfabd3 Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Tue, 21 Sep 2021 12:00:43 -0700 Subject: [PATCH 3/3] misc: Update RELEASE-NOTES.md for v21.1.0.2 Change-Id: Ib573775b9ef7de7663893f18980bb34b3d412210 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50751 Maintainer: Bobby R. Bruce Reviewed-by: Matt Sinclair Reviewed-by: Hoa Nguyen Tested-by: kokoro --- RELEASE-NOTES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index a3517c10f8..6f672a88e5 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,9 @@ +# Version 21.1.0.2 + +**[HOTFIX]** [A commit introduced `std::vector` with `resize()` to initialize all storages](https://gem5-review.googlesource.com/c/public/gem5/+/27085). +This caused data duplication in statistics and broke the Vector statistics. +This hotfix initializes using loops which fixes the broken statistics. + # Version 21.1.0.1 **[HOTFIX]** [A "'deprecated' attribute directive ignored" warning was being thrown frequently when trying to build v21.1.0.0](https://gem5.atlassian.net/browse/GEM5-1063). While this issue did not break the build, it made reading the build output difficult and caused confused. As such a patch has been applied to fix this issue.