Daniel Carvalho has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/11198 )
Change subject: mem-cache: Add block size to findVictim
......................................................................
mem-cache: Add block size to findVictim
Add block size to findVictim. For standard caches it
will not be used. Compressed caches, however, need to
know the size of the compressed block to decide whether
a block is co-allocatable or not.
Change-Id: Id07f79763687b29f75d707c080fa9bd978a408aa
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/11198
Tested-by: kokoro <[email protected]>
Maintainer: Nikos Nikoleris <[email protected]>
Reviewed-by: Mohammad Seyedzadeh <[email protected]>
Reviewed-by: Nikos Nikoleris <[email protected]>
---
M src/mem/cache/base.cc
M src/mem/cache/tags/base.hh
M src/mem/cache/tags/base_set_assoc.hh
M src/mem/cache/tags/fa_lru.cc
M src/mem/cache/tags/fa_lru.hh
M src/mem/cache/tags/sector_tags.cc
M src/mem/cache/tags/sector_tags.hh
7 files changed, 18 insertions(+), 3 deletions(-)
Approvals:
Nikos Nikoleris: Looks good to me, approved; Looks good to me, approved
Mohammad Seyedzadeh: Looks good to me, but someone else must approve
kokoro: Regressions pass
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc
index f31fbaf..36968a1 100644
--- a/src/mem/cache/base.cc
+++ b/src/mem/cache/base.cc
@@ -1319,9 +1319,13 @@
// Get secure bit
const bool is_secure = pkt->isSecure();
+ // @todo Compress and get compression related data
+ std::size_t blk_size_bits = blkSize*8;
+
// Find replacement victim
std::vector<CacheBlk*> evict_blks;
- CacheBlk *victim = tags->findVictim(addr, is_secure, evict_blks);
+ CacheBlk *victim = tags->findVictim(addr, is_secure, blk_size_bits,
+ evict_blks);
// It is valid to return nullptr if there is no victim
if (!victim)
diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh
index 296837e..ae9cab8 100644
--- a/src/mem/cache/tags/base.hh
+++ b/src/mem/cache/tags/base.hh
@@ -50,6 +50,7 @@
#define __MEM_CACHE_TAGS_BASE_HH__
#include <cassert>
+#include <cstdint>
#include <functional>
#include <string>
@@ -276,10 +277,12 @@
*
* @param addr Address to find a victim for.
* @param is_secure True if the target memory space is secure.
+ * @param size Size, in bits, of new block to allocate.
* @param evict_blks Cache blocks to be evicted.
* @return Cache block to be replaced.
*/
virtual CacheBlk* findVictim(Addr addr, const bool is_secure,
+ const std::size_t size,
std::vector<CacheBlk*>& evict_blks) const
= 0;
/**
diff --git a/src/mem/cache/tags/base_set_assoc.hh
b/src/mem/cache/tags/base_set_assoc.hh
index c39a813..f58f939 100644
--- a/src/mem/cache/tags/base_set_assoc.hh
+++ b/src/mem/cache/tags/base_set_assoc.hh
@@ -48,6 +48,7 @@
#ifndef __MEM_CACHE_TAGS_BASE_SET_ASSOC_HH__
#define __MEM_CACHE_TAGS_BASE_SET_ASSOC_HH__
+#include <cstdint>
#include <functional>
#include <string>
#include <vector>
@@ -160,10 +161,12 @@
*
* @param addr Address to find a victim for.
* @param is_secure True if the target memory space is secure.
+ * @param size Size, in bits, of new block to allocate.
* @param evict_blks Cache blocks to be evicted.
* @return Cache block to be replaced.
*/
CacheBlk* findVictim(Addr addr, const bool is_secure,
+ const std::size_t size,
std::vector<CacheBlk*>& evict_blks) const override
{
// Get possible entries to be victimized
diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc
index 4cdac0a..0ebef4b 100644
--- a/src/mem/cache/tags/fa_lru.cc
+++ b/src/mem/cache/tags/fa_lru.cc
@@ -196,7 +196,7 @@
}
CacheBlk*
-FALRU::findVictim(Addr addr, const bool is_secure,
+FALRU::findVictim(Addr addr, const bool is_secure, const std::size_t size,
std::vector<CacheBlk*>& evict_blks) const
{
// The victim is always stored on the tail for the FALRU
diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh
index 346ff60..2ca9f4d 100644
--- a/src/mem/cache/tags/fa_lru.hh
+++ b/src/mem/cache/tags/fa_lru.hh
@@ -219,10 +219,12 @@
*
* @param addr Address to find a victim for.
* @param is_secure True if the target memory space is secure.
+ * @param size Size, in bits, of new block to allocate.
* @param evict_blks Cache blocks to be evicted.
* @return Cache block to be replaced.
*/
CacheBlk* findVictim(Addr addr, const bool is_secure,
+ const std::size_t size,
std::vector<CacheBlk*>& evict_blks) const
override;
/**
diff --git a/src/mem/cache/tags/sector_tags.cc
b/src/mem/cache/tags/sector_tags.cc
index 06093e9..535badb 100644
--- a/src/mem/cache/tags/sector_tags.cc
+++ b/src/mem/cache/tags/sector_tags.cc
@@ -221,7 +221,7 @@
}
CacheBlk*
-SectorTags::findVictim(Addr addr, const bool is_secure,
+SectorTags::findVictim(Addr addr, const bool is_secure, const std::size_t
size,
std::vector<CacheBlk*>& evict_blks) const
{
// Get possible entries to be victimized
diff --git a/src/mem/cache/tags/sector_tags.hh
b/src/mem/cache/tags/sector_tags.hh
index 84c721e..13638b4 100644
--- a/src/mem/cache/tags/sector_tags.hh
+++ b/src/mem/cache/tags/sector_tags.hh
@@ -36,6 +36,7 @@
#ifndef __MEM_CACHE_TAGS_SECTOR_TAGS_HH__
#define __MEM_CACHE_TAGS_SECTOR_TAGS_HH__
+#include <cstdint>
#include <string>
#include <vector>
@@ -150,10 +151,12 @@
*
* @param addr Address to find a victim for.
* @param is_secure True if the target memory space is secure.
+ * @param size Size, in bits, of new block to allocate.
* @param evict_blks Cache blocks to be evicted.
* @return Cache block to be replaced.
*/
CacheBlk* findVictim(Addr addr, const bool is_secure,
+ const std::size_t size,
std::vector<CacheBlk*>& evict_blks) const
override;
/**
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/11198
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: Id07f79763687b29f75d707c080fa9bd978a408aa
Gerrit-Change-Number: 11198
Gerrit-PatchSet: 18
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Mohammad Seyedzadeh <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev