mem: Rename ReplacementPolicy namespace as replacement_policy

As part of recent decisions regarding namespace
naming conventions, all namespaces will be changed
to snake case.

::ReplacementPolicy became ::replacement_policy.

Change-Id: Id46cd9d89e9424fd3c5484e2f9c69ef2b73f135b
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45405
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
This commit is contained in:
Daniel R. Carvalho
2021-05-06 07:24:06 -03:00
committed by Daniel Carvalho
parent 9211b5f5d4
commit 17897bb3f6
30 changed files with 120 additions and 71 deletions

View File

@@ -55,7 +55,7 @@ class AssociativeSet
/** Pointer to the indexing policy */
BaseIndexingPolicy* const indexingPolicy;
/** Pointer to the replacement policy */
ReplacementPolicy::Base* const replacementPolicy;
replacement_policy::Base* const replacementPolicy;
/** Vector containing the entries of the container */
std::vector<Entry> entries;
@@ -70,7 +70,7 @@ class AssociativeSet
* @param init_val initial value of the elements of the set
*/
AssociativeSet(int assoc, int num_entries, BaseIndexingPolicy *idx_policy,
ReplacementPolicy::Base *rpl_policy, Entry const &init_val = Entry());
replacement_policy::Base *rpl_policy, Entry const &init_val = Entry());
/**
* Find an entry within the set

View File

@@ -34,7 +34,7 @@
template<class Entry>
AssociativeSet<Entry>::AssociativeSet(int assoc, int num_entries,
BaseIndexingPolicy *idx_policy, ReplacementPolicy::Base *rpl_policy,
BaseIndexingPolicy *idx_policy, replacement_policy::Base *rpl_policy,
Entry const &init_value)
: associativity(assoc), numEntries(num_entries), indexingPolicy(idx_policy),
replacementPolicy(rpl_policy), entries(numEntries, init_value)

View File

@@ -61,7 +61,9 @@
#include "params/StridePrefetcherHashedSetAssociative.hh"
class BaseIndexingPolicy;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class Base;
}
struct StridePrefetcherParams;
@@ -109,14 +111,13 @@ class Stride : public Queued
const int numEntries;
BaseIndexingPolicy* const indexingPolicy;
ReplacementPolicy::Base* const replacementPolicy;
replacement_policy::Base* const replacementPolicy;
PCTableInfo(int assoc, int num_entries,
BaseIndexingPolicy* indexing_policy,
ReplacementPolicy::Base* replacement_policy)
replacement_policy::Base* repl_policy)
: assoc(assoc), numEntries(num_entries),
indexingPolicy(indexing_policy),
replacementPolicy(replacement_policy)
indexingPolicy(indexing_policy), replacementPolicy(repl_policy)
{
}
} pcTableInfo;

View File

@@ -31,32 +31,32 @@ from m5.SimObject import SimObject
class BaseReplacementPolicy(SimObject):
type = 'BaseReplacementPolicy'
abstract = True
cxx_class = 'ReplacementPolicy::Base'
cxx_class = 'replacement_policy::Base'
cxx_header = "mem/cache/replacement_policies/base.hh"
class FIFORP(BaseReplacementPolicy):
type = 'FIFORP'
cxx_class = 'ReplacementPolicy::FIFO'
cxx_class = 'replacement_policy::FIFO'
cxx_header = "mem/cache/replacement_policies/fifo_rp.hh"
class SecondChanceRP(FIFORP):
type = 'SecondChanceRP'
cxx_class = 'ReplacementPolicy::SecondChance'
cxx_class = 'replacement_policy::SecondChance'
cxx_header = "mem/cache/replacement_policies/second_chance_rp.hh"
class LFURP(BaseReplacementPolicy):
type = 'LFURP'
cxx_class = 'ReplacementPolicy::LFU'
cxx_class = 'replacement_policy::LFU'
cxx_header = "mem/cache/replacement_policies/lfu_rp.hh"
class LRURP(BaseReplacementPolicy):
type = 'LRURP'
cxx_class = 'ReplacementPolicy::LRU'
cxx_class = 'replacement_policy::LRU'
cxx_header = "mem/cache/replacement_policies/lru_rp.hh"
class BIPRP(LRURP):
type = 'BIPRP'
cxx_class = 'ReplacementPolicy::BIP'
cxx_class = 'replacement_policy::BIP'
cxx_header = "mem/cache/replacement_policies/bip_rp.hh"
btp = Param.Percent(3, "Percentage of blocks to be inserted as MRU")
@@ -65,17 +65,17 @@ class LIPRP(BIPRP):
class MRURP(BaseReplacementPolicy):
type = 'MRURP'
cxx_class = 'ReplacementPolicy::MRU'
cxx_class = 'replacement_policy::MRU'
cxx_header = "mem/cache/replacement_policies/mru_rp.hh"
class RandomRP(BaseReplacementPolicy):
type = 'RandomRP'
cxx_class = 'ReplacementPolicy::Random'
cxx_class = 'replacement_policy::Random'
cxx_header = "mem/cache/replacement_policies/random_rp.hh"
class BRRIPRP(BaseReplacementPolicy):
type = 'BRRIPRP'
cxx_class = 'ReplacementPolicy::BRRIP'
cxx_class = 'replacement_policy::BRRIP'
cxx_header = "mem/cache/replacement_policies/brrip_rp.hh"
num_bits = Param.Int(2, "Number of bits per RRPV")
hit_priority = Param.Bool(False,
@@ -92,11 +92,11 @@ class NRURP(BRRIPRP):
class TreePLRURP(BaseReplacementPolicy):
type = 'TreePLRURP'
cxx_class = 'ReplacementPolicy::TreePLRU'
cxx_class = 'replacement_policy::TreePLRU'
cxx_header = "mem/cache/replacement_policies/tree_plru_rp.hh"
num_leaves = Param.Int(Parent.assoc, "Number of leaves in each tree")
class WeightedLRURP(BaseReplacementPolicy):
type = "WeightedLRURP"
cxx_class = "ReplacementPolicy::WeightedLRU"
cxx_class = "replacement_policy::WeightedLRU"
cxx_header = "mem/cache/replacement_policies/weighted_lru_rp.hh"

View File

@@ -31,6 +31,7 @@
#include <memory>
#include "base/compiler.hh"
#include "mem/cache/replacement_policies/replaceable_entry.hh"
#include "params/BaseReplacementPolicy.hh"
#include "sim/sim_object.hh"
@@ -40,7 +41,9 @@
*/
typedef std::vector<ReplaceableEntry*> ReplacementCandidates;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
/**
* A common base class of cache replacement policy objects.
@@ -93,6 +96,6 @@ class Base : public SimObject
virtual std::shared_ptr<ReplacementData> instantiateEntry() = 0;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_BASE_HH__

View File

@@ -34,7 +34,9 @@
#include "params/BIPRP.hh"
#include "sim/core.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
BIP::BIP(const Params &p)
: LRU(p), btp(p.btp)
@@ -56,4 +58,4 @@ BIP::reset(const std::shared_ptr<ReplacementData>& replacement_data) const
}
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -46,7 +46,9 @@
struct BIPRPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class BIP : public LRU
{
@@ -73,6 +75,6 @@ class BIP : public LRU
override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_BIP_RP_HH__

View File

@@ -35,7 +35,9 @@
#include "base/random.hh"
#include "params/BRRIPRP.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
BRRIP::BRRIP(const Params &p)
: Base(p), numRRPVBits(p.num_bits), hitPriority(p.hit_priority),
@@ -144,4 +146,4 @@ BRRIP::instantiateEntry()
return std::shared_ptr<ReplacementData>(new BRRIPReplData(numRRPVBits));
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -57,7 +57,9 @@
struct BRRIPRPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class BRRIP : public Base
{
@@ -155,6 +157,6 @@ class BRRIP : public Base
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_BRRIP_RP_HH__

View File

@@ -34,7 +34,9 @@
#include "params/FIFORP.hh"
#include "sim/core.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
FIFO::FIFO(const Params &p)
: Base(p)
@@ -91,4 +93,4 @@ FIFO::instantiateEntry()
return std::shared_ptr<ReplacementData>(new FIFOReplData());
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -41,7 +41,9 @@
struct FIFORPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class FIFO : public Base
{
@@ -107,6 +109,6 @@ class FIFO : public Base
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_FIFO_RP_HH__

View File

@@ -33,7 +33,9 @@
#include "params/LFURP.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
LFU::LFU(const Params &p)
: Base(p)
@@ -89,4 +91,4 @@ LFU::instantiateEntry()
return std::shared_ptr<ReplacementData>(new LFUReplData());
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -41,7 +41,9 @@
struct LFURPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class LFU : public Base
{
@@ -107,6 +109,6 @@ class LFU : public Base
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_LFU_RP_HH__

View File

@@ -34,7 +34,9 @@
#include "params/LRURP.hh"
#include "sim/core.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
LRU::LRU(const Params &p)
: Base(p)
@@ -93,4 +95,4 @@ LRU::instantiateEntry()
return std::shared_ptr<ReplacementData>(new LRUReplData());
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -39,7 +39,9 @@
struct LRURPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class LRU : public Base
{
@@ -105,6 +107,6 @@ class LRU : public Base
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_LRU_RP_HH__

View File

@@ -34,7 +34,9 @@
#include "params/MRURP.hh"
#include "sim/core.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
MRU::MRU(const Params &p)
: Base(p)
@@ -98,4 +100,4 @@ MRU::instantiateEntry()
return std::shared_ptr<ReplacementData>(new MRUReplData());
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -41,7 +41,9 @@
struct MRURPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class MRU : public Base
{
@@ -107,6 +109,6 @@ class MRU : public Base
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_MRU_RP_HH__

View File

@@ -34,7 +34,9 @@
#include "base/random.hh"
#include "params/RandomRP.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
Random::Random(const Params &p)
: Base(p)
@@ -92,4 +94,4 @@ Random::instantiateEntry()
return std::shared_ptr<ReplacementData>(new RandomReplData());
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -39,7 +39,9 @@
struct RandomRPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class Random : public Base
{
@@ -108,6 +110,6 @@ class Random : public Base
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_RANDOM_RP_HH__

View File

@@ -32,9 +32,12 @@
#include <cstdint>
#include <memory>
#include "base/compiler.hh"
#include "base/cprintf.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
/**
* The replacement data needed by replacement policies. Each replacement policy
@@ -42,7 +45,7 @@ namespace ReplacementPolicy {
*/
struct ReplacementData {};
} // namespace ReplacementPolicy
} // namespace replacement_policy
/**
* A replaceable entry is a basic entry in a 2d table-like structure that needs
@@ -75,7 +78,7 @@ class ReplaceableEntry
* Replacement data associated to this entry.
* It must be instantiated by the replacement policy before being used.
*/
std::shared_ptr<ReplacementPolicy::ReplacementData> replacementData;
std::shared_ptr<replacement_policy::ReplacementData> replacementData;
/**
* Set both the set and way. Should be called only once.

View File

@@ -32,7 +32,9 @@
#include "params/SecondChanceRP.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
SecondChance::SecondChance(const Params &p)
: FIFO(p)
@@ -133,4 +135,4 @@ SecondChance::instantiateEntry()
return std::shared_ptr<ReplacementData>(new SecondChanceReplData());
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -43,7 +43,9 @@
struct SecondChanceRPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class SecondChance : public FIFO
{
@@ -123,6 +125,6 @@ class SecondChance : public FIFO
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_SECOND_CHANCE_RP_HH__

View File

@@ -40,7 +40,9 @@
#include "base/logging.hh"
#include "params/TreePLRURP.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
/**
* Get the index of the parent of the given indexed subtree.
@@ -211,4 +213,4 @@ TreePLRU::instantiateEntry()
return std::shared_ptr<ReplacementData>(treePLRUReplData);
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -77,7 +77,9 @@
struct TreePLRURPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class TreePLRU : public Base
{
@@ -205,6 +207,6 @@ class TreePLRU : public Base
std::shared_ptr<ReplacementData> instantiateEntry() override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_TREE_PLRU_RP_HH__

View File

@@ -38,7 +38,9 @@
#include "params/WeightedLRURP.hh"
#include "sim/core.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
WeightedLRU::WeightedLRU(const Params &p)
: Base(p)
@@ -121,4 +123,4 @@ WeightedLRU::invalidate(const std::shared_ptr<ReplacementData>&
replacement_data)->last_touch_tick = Tick(0);
}
} // namespace ReplacementPolicy
} // namespace replacement_policy

View File

@@ -41,7 +41,9 @@
struct WeightedLRURPParams;
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class WeightedLRU : public Base
{
@@ -111,6 +113,6 @@ class WeightedLRU : public Base
candidates) const override;
};
} // namespace ReplacementPolicy
} // namespace replacement_policy
#endif // __MEM_CACHE_REPLACEMENT_POLICIES_WEIGHTED_LRU_RP_HH__

View File

@@ -82,7 +82,7 @@ class BaseSetAssoc : public BaseTags
const bool sequentialAccess;
/** Replacement policy */
ReplacementPolicy::Base *replacementPolicy;
replacement_policy::Base *replacementPolicy;
public:
/** Convenience typedef. */

View File

@@ -44,7 +44,9 @@
#include "mem/packet.hh"
#include "params/SectorTags.hh"
namespace ReplacementPolicy {
GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
namespace replacement_policy
{
class Base;
}
class ReplaceableEntry;
@@ -73,7 +75,7 @@ class SectorTags : public BaseTags
const bool sequentialAccess;
/** Replacement policy */
ReplacementPolicy::Base *replacementPolicy;
replacement_policy::Base *replacementPolicy;
/** Number of data blocks per sector. */
const unsigned numBlocksPerSector;

View File

@@ -76,7 +76,7 @@ CacheMemory::CacheMemory(const Params &p)
m_is_instruction_only_cache = p.is_icache;
m_resource_stalls = p.resourceStalls;
m_block_size = p.block_size; // may be 0 at this point. Updated in init()
m_use_occupancy = dynamic_cast<ReplacementPolicy::WeightedLRU*>(
m_use_occupancy = dynamic_cast<replacement_policy::WeightedLRU*>(
m_replacementPolicy_ptr) ? true : false;
}
@@ -381,7 +381,7 @@ CacheMemory::setMRU(Addr address, int occupancy)
// replacement policy. Depending on different replacement policies,
// use different touch() function.
if (m_use_occupancy) {
static_cast<ReplacementPolicy::WeightedLRU*>(
static_cast<replacement_policy::WeightedLRU*>(
m_replacementPolicy_ptr)->touch(
entry->replacementData, occupancy);
} else {

View File

@@ -64,7 +64,7 @@ class CacheMemory : public SimObject
{
public:
typedef RubyCacheParams Params;
typedef std::shared_ptr<ReplacementPolicy::ReplacementData> ReplData;
typedef std::shared_ptr<replacement_policy::ReplacementData> ReplData;
CacheMemory(const Params &p);
~CacheMemory();
@@ -176,7 +176,7 @@ class CacheMemory : public SimObject
std::vector<std::vector<AbstractCacheEntry*> > m_cache;
/** We use the replacement policies from the Classic memory system. */
ReplacementPolicy::Base *m_replacementPolicy_ptr;
replacement_policy::Base *m_replacementPolicy_ptr;
BankedArray dataArray;
BankedArray tagArray;