From 2e5d0198d615f898ed521d36ab5386aa3dbcb09e Mon Sep 17 00:00:00 2001 From: Timothy Hayes Date: Mon, 21 Oct 2019 15:17:13 +0100 Subject: [PATCH] mem-ruby: Minor Ruby Prefetcher fixes Minor fixes to the Ruby stride prefetcher. This includes removing unused statistics and changing where/when some statistics are updated. Change-Id: If758bf009f53fad277cb3cd754d57a0b10737599 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24363 Reviewed-by: Daniel Carvalho Maintainer: Bobby R. Bruce Tested-by: kokoro --- src/mem/ruby/structures/Prefetcher.cc | 31 +++++++++++++---------- src/mem/ruby/structures/Prefetcher.hh | 18 +++++++++---- src/mem/ruby/structures/RubyPrefetcher.py | 13 +++++++++- 3 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/mem/ruby/structures/Prefetcher.cc b/src/mem/ruby/structures/Prefetcher.cc index 70b30352e..a8b2d8557 100644 --- a/src/mem/ruby/structures/Prefetcher.cc +++ b/src/mem/ruby/structures/Prefetcher.cc @@ -1,4 +1,16 @@ /* + * Copyright (c) 2020 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood * All rights reserved. * @@ -105,19 +117,9 @@ Prefetcher::regStats() .desc("number of prefetch requests made") ; - numPrefetchAccepted - .name(name() + ".prefetches_accepted") - .desc("number of prefetch requests accepted") - ; - - numDroppedPrefetches - .name(name() + ".dropped_prefetches") - .desc("number of prefetch requests dropped") - ; - numHits .name(name() + ".hits") - .desc("number of prefetched blocks accessed") + .desc("number of prefetched blocks accessed (for the first time)") ; numPartialHits @@ -157,7 +159,7 @@ Prefetcher::observeMiss(Addr address, const RubyRequestType& type) // The controller has issued the prefetch request, // but the request for the block arrived earlier. numPartialHits++; - observePfHit(line_addr); + observePfMiss(line_addr); return; } } else { @@ -242,16 +244,17 @@ Prefetcher::issueNextPrefetch(Addr address, PrefetchEntry *stream) // possibly stop prefetching at page boundaries if (page_addr != pageAddress(line_addr)) { - numPagesCrossed++; if (!m_prefetch_cross_pages) { // Deallocate the stream since we are not prefetching // across page boundries stream->m_is_valid = false; return; } + numPagesCrossed++; } // launch next prefetch + numPrefetchRequested++; stream->m_address = line_addr; stream->m_use_time = m_controller->curCycle(); DPRINTF(RubyPrefetcher, "Requesting prefetch for %#x\n", line_addr); @@ -308,12 +311,12 @@ Prefetcher::initializeStream(Addr address, int stride, line_addr = makeNextStrideAddress(line_addr, stride); // possibly stop prefetching at page boundaries if (page_addr != pageAddress(line_addr)) { - numPagesCrossed++; if (!m_prefetch_cross_pages) { // deallocate this stream prefetcher mystream->m_is_valid = false; return; } + numPagesCrossed++; } // launch prefetch diff --git a/src/mem/ruby/structures/Prefetcher.hh b/src/mem/ruby/structures/Prefetcher.hh index 9c3c06851..89c0186a7 100644 --- a/src/mem/ruby/structures/Prefetcher.hh +++ b/src/mem/ruby/structures/Prefetcher.hh @@ -1,4 +1,16 @@ /* + * Copyright (c) 2020 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood * All rights reserved. * @@ -166,7 +178,7 @@ class Prefetcher : public SimObject //! have been hit uint32_t *m_unit_filter_hit; - //! a negative nit stride filter array: helps reduce BW requirement + //! a negative unit stride filter array: helps reduce BW requirement //! of prefetching std::vector m_negative_filter; /// a round robin pointer into the negative filter group @@ -199,10 +211,6 @@ class Prefetcher : public SimObject Stats::Scalar numAllocatedStreams; //! Count of prefetch requests made Stats::Scalar numPrefetchRequested; - //! Count of prefetch requests accepted - Stats::Scalar numPrefetchAccepted; - //! Count of prefetches dropped - Stats::Scalar numDroppedPrefetches; //! Count of successful prefetches Stats::Scalar numHits; //! Count of partial successful prefetches diff --git a/src/mem/ruby/structures/RubyPrefetcher.py b/src/mem/ruby/structures/RubyPrefetcher.py index a66bf4d29..9d2803b34 100644 --- a/src/mem/ruby/structures/RubyPrefetcher.py +++ b/src/mem/ruby/structures/RubyPrefetcher.py @@ -1,3 +1,15 @@ +# Copyright (c) 2020 ARM Limited +# All rights reserved. +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# unmodified and in its entirety in all distributions of the software, +# modified or unmodified, in source code or in binary form. +# # Copyright (c) 2012 Mark D. Hill and David A. Wood # All rights reserved. # @@ -37,7 +49,6 @@ class Prefetcher(SimObject): num_streams = Param.UInt32(4, "Number of prefetch streams to be allocated") - pf_per_stream = Param.UInt32(1, "Number of prefetches per stream") unit_filter = Param.UInt32(8, "Number of entries in the unit filter array") nonunit_filter = Param.UInt32(8, -- 2.30.2