[gem5-dev] Change in public/gem5[master]: mem-cache: BRRIP Replacement Policy

2018-03-12 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has uploaded a new patch set (#2). (  
https://gem5-review.googlesource.com/8981 )


Change subject: mem-cache: BRRIP Replacement Policy
..

mem-cache: BRRIP Replacement Policy

Implementation of a Bimodal RRIP replacement policy.

Change-Id: Iba716eb5df2bf2be156e765f889d94f6ad00c91b
---
M src/mem/cache/replacement_policies/ReplacementPolicies.py
M src/mem/cache/replacement_policies/SConscript
A src/mem/cache/replacement_policies/brrip_rp.cc
A src/mem/cache/replacement_policies/brrip_rp.hh
4 files changed, 142 insertions(+), 0 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/8981
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Iba716eb5df2bf2be156e765f889d94f6ad00c91b
Gerrit-Change-Number: 8981
Gerrit-PatchSet: 2
Gerrit-Owner: Daniel Carvalho 
Gerrit-MessageType: newpatchset
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in public/gem5[master]: mem-cache: BRRIP Replacement Policy

2018-03-12 Thread Daniel Carvalho (Gerrit)
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/8981



Change subject: mem-cache: BRRIP Replacement Policy
..

mem-cache: BRRIP Replacement Policy

Implementation of a Bimodal RRIP replacement policy.

Change-Id: Iba716eb5df2bf2be156e765f889d94f6ad00c91b
---
M src/mem/cache/replacement_policies/ReplacementPolicies.py
M src/mem/cache/replacement_policies/SConscript
A src/mem/cache/replacement_policies/brrip_rp.cc
A src/mem/cache/replacement_policies/brrip_rp.hh
4 files changed, 142 insertions(+), 0 deletions(-)



diff --git a/src/mem/cache/replacement_policies/ReplacementPolicies.py  
b/src/mem/cache/replacement_policies/ReplacementPolicies.py

index 5798ae8..6306b0e 100644
--- a/src/mem/cache/replacement_policies/ReplacementPolicies.py
+++ b/src/mem/cache/replacement_policies/ReplacementPolicies.py
@@ -52,3 +52,10 @@
 max_RRPV = Param.Unsigned(3, "Maximum RRPV possible")
 hit_priority = Param.Bool(False,
 "Prioritize evicting blocks that havent had a hit recently")
+
+class BRRIPRP(RRIPRP):
+type = 'BRRIPRP'
+cxx_class = 'BRRIPRP'
+cxx_header = "mem/cache/replacement_policies/brrip_rp.hh"
+btp = Param.Percent(3,
+"Percentage of blocks to be inserted with long RRPV")
diff --git a/src/mem/cache/replacement_policies/SConscript  
b/src/mem/cache/replacement_policies/SConscript

index ebe5397..9a29de0 100644
--- a/src/mem/cache/replacement_policies/SConscript
+++ b/src/mem/cache/replacement_policies/SConscript
@@ -33,6 +33,7 @@
 SimObject('ReplacementPolicies.py')

 Source('base.cc')
+Source('brrip_rp.cc')
 Source('lru_rp.cc')
 Source('random_rp.cc')
 Source('rrip_rp.cc')
diff --git a/src/mem/cache/replacement_policies/brrip_rp.cc  
b/src/mem/cache/replacement_policies/brrip_rp.cc

new file mode 100644
index 000..ed565d4
--- /dev/null
+++ b/src/mem/cache/replacement_policies/brrip_rp.cc
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2018 Inria
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Daniel Carvalho
+ */
+
+#include "mem/cache/replacement_policies/brrip_rp.hh"
+
+#include "base/random.hh"
+#include "debug/CacheRepl.hh"
+
+BRRIPRP::BRRIPRP(const Params *p)
+: RRIPRP(p), btp(p->btp)
+{
+}
+
+void
+BRRIPRP::reset(CacheBlk *blk)
+{
+RRIPRP::reset(blk);
+
+// Reset RRPV
+// Blocks are inserted as "long re-reference" if lower than btp,
+// "distant re-reference" otherwise
+blk->replData.rrpv = maxRRPV-(random_mt.random(1, 100) <=  
btp);

+}
+
+BRRIPRP*
+BRRIPRPParams::create()
+{
+return new BRRIPRP(this);
+}
diff --git a/src/mem/cache/replacement_policies/brrip_rp.hh  
b/src/mem/cache/replacement_policies/brrip_rp.hh

new file mode 100644
index 000..83fcc94
--- /dev/null
+++ b/src/mem/cache/replacement_policies/brrip_rp.hh
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2018 Inria
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of it