From 64a3e28852fa0287f463cb3cef20be8f8a0af565 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tiago=20M=C3=BCck?= Date: Fri, 19 Jun 2020 21:16:45 -0500 Subject: [PATCH] mem-ruby: change MessageBuffer randomization param MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit There are cases in which we need to prevent randomization for a specific buffer when enabled at the RubySystem level (e.g. a internal trigger queue that requires zero latency enqueue, while other buffers can be randomized). This changes the randomization parameter to support enabling and disabling randomization regardless of the RubySystem setting. Change-Id: If7520153cc5864897fa42e8911a6f8acbcf01db5 Signed-off-by: Tiago Mück Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31419 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/mem/ruby/network/MessageBuffer.cc | 8 +++++--- src/mem/ruby/network/MessageBuffer.hh | 2 +- src/mem/ruby/network/MessageBuffer.py | 13 +++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc index 8843694bd..00e8fea22 100644 --- a/src/mem/ruby/network/MessageBuffer.cc +++ b/src/mem/ruby/network/MessageBuffer.cc @@ -176,9 +176,11 @@ MessageBuffer::enqueue(MsgPtr message, Tick current_time, Tick delta) assert((delta > 0) || m_allow_zero_latency); Tick arrival_time = 0; - // random delays are inserted if either RubySystem level randomization flag - // is turned on, or the buffer level randomization is set - if (!RubySystem::getRandomization() && !m_randomization) { + // random delays are inserted if the RubySystem level randomization flag + // is turned on and this buffer allows it + if ((m_randomization == MessageRandomization::disabled) || + ((m_randomization == MessageRandomization::ruby_system) && + !RubySystem::getRandomization())) { // No randomization arrival_time = current_time + delta; } else { diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh index 3887340e5..fc69d34fd 100644 --- a/src/mem/ruby/network/MessageBuffer.hh +++ b/src/mem/ruby/network/MessageBuffer.hh @@ -248,7 +248,7 @@ class MessageBuffer : public SimObject uint64_t m_msg_counter; int m_priority_rank; const bool m_strict_fifo; - const bool m_randomization; + const MessageRandomization m_randomization; const bool m_allow_zero_latency; int m_input_link_id; diff --git a/src/mem/ruby/network/MessageBuffer.py b/src/mem/ruby/network/MessageBuffer.py index 297835f1e..807ffb4bd 100644 --- a/src/mem/ruby/network/MessageBuffer.py +++ b/src/mem/ruby/network/MessageBuffer.py @@ -40,6 +40,13 @@ from m5.params import * from m5.proxy import * from m5.SimObject import SimObject +# A MessageBuffer inserts random delays to enqueued messages when the +# randomization param is set to 'enabled' or when globally enabled for the +# RubySystem and the param is set to 'ruby_system' (default). 'disabled' +# completely prevents randomization. +class MessageRandomization(ScopedEnum): + vals = ['disabled', 'enabled', 'ruby_system'] + class MessageBuffer(SimObject): type = 'MessageBuffer' cxx_class = 'MessageBuffer' @@ -47,10 +54,8 @@ class MessageBuffer(SimObject): ordered = Param.Bool(False, "Whether the buffer is ordered") buffer_size = Param.Unsigned(0, "Maximum number of entries to buffer \ (0 allows infinite entries)") - randomization = Param.Bool(False, "Insert random delays on message \ - enqueue times (enforced to have \ - random delays if RubySystem \ - randomization flag is True)") + randomization = Param.MessageRandomization('ruby_system', + "Randomization parameter") allow_zero_latency = Param.Bool(False, "Allows messages to be enqueued \ with zero latency. This is useful \ for internall trigger queues and \ -- 2.30.2