Jarvis JIA has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/65952?usp=email )

Change subject: mem-cache: Fix FIFO replacement
......................................................................

mem-cache: Fix FIFO replacement

Change FIFO from using curTicks() to using timeTicks counter to
avoid issues where multiple lines are considered to have entered
the cache at the same tick.

Change-Id: I5e0b894eb9bec4f0f8bc8f48ec2766a0fc5079c6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65952
Reviewed-by: Daniel Carvalho <[email protected]>
Reviewed-by: Matt Sinclair <[email protected]>
Maintainer: Daniel Carvalho <[email protected]>
Tested-by: kokoro <[email protected]>
Maintainer: Matt Sinclair <[email protected]>
---
M src/mem/cache/replacement_policies/fifo_rp.cc
M src/mem/cache/replacement_policies/fifo_rp.hh
2 files changed, 28 insertions(+), 5 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, approved; Looks good to me, approved
Matt Sinclair: Looks good to me, but someone else must approve; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/src/mem/cache/replacement_policies/fifo_rp.cc b/src/mem/cache/replacement_policies/fifo_rp.cc
index 9655c96..bc0680b 100644
--- a/src/mem/cache/replacement_policies/fifo_rp.cc
+++ b/src/mem/cache/replacement_policies/fifo_rp.cc
@@ -36,11 +36,9 @@

 namespace gem5
 {
-
 GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
 namespace replacement_policy
 {
-
 FIFO::FIFO(const Params &p)
   : Base(p)
 {
@@ -51,7 +49,7 @@
 {
     // Reset insertion tick
     std::static_pointer_cast<FIFOReplData>(
-        replacement_data)->tickInserted = Tick(0);
+        replacement_data)->tickInserted = ++timeTicks;
 }

 void
@@ -65,7 +63,7 @@
 {
     // Set insertion tick
     std::static_pointer_cast<FIFOReplData>(
-        replacement_data)->tickInserted = curTick();
+        replacement_data)->tickInserted = ++timeTicks;
 }

 ReplaceableEntry*
diff --git a/src/mem/cache/replacement_policies/fifo_rp.hh b/src/mem/cache/replacement_policies/fifo_rp.hh
index f4703d1..4b62fd2 100644
--- a/src/mem/cache/replacement_policies/fifo_rp.hh
+++ b/src/mem/cache/replacement_policies/fifo_rp.hh
@@ -56,13 +56,19 @@
     {
         /** Tick on which the entry was inserted. */
         Tick tickInserted;
-
         /**
          * Default constructor. Invalidate data.
          */
         FIFOReplData() : tickInserted(0) {}
     };

+  private:
+    /**
+     * A counter that tracks the number of
+     * ticks since being created to avoid a tie
+     */
+    mutable Tick timeTicks;
+
   public:
     typedef FIFORPParams Params;
     FIFO(const Params &p);

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/65952?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: I5e0b894eb9bec4f0f8bc8f48ec2766a0fc5079c6
Gerrit-Change-Number: 65952
Gerrit-PatchSet: 9
Gerrit-Owner: Jarvis JIA <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Jarvis JIA <[email protected]>
Gerrit-Reviewer: Matt Sinclair <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Jason Lowe-Power <[email protected]>
Gerrit-CC: Matt Sinclair <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to