summaryrefslogtreecommitdiff
path: root/src/mem/cache/prefetch/queued.hh
diff options
context:
space:
mode:
authorRekai Gonzalez Alberquilla <Rekai.GonzalezAlberquilla@arm.com>2016-04-07 11:32:38 -0500
committerRekai Gonzalez Alberquilla <Rekai.GonzalezAlberquilla@arm.com>2016-04-07 11:32:38 -0500
commitaf27586fbc75480725fbef0564775fe5aa8cc8d8 (patch)
tree172bc90811714896da278d16d97edbbb1f3fe4e2 /src/mem/cache/prefetch/queued.hh
parentdad7d9277b571305ee248cd761a7dbb9400b3681 (diff)
downloadgem5-af27586fbc75480725fbef0564775fe5aa8cc8d8.tar.xz
mem: Add priority to QueuedPrefetcher
Queued prefetcher entries now count with a priority field. The idea is to add packets ordered by priority and then by age. For the existing algorithms in which priority doesn't make sense, it is set to 0 for all deferred packets in the queue.
Diffstat (limited to 'src/mem/cache/prefetch/queued.hh')
-rw-r--r--src/mem/cache/prefetch/queued.hh29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/mem/cache/prefetch/queued.hh b/src/mem/cache/prefetch/queued.hh
index 7ce9e7b93..108891fcc 100644
--- a/src/mem/cache/prefetch/queued.hh
+++ b/src/mem/cache/prefetch/queued.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 ARM Limited
+ * Copyright (c) 2014-2015 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -51,8 +51,23 @@ class QueuedPrefetcher : public BasePrefetcher
struct DeferredPacket {
Tick tick;
PacketPtr pkt;
- DeferredPacket(Tick t, PacketPtr p) : tick(t), pkt(p) {}
+ int32_t priority;
+ DeferredPacket(Tick t, PacketPtr p, int32_t pr) : tick(t), pkt(p),
+ priority(pr) {}
+ bool operator>(const DeferredPacket& that) const
+ {
+ return priority > that.priority;
+ }
+ bool operator<(const DeferredPacket& that) const
+ {
+ return priority < that.priority;
+ }
+ bool operator<=(const DeferredPacket& that) const
+ {
+ return !(*this > that);
+ }
};
+ using AddrPriority = std::pair<Addr, int32_t>;
std::list<DeferredPacket> pfq;
@@ -76,7 +91,12 @@ class QueuedPrefetcher : public BasePrefetcher
/** Tag prefetch with PC of generating access? */
const bool tagPrefetch;
- bool inPrefetch(Addr address, bool is_secure) const;
+ using const_iterator = std::list<DeferredPacket>::const_iterator;
+ std::list<DeferredPacket>::const_iterator inPrefetch(Addr address,
+ bool is_secure) const;
+ using iterator = std::list<DeferredPacket>::iterator;
+ std::list<DeferredPacket>::iterator inPrefetch(Addr address,
+ bool is_secure);
// STATS
Stats::Scalar pfIdentified;
@@ -90,10 +110,11 @@ class QueuedPrefetcher : public BasePrefetcher
virtual ~QueuedPrefetcher();
Tick notify(const PacketPtr &pkt);
+ PacketPtr insert(AddrPriority& info, bool is_secure);
// Note: This should really be pure virtual, but doesnt go well with params
virtual void calculatePrefetch(const PacketPtr &pkt,
- std::vector<Addr> &addresses) = 0;
+ std::vector<AddrPriority> &addresses) = 0;
PacketPtr getPacket();
Tick nextPrefetchReadyTime() const