From dc448c953074a70cd04c4344c8b6ebc5a30f8c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Armejach?= <66964292+aarmejach@users.noreply.github.com> Date: Fri, 17 Jan 2025 23:45:43 +0100 Subject: [PATCH 1/3] mem-ruby: set RubySystem pointer during TBE alloc (#1930) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the RubySystem pointer is set when set_tbe is performed, which effectively clears the NetDest objects from the TBE (if any). This is fine if the TBE has been just allocated before set_tbe is called (no NetDest info in the TBE). However, the CHI protocol has an action (RestoreFromHazard) that performs a set_tbe over a TBE that had already been set, i.e., it already has valid NetDest data. This patch sets the RubySystem pointer when the TBE is allocated, which is more natural and follows the style already adopted in the PerfectCacheMemory class (#1864). Co-authored-by: AdriĆ  Armejach --- src/mem/ruby/structures/TBETable.hh | 19 +++++++++++++++++-- src/mem/slicc/symbols/StateMachine.py | 13 ++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/mem/ruby/structures/TBETable.hh b/src/mem/ruby/structures/TBETable.hh index 72770ce42f..8c93c7dc09 100644 --- a/src/mem/ruby/structures/TBETable.hh +++ b/src/mem/ruby/structures/TBETable.hh @@ -45,6 +45,7 @@ #include #include "mem/ruby/common/Address.hh" +#include "mem/ruby/system/RubySystem.hh" namespace gem5 { @@ -70,7 +71,7 @@ class TBETable return (m_number_of_TBEs - m_map.size()) >= n; } - void setBlockSize(const int block_size) { m_block_size = block_size; } + void setRubySystem(RubySystem* rs); ENTRY *getNullEntry(); ENTRY *lookup(Addr address); @@ -89,6 +90,10 @@ class TBETable private: int m_number_of_TBEs = 0; int m_block_size = 0; + RubySystem* m_ruby_system = nullptr; + + static constexpr bool entryRequiresRubySystem = + std::is_member_function_pointer_v; }; template @@ -100,6 +105,14 @@ operator<<(std::ostream& out, const TBETable& obj) return out; } +template +inline +void TBETable::setRubySystem(RubySystem* rs) +{ + m_ruby_system = rs; + m_block_size = rs->getBlockSizeBytes(); +} + template inline bool TBETable::isPresent(Addr address) const @@ -116,7 +129,9 @@ TBETable::allocate(Addr address) assert(!isPresent(address)); assert(m_map.size() < m_number_of_TBEs); assert(m_block_size > 0); - m_map.emplace(address, ENTRY(m_block_size)); + ENTRY new_entry = ENTRY(m_block_size); + new_entry.setRubySystem(m_ruby_system); + m_map.emplace(address, new_entry); } template diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py index c1052086bf..d7b94c24b1 100644 --- a/src/mem/slicc/symbols/StateMachine.py +++ b/src/mem/slicc/symbols/StateMachine.py @@ -831,13 +831,13 @@ $c_ident::init() comment = f"Type {vtype.ident} default" code('*$vid = ${{vtype["default"]}}; // $comment') - # For objects that require knowing the cache line size, + # For objects that require a pointer to RubySystem, # set the value here. - if vtype.c_ident in ("TBETable"): - block_size_func = "m_ruby_system->getBlockSizeBytes()" - code(f"(*{vid}).setBlockSize({block_size_func});") - - if vtype.c_ident in ("NetDest", "PerfectCacheMemory"): + if vtype.c_ident in ( + "NetDest", + "PerfectCacheMemory", + "TBETable", + ): code(f"(*{vid}).setRubySystem(m_ruby_system);") for param in self.config_parameters: @@ -1271,7 +1271,6 @@ void $c_ident::set_tbe(${{self.TBEType.c_ident}}*& m_tbe_ptr, ${{self.TBEType.c_ident}}* m_new_tbe) { m_tbe_ptr = m_new_tbe; - m_tbe_ptr->setRubySystem(m_ruby_system); } void From 8f2ccca3a3267069deda19288374a40bd550671f Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Sun, 2 Feb 2025 00:56:30 -0800 Subject: [PATCH 2/3] misc: Update version to v24.1.0.2 --- src/Doxyfile | 2 +- src/base/version.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Doxyfile b/src/Doxyfile index c5b219f37f..8fe7195933 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 = v24.1.0.1 +PROJECT_NUMBER = v24.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 d6fb326988..764399f517 100644 --- a/src/base/version.cc +++ b/src/base/version.cc @@ -32,6 +32,6 @@ namespace gem5 /** * @ingroup api_base_utils */ -const char *gem5Version = "24.1.0.1"; +const char *gem5Version = "24.1.0.2"; } // namespace gem5 From 7d6d253f6b249a9dfa37b341a98e34bc8bf7a1bb Mon Sep 17 00:00:00 2001 From: "Bobby R. Bruce" Date: Sun, 2 Feb 2025 01:02:59 -0800 Subject: [PATCH 3/3] misc: Update release notes for v24.1.0.2 --- RELEASE-NOTES.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index ca3a79288f..75aab5b567 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,3 +1,10 @@ +# Version 24.1.0.2 + +**[HOTFIX]** Adds PR as a hotfix to v24.1.0. + +This fixes a bug which was was causing the CHI coherence protocol to fail in multi-core simulations. +The fix sets the `RubySystem` pointer when the TBE is allocated, instead of when `set_tbe` is performed, thus ensuring that the `RubySystem` pointer is set before the TBE is used. + # Version 24.1.0.1 **[HOTFIX]** This hotfix release applies the following: