36#include "params/BRRIPRP.hh"
41namespace replacement_policy
45 :
Base(
p), numRRPVBits(
p.num_bits), hitPriority(
p.hit_priority),
54 std::shared_ptr<BRRIPReplData> casted_replacement_data =
55 std::static_pointer_cast<BRRIPReplData>(replacement_data);
58 casted_replacement_data->valid =
false;
62BRRIP::touch(
const std::shared_ptr<ReplacementData>& replacement_data)
const
64 std::shared_ptr<BRRIPReplData> casted_replacement_data =
65 std::static_pointer_cast<BRRIPReplData>(replacement_data);
71 casted_replacement_data->rrpv.reset();
73 casted_replacement_data->rrpv--;
78BRRIP::reset(
const std::shared_ptr<ReplacementData>& replacement_data)
const
80 std::shared_ptr<BRRIPReplData> casted_replacement_data =
81 std::static_pointer_cast<BRRIPReplData>(replacement_data);
86 casted_replacement_data->rrpv.saturate();
88 casted_replacement_data->rrpv--;
92 casted_replacement_data->valid =
true;
99 assert(candidates.size() > 0);
105 int victim_RRPV = std::static_pointer_cast<BRRIPReplData>(
109 for (
const auto& candidate : candidates) {
110 std::shared_ptr<BRRIPReplData> candidate_repl_data =
111 std::static_pointer_cast<BRRIPReplData>(
112 candidate->replacementData);
115 if (!candidate_repl_data->valid) {
120 int candidate_RRPV = candidate_repl_data->rrpv;
121 if (candidate_RRPV > victim_RRPV) {
123 victim_RRPV = candidate_RRPV;
129 int diff = std::static_pointer_cast<BRRIPReplData>(
135 for (
const auto& candidate : candidates) {
136 std::static_pointer_cast<BRRIPReplData>(
137 candidate->replacementData)->rrpv += diff;
144std::shared_ptr<ReplacementData>
Copyright (c) 2018-2020 Inria All rights reserved.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const override
Find replacement victim using rrpv.
const unsigned numRRPVBits
Number of RRPV bits.
void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) override
Invalidate replacement data to set it as the next probable victim.
void touch(const std::shared_ptr< ReplacementData > &replacement_data) const override
Touch an entry to update its replacement data.
void reset(const std::shared_ptr< ReplacementData > &replacement_data) const override
Reset replacement data.
const bool hitPriority
The hit priority (HP) policy replaces entries that do not receive cache hits over any cache entry tha...
const unsigned btp
Bimodal throtle parameter.
std::shared_ptr< ReplacementData > instantiateEntry() override
Instantiate a replacement data entry.
A common base class of cache replacement policy objects.
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
BRRIP-specific implementation of replacement data.