Hoa Nguyen has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/69897?usp=email )

Change subject: mem-ruby: Not flushing data to memory when there's no dirty block
......................................................................

mem-ruby: Not flushing data to memory when there's no dirty block

Currently, taking a checkpoint with a ruby cache involves moving all
the dirty data in cache to memory. This is done by keeping **only**
simulating the cache until all dirty data are flushed to the memory
before taking the checkpoint.

However, when the cache does not have dirty data, it is a problem if
we keep simulating the cache. E.g., calling checkpoint caused the gem5
"empty event queue" assertion fault when running the ruby cache in
atomic_noncaching mode. Since the mode bypasses the cache, all blocks
are invalid and do not contain dirty data. Subsequently, there is no
event placed to the event queue when we keep **only** simulating the
cache before taking the checkpoint.

This patch fixes this problem by checking if there is any actionable
item when trying to move dirty data to memory. If there is no block
contains dirty data, we simply choose not to continue simulating the
cache before taking the checkpoint.

Change-Id: Idfa09be51274c7fc8a340e9e33167f5b32d1b866
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69897
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
---
M src/mem/ruby/system/CacheRecorder.cc
M src/mem/ruby/system/CacheRecorder.hh
M src/mem/ruby/system/RubySystem.cc
3 files changed, 15 insertions(+), 0 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Bobby Bruce: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/mem/ruby/system/CacheRecorder.cc b/src/mem/ruby/system/CacheRecorder.cc
index e87b3f2..20a8a30 100644
--- a/src/mem/ruby/system/CacheRecorder.cc
+++ b/src/mem/ruby/system/CacheRecorder.cc
@@ -207,5 +207,11 @@
     return current_size;
 }

+uint64_t
+CacheRecorder::getNumRecords() const
+{
+    return m_records.size();
+}
+
 } // namespace ruby
 } // namespace gem5
diff --git a/src/mem/ruby/system/CacheRecorder.hh b/src/mem/ruby/system/CacheRecorder.hh
index 8dbd67f..be95590 100644
--- a/src/mem/ruby/system/CacheRecorder.hh
+++ b/src/mem/ruby/system/CacheRecorder.hh
@@ -85,6 +85,8 @@

     uint64_t aggregateRecords(uint8_t **data, uint64_t size);

+    uint64_t getNumRecords() const;
+
     /*!
      * Function for flushing the memory contents of the caches to the
      * main memory. It goes through the recorded contents of the caches,
diff --git a/src/mem/ruby/system/RubySystem.cc b/src/mem/ruby/system/RubySystem.cc
index 5a81513..b38c903 100644
--- a/src/mem/ruby/system/RubySystem.cc
+++ b/src/mem/ruby/system/RubySystem.cc
@@ -218,6 +218,13 @@
     }
     DPRINTF(RubyCacheTrace, "Cache Trace Complete\n");

+    // If there is no dirty block, we don't need to flush the cache
+    if (m_cache_recorder->getNumRecords() == 0)
+    {
+        m_cooldown_enabled = false;
+        return;
+    }
+
     // save the current tick value
     Tick curtick_original = curTick();
DPRINTF(RubyCacheTrace, "Recording current tick %ld\n", curtick_original);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/69897?usp=email 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: Idfa09be51274c7fc8a340e9e33167f5b32d1b866
Gerrit-Change-Number: 69897
Gerrit-PatchSet: 6
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: 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

Reply via email to