From d8a04f902ea6b84f24d57beb90eb6d535ba37f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20M=C3=BCck?= Date: Thu, 8 Sep 2022 15:55:35 -0500 Subject: [PATCH] mem-cache: add prefetch info to update probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CacheDataUpdateProbeArg has additional info to tell listeners if the block was prefetched and evicted without being used, as well as which object prefetched the block. Related JIRA: https://gem5.atlassian.net/browse/GEM5-457 https://gem5.atlassian.net/browse/GEM5-1112 Change-Id: Id8ac9099ddbce6e94ee775655da23de5df25cf0f Signed-off-by: Tiago Mück --- src/mem/cache/base.cc | 11 ++++++++--- src/mem/cache/cache_probe_arg.hh | 10 ++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index ce6cbe89ca..e738167066 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -773,7 +773,8 @@ BaseCache::updateBlockData(CacheBlk *blk, const PacketPtr cpkt, bool has_old_data) { CacheDataUpdateProbeArg data_update( - regenerateBlkAddr(blk), blk->isSecure(), accessor); + regenerateBlkAddr(blk), blk->isSecure(), + blk->getSrcRequestorId(), accessor); if (ppDataUpdate->hasListeners()) { if (has_old_data) { data_update.oldData = std::vector(blk->data, @@ -790,6 +791,7 @@ BaseCache::updateBlockData(CacheBlk *blk, const PacketPtr cpkt, if (cpkt) { data_update.newData = std::vector(blk->data, blk->data + (blkSize / sizeof(uint64_t))); + data_update.hwPrefetched = blk->wasPrefetched(); } ppDataUpdate->notify(data_update); } @@ -812,7 +814,8 @@ BaseCache::cmpAndSwap(CacheBlk *blk, PacketPtr pkt) // Get a copy of the old block's contents for the probe before the update CacheDataUpdateProbeArg data_update( - regenerateBlkAddr(blk), blk->isSecure(), accessor); + regenerateBlkAddr(blk), blk->isSecure(), blk->getSrcRequestorId(), + accessor); if (ppDataUpdate->hasListeners()) { data_update.oldData = std::vector(blk->data, blk->data + (blkSize / sizeof(uint64_t))); @@ -1110,7 +1113,8 @@ BaseCache::satisfyRequest(PacketPtr pkt, CacheBlk *blk, bool, bool) // Get a copy of the old block's contents for the probe before // the update CacheDataUpdateProbeArg data_update( - regenerateBlkAddr(blk), blk->isSecure(), accessor); + regenerateBlkAddr(blk), blk->isSecure(), + blk->getSrcRequestorId(), accessor); if (ppDataUpdate->hasListeners()) { data_update.oldData = std::vector(blk->data, blk->data + (blkSize / sizeof(uint64_t))); @@ -1129,6 +1133,7 @@ BaseCache::satisfyRequest(PacketPtr pkt, CacheBlk *blk, bool, bool) if (ppDataUpdate->hasListeners()) { data_update.newData = std::vector(blk->data, blk->data + (blkSize / sizeof(uint64_t))); + data_update.hwPrefetched = blk->wasPrefetched(); ppDataUpdate->notify(data_update); } diff --git a/src/mem/cache/cache_probe_arg.hh b/src/mem/cache/cache_probe_arg.hh index b70e0269ee..49c0171e2f 100644 --- a/src/mem/cache/cache_probe_arg.hh +++ b/src/mem/cache/cache_probe_arg.hh @@ -95,17 +95,23 @@ struct CacheDataUpdateProbeArg Addr addr; /** Whether the block belongs to the secure address space. */ bool isSecure; + /** Block original requestor */ + const RequestorID requestorID; /** The stale data contents. If zero-sized this update is a fill. */ std::vector oldData; /** The new data contents. If zero-sized this is an invalidation. */ std::vector newData; + /** Set if the update is from a prefetch or evicting a prefetched + * block that was never used. */ + bool hwPrefetched; /** Accessor for the cache */ CacheAccessor &accessor; CacheDataUpdateProbeArg(Addr _addr, bool is_secure, + RequestorID _requestorID, CacheAccessor &_accessor) - : addr(_addr), isSecure(is_secure), oldData(), newData(), - accessor(_accessor) + : addr(_addr), isSecure(is_secure), requestorID(_requestorID), + oldData(), newData(), accessor(_accessor) { } };