45#include "params/MaxCapacityPartitioningPolicy.hh"
50namespace partitioning_policy
54 (
const MaxCapacityPartitioningPolicyParams ¶ms):
56 totalBlockCount(params.cache_size / params.blk_size),
57 partitionIDs(params.partition_ids),
58 capacities(params.capacities)
61 if (this->
partitionIDs.size() != this->capacities.size()) {
62 fatal(
"MaxCapacity Partitioning Policy configuration invalid: ids and "
63 "capacities arrays are not equal lengths");
81 panic_if(!(cap_frac >= 0 && cap_frac <= 1),
82 "MaxCapacity Partitioning Policy for PartitionID %d has "
83 "Capacity Fraction %f outside of [0,1] range", partition_id,
89 DPRINTF(PartitionPolicy,
"Configured MaxCapacity Partitioning Policy "
90 "for PartitionID: %d to use portion of size %f (%d cache blocks "
91 "of %d total)\n", partition_id, cap_frac, allocated_block_cnt,
98 const uint64_t
id)
const
112 entries.erase(std::remove_if(entries.begin(), entries.end(),
114 CacheBlk *blk = static_cast<CacheBlk *>(entry);
115 return blk->getPartitionId() != id;
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
A Partitioning Policy is a cache partitioning mechanism that limits the cache block allocations in a ...
void notifyAcquire(const uint64_t partition_id) override
Notify of acquisition of ownership of a cache line.
void notifyRelease(const uint64_t partition_id) override
Notify of release of ownership of a cache line.
std::unordered_map< uint64_t, uint64_t > partitionIdMaxCapacity
Map of PartitionIDs and maximum allocatable cache block counts; On evictions full partitions are prio...
void configurePartition(uint64_t partition_id, double cap_frac)
Set the maximum capacity (as a fraction) for the provided partition.
std::unordered_map< uint64_t, uint64_t > partitionIdCurCapacity
Map of PartitionIDs and currently allocated blck coutns.
const uint64_t totalBlockCount
Total number of cache blocks.
const std::vector< uint64_t > partitionIDs
Vector of partitionIDs the policy operates on.
MaxCapacityPartitioningPolicy(const MaxCapacityPartitioningPolicyParams ¶ms)
const std::vector< double > capacities
Vector of capacity fractions to enforce on the policied partitionIDs.
void filterByPartition(std::vector< ReplaceableEntry * > &entries, const uint64_t partition_id) const override
Filters the allocatable cache blocks for a memory request based on its PartitionID and policy allocat...
#define fatal(...)
This implements a cprintf based fatal() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Copyright (c) 2024 Arm Limited All rights reserved.