mem-cache: Create Prefetcher namespace

Create a namespace for the Prefetcher classes.

As a side effect the Prefetcher suffix has been removed from the
C++'s classes names, and the memory leaking destructor overrides
have been fixed.

Change-Id: I9bae492d2fd4734bcdfb68c164345898e65102b2
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24537
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2019-12-29 00:45:44 +01:00
committed by Daniel Carvalho
parent 56967e317b
commit 0be2496dd5
34 changed files with 434 additions and 305 deletions

View File

@@ -32,34 +32,36 @@
#include "mem/cache/prefetch/associative_set_impl.hh"
#include "params/IrregularStreamBufferPrefetcher.hh"
IrregularStreamBufferPrefetcher::IrregularStreamBufferPrefetcher(
namespace Prefetcher {
IrregularStreamBuffer::IrregularStreamBuffer(
const IrregularStreamBufferPrefetcherParams *p)
: QueuedPrefetcher(p),
chunkSize(p->chunk_size),
prefetchCandidatesPerEntry(p->prefetch_candidates_per_entry),
degree(p->degree),
trainingUnit(p->training_unit_assoc, p->training_unit_entries,
p->training_unit_indexing_policy,
p->training_unit_replacement_policy),
psAddressMappingCache(p->address_map_cache_assoc,
p->address_map_cache_entries,
p->ps_address_map_cache_indexing_policy,
p->ps_address_map_cache_replacement_policy,
AddressMappingEntry(prefetchCandidatesPerEntry,
p->num_counter_bits)),
spAddressMappingCache(p->address_map_cache_assoc,
p->address_map_cache_entries,
p->sp_address_map_cache_indexing_policy,
p->sp_address_map_cache_replacement_policy,
AddressMappingEntry(prefetchCandidatesPerEntry,
p->num_counter_bits)),
structuralAddressCounter(0)
: Queued(p),
chunkSize(p->chunk_size),
prefetchCandidatesPerEntry(p->prefetch_candidates_per_entry),
degree(p->degree),
trainingUnit(p->training_unit_assoc, p->training_unit_entries,
p->training_unit_indexing_policy,
p->training_unit_replacement_policy),
psAddressMappingCache(p->address_map_cache_assoc,
p->address_map_cache_entries,
p->ps_address_map_cache_indexing_policy,
p->ps_address_map_cache_replacement_policy,
AddressMappingEntry(prefetchCandidatesPerEntry,
p->num_counter_bits)),
spAddressMappingCache(p->address_map_cache_assoc,
p->address_map_cache_entries,
p->sp_address_map_cache_indexing_policy,
p->sp_address_map_cache_replacement_policy,
AddressMappingEntry(prefetchCandidatesPerEntry,
p->num_counter_bits)),
structuralAddressCounter(0)
{
assert(isPowerOf2(prefetchCandidatesPerEntry));
}
void
IrregularStreamBufferPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
IrregularStreamBuffer::calculatePrefetch(const PrefetchInfo &pfi,
std::vector<AddrPriority> &addresses)
{
// This prefetcher requires a PC
@@ -165,8 +167,8 @@ IrregularStreamBufferPrefetcher::calculatePrefetch(const PrefetchInfo &pfi,
}
}
IrregularStreamBufferPrefetcher::AddressMapping&
IrregularStreamBufferPrefetcher::getPSMapping(Addr paddr, bool is_secure)
IrregularStreamBuffer::AddressMapping&
IrregularStreamBuffer::getPSMapping(Addr paddr, bool is_secure)
{
Addr amc_address = paddr / prefetchCandidatesPerEntry;
Addr map_index = paddr % prefetchCandidatesPerEntry;
@@ -185,7 +187,7 @@ IrregularStreamBufferPrefetcher::getPSMapping(Addr paddr, bool is_secure)
}
void
IrregularStreamBufferPrefetcher::addStructuralToPhysicalEntry(
IrregularStreamBuffer::addStructuralToPhysicalEntry(
Addr structural_address, bool is_secure, Addr physical_address)
{
Addr amc_address = structural_address / prefetchCandidatesPerEntry;
@@ -206,8 +208,10 @@ IrregularStreamBufferPrefetcher::addStructuralToPhysicalEntry(
mapping.counter++;
}
IrregularStreamBufferPrefetcher*
} // namespace Prefetcher
Prefetcher::IrregularStreamBuffer*
IrregularStreamBufferPrefetcherParams::create()
{
return new IrregularStreamBufferPrefetcher(this);
return new Prefetcher::IrregularStreamBuffer(this);
}