From af27586fbc75480725fbef0564775fe5aa8cc8d8 Mon Sep 17 00:00:00 2001 From: Rekai Gonzalez Alberquilla Date: Thu, 7 Apr 2016 11:32:38 -0500 Subject: 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. --- src/mem/cache/prefetch/queued.hh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'src/mem/cache/prefetch/queued.hh') 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; std::list 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::const_iterator; + std::list::const_iterator inPrefetch(Addr address, + bool is_secure) const; + using iterator = std::list::iterator; + std::list::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 &addresses) = 0; + std::vector &addresses) = 0; PacketPtr getPacket(); Tick nextPrefetchReadyTime() const -- cgit v1.2.3