changeset a06a4debe272 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=a06a4debe272
description:
        mem: Adjust cache queue reserve to more conservative values

        The cache queue reserve is there as an overflow to give us enough
        headroom based on when we block the cache, and how many transactions
        we may already have accepted before actually blocking. The previous
        values were probably chosen to be "big enough", when we actually know
        that we check the MSHRs after every single allocation, and for the
        write buffers we know that we implicitly may need one entry for every
        outstanding MSHR.
        * * *
        mem: Adjust cache queue reserve to more conservative values

        The cache queue reserve is there as an overflow to give us enough
        headroom based on when we block the cache, and how many transactions
        we may already have accepted before actually blocking. The previous
        values were probably chosen to be "big enough", when we actually know
        that we check the MSHRs after every single allocation, and for the
        write buffers we know that we implicitly may need one entry for every
        outstanding MSHR.

diffstat:

 src/mem/cache/base.cc       |  10 ++++++++--
 src/mem/cache/mshr_queue.hh |   4 +++-
 src/mem/cache/queue.hh      |   8 ++++----
 3 files changed, 15 insertions(+), 7 deletions(-)

diffs (75 lines):

diff -r a6968f06a5e0 -r a06a4debe272 src/mem/cache/base.cc
--- a/src/mem/cache/base.cc     Thu Mar 17 09:51:21 2016 -0400
+++ b/src/mem/cache/base.cc     Thu Mar 17 09:51:22 2016 -0400
@@ -68,8 +68,8 @@
 BaseCache::BaseCache(const BaseCacheParams *p, unsigned blk_size)
     : MemObject(p),
       cpuSidePort(nullptr), memSidePort(nullptr),
-      mshrQueue("MSHRs", p->mshrs, 4, p->demand_mshr_reserve),
-      writeBuffer("write buffer", p->write_buffers, p->mshrs+1000),
+      mshrQueue("MSHRs", p->mshrs, 0, p->demand_mshr_reserve), // see below
+      writeBuffer("write buffer", p->write_buffers, p->mshrs), // see below
       blkSize(blk_size),
       lookupLatency(p->hit_latency),
       forwardLatency(p->hit_latency),
@@ -85,6 +85,12 @@
       addrRanges(p->addr_ranges.begin(), p->addr_ranges.end()),
       system(p->system)
 {
+    // the MSHR queue has no reserve entries as we check the MSHR
+    // queue on every single allocation, whereas the write queue has
+    // as many reserve entries as we have MSHRs, since every MSHR may
+    // eventually require a writeback, and we do not check the write
+    // buffer before committing to an MSHR
+
     // forward snoops is overridden in init() once we can query
     // whether the connected master is actually snooping or not
 }
diff -r a6968f06a5e0 -r a06a4debe272 src/mem/cache/mshr_queue.hh
--- a/src/mem/cache/mshr_queue.hh       Thu Mar 17 09:51:21 2016 -0400
+++ b/src/mem/cache/mshr_queue.hh       Thu Mar 17 09:51:22 2016 -0400
@@ -141,7 +141,9 @@
      */
     bool canPrefetch() const
     {
-        return (allocated < numEntries - (numReserve + demandReserve));
+        // @todo we may want to revisit the +1, currently added to
+        // keep regressions unchanged
+        return (allocated < numEntries - (numReserve + 1 + demandReserve));
     }
 };
 
diff -r a6968f06a5e0 -r a06a4debe272 src/mem/cache/queue.hh
--- a/src/mem/cache/queue.hh    Thu Mar 17 09:51:21 2016 -0400
+++ b/src/mem/cache/queue.hh    Thu Mar 17 09:51:22 2016 -0400
@@ -69,7 +69,7 @@
 
     /**
      * The total number of entries in this queue. This number is set
-     * as the number of entries requested plus (numReserve - 1). This
+     * as the number of entries requested plus any reserve. This
      * allows for the same number of effective entries while still
      * maintaining an overflow reserve.
      */
@@ -120,10 +120,10 @@
      * Create a queue with a given number of entries.
      *
      * @param num_entries The number of entries in this queue.
-     * @param num_overflow The extra overflow entries needed.
+     * @param reserve The extra overflow entries needed.
      */
     Queue(const std::string &_label, int num_entries, int reserve) :
-        label(_label), numEntries(num_entries + reserve - 1),
+        label(_label), numEntries(num_entries + reserve),
         numReserve(reserve), entries(numEntries), _numInService(0),
         allocated(0)
     {
@@ -139,7 +139,7 @@
 
     bool isFull() const
     {
-        return (allocated > numEntries - numReserve);
+        return (allocated >= numEntries - numReserve);
     }
 
     int numInService() const
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to