mem-cache: Set prefetch bit if the blk comes from Prefetch only.

Original logic setting prefetch inside serviceMSHRTargets
did not exclude the blks that both came from CORE and Prefetch

Change-Id: Iab56b9266eb64baf972b160774aca0823faea458
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54364
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Daniel Carvalho <odanrc@yahoo.com.br>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Jiasen Huang
2021-12-20 12:50:39 +08:00
committed by Huang Jiasen
parent 0d1a40602f
commit 7910926631
2 changed files with 21 additions and 4 deletions

View File

@@ -693,11 +693,16 @@ Cache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)
bool is_invalidate = pkt->isInvalidate() &&
!mshr->wasWholeLineWrite;
bool from_core = false;
bool from_pref = false;
MSHR::TargetList targets = mshr->extractServiceableTargets(pkt);
for (auto &target: targets) {
Packet *tgt_pkt = target.pkt;
switch (target.source) {
case MSHR::Target::FromCPU:
from_core = true;
Tick completion_time;
// Here we charge on completion_time the delay of the xbar if the
// packet comes from it, charged on headerDelay.
@@ -852,8 +857,8 @@ Cache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)
case MSHR::Target::FromPrefetcher:
assert(tgt_pkt->cmd == MemCmd::HardPFReq);
if (blk)
blk->setPrefetched();
from_pref = true;
delete tgt_pkt;
break;
@@ -882,6 +887,10 @@ Cache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)
}
}
if (blk && !from_core && from_pref) {
blk->setPrefetched();
}
maintainClusivity(targets.hasFromCache, blk);
if (blk && blk->isValid()) {

View File

@@ -245,6 +245,9 @@ NoncoherentCache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt,
// First offset for critical word first calculations
const int initial_offset = mshr->getTarget()->pkt->getOffset(blkSize);
bool from_core = false;
bool from_pref = false;
MSHR::TargetList targets = mshr->extractServiceableTargets(pkt);
for (auto &target: targets) {
Packet *tgt_pkt = target.pkt;
@@ -254,6 +257,8 @@ NoncoherentCache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt,
// handle deferred requests comming from a cache or core
// above
from_core = true;
Tick completion_time;
// Here we charge on completion_time the delay of the xbar if the
// packet comes from it, charged on headerDelay.
@@ -292,8 +297,7 @@ NoncoherentCache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt,
// attached to this cache
assert(tgt_pkt->cmd == MemCmd::HardPFReq);
if (blk)
blk->setPrefetched();
from_pref = true;
// We have filled the block and the prefetcher does not
// require responses.
@@ -307,6 +311,10 @@ NoncoherentCache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt,
}
}
if (blk && !from_core && from_pref) {
blk->setPrefetched();
}
// Reponses are filling and bring in writable blocks, therefore
// there should be no deferred targets and all the non-deferred
// targets are now serviced.