diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:39 -0500 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:39 -0500 |
commit | d44f2f611ff51941a8702a33a0bc57d7f574e462 (patch) | |
tree | 85928f5bc95981755c11118a62c42fc28e1e6a0f /src/mem/cache/tags/iic_repl | |
parent | 9364d35b8bce516459be09bb13891600921e9e6e (diff) | |
download | gem5-d44f2f611ff51941a8702a33a0bc57d7f574e462.tar.xz |
mem: Remove the IIC replacement policy
The IIC replacement policy seems to be unused and has probably
gathered too much bit rot to be useful. This patch removes the IIC and
its associated cache parameters.
Diffstat (limited to 'src/mem/cache/tags/iic_repl')
-rw-r--r-- | src/mem/cache/tags/iic_repl/Repl.py | 41 | ||||
-rw-r--r-- | src/mem/cache/tags/iic_repl/gen.cc | 207 | ||||
-rw-r--r-- | src/mem/cache/tags/iic_repl/gen.hh | 234 | ||||
-rw-r--r-- | src/mem/cache/tags/iic_repl/repl.hh | 117 |
4 files changed, 0 insertions, 599 deletions
diff --git a/src/mem/cache/tags/iic_repl/Repl.py b/src/mem/cache/tags/iic_repl/Repl.py deleted file mode 100644 index 577eb8fed..000000000 --- a/src/mem/cache/tags/iic_repl/Repl.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2005-2008 The Regents of The University of Michigan -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer; -# redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution; -# neither the name of the copyright holders nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# Authors: Nathan Binkert - -from m5.SimObject import SimObject -from m5.params import * -class Repl(SimObject): - type = 'Repl' - abstract = True - cxx_header = "mem/cache/tags/iic_repl/repl.hh" - -class GenRepl(Repl): - type = 'GenRepl' - cxx_header = "mem/cache/tags/iic_repl/gen.hh" - fresh_res = Param.Int("Fresh pool residency time") - num_pools = Param.Int("Number of priority pools") - pool_res = Param.Int("Pool residency time") diff --git a/src/mem/cache/tags/iic_repl/gen.cc b/src/mem/cache/tags/iic_repl/gen.cc deleted file mode 100644 index 3212b74ab..000000000 --- a/src/mem/cache/tags/iic_repl/gen.cc +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2002-2005 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Erik Hallnor - * Steve Reinhardt - */ - -/** - * @file - * Definitions of the Generational replacement policy. - */ - -#include <string> - -#include "base/misc.hh" -#include "base/types.hh" -#include "mem/cache/tags/iic_repl/gen.hh" -#include "mem/cache/tags/iic.hh" -#include "params/GenRepl.hh" - -using namespace std; - -GenRepl::GenRepl(const Params *p) // fix this, should be set by cache - : Repl(p), num_pools(p->num_pools), fresh_res(p->fresh_res), - pool_res(p->pool_res), num_entries(0), num_pool_entries(0), misses(0), - pools(new GenPool[num_pools+1]) -{ -} - -GenRepl::~GenRepl() -{ - delete [] pools; -} - -unsigned long -GenRepl::getRepl() -{ - unsigned long tmp; - GenReplEntry *re; - int i; - int num_seen = 0; - if (!(num_pool_entries>0)) { - fatal("No blks available to replace"); - } - num_entries--; - num_pool_entries--; - for (i = 0; i < num_pools; i++) { - while ((re = pools[i].pop())) { - num_seen++; - // Remove invalidated entries - if (!re->valid) { - delete re; - continue; - } - if (iic->clearRef(re->tag_ptr)) { - pools[(((i+1)== num_pools)? i :i+1)].push(re, misses); - } - else { - tmp = re->tag_ptr; - delete re; - - repl_pool.sample(i); - - return tmp; - } - } - } - fatal("No replacement found"); - return 0xffffffff; -} - -void -GenRepl::doAdvance(std::list<unsigned long> &demoted) -{ - int i; - int num_seen = 0; - GenReplEntry *re; - misses++; - for (i=0; i<num_pools; i++) { - while (misses-pools[i].oldest > pool_res && (re = pools[i].pop())!=NULL) { - if (iic->clearRef(re->tag_ptr)) { - pools[(((i+1)== num_pools)? i :i+1)].push(re, misses); - /** @todo Not really demoted, but use it for now. */ - demoted.push_back(re->tag_ptr); - advance_pool.sample(i); - } - else { - pools[(((i-1)<0)?i:i-1)].push(re, misses); - demoted.push_back(re->tag_ptr); - demote_pool.sample(i); - } - } - num_seen += pools[i].size; - } - while (misses-pools[num_pools].oldest > fresh_res - && (re = pools[num_pools].pop())!=NULL) { - num_pool_entries++; - if (iic->clearRef(re->tag_ptr)) { - pools[num_pools/2].push(re, misses); - /** @todo Not really demoted, but use it for now. */ - demoted.push_back(re->tag_ptr); - advance_pool.sample(num_pools); - } - else { - pools[num_pools/2-1].push(re, misses); - demoted.push_back(re->tag_ptr); - demote_pool.sample(num_pools); - } - } -} - -void* -GenRepl::add(unsigned long tag_index) -{ - GenReplEntry *re = new GenReplEntry; - re->tag_ptr = tag_index; - re->valid = true; - pools[num_pools].push(re, misses); - num_entries++; - return (void*)re; -} - -void -GenRepl::regStatsWithSuffix(const string name) -{ - using namespace Stats; - - /** GEN statistics */ - repl_pool - .init(0, 16, 1) - .name(name + ".repl_pool_dist") - .desc("Dist. of Repl. across pools") - .flags(pdf) - ; - - advance_pool - .init(0, 16, 1) - .name(name + ".advance_pool_dist") - .desc("Dist. of Repl. across pools") - .flags(pdf) - ; - - demote_pool - .init(0, 16, 1) - .name(name + ".demote_pool_dist") - .desc("Dist. of Repl. across pools") - .flags(pdf) - ; -} - -int -GenRepl::fixTag(void* _re, unsigned long old_index, unsigned long new_index) -{ - GenReplEntry *re = (GenReplEntry*)_re; - assert(re->valid); - if (re->tag_ptr == old_index) { - re->tag_ptr = new_index; - return 1; - } - fatal("Repl entry: tag ptrs do not match"); - return 0; -} - -bool -GenRepl::findTagPtr(unsigned long index) -{ - for (int i = 0; i < num_pools + 1; ++i) { - list<GenReplEntry*>::const_iterator iter = pools[i].entries.begin(); - list<GenReplEntry*>::const_iterator end = pools[i].entries.end(); - for (; iter != end; ++iter) { - if ((*iter)->valid && (*iter)->tag_ptr == index) { - return true; - } - } - } - return false; -} - -GenRepl * -GenReplParams::create() -{ - return new GenRepl(this); -} diff --git a/src/mem/cache/tags/iic_repl/gen.hh b/src/mem/cache/tags/iic_repl/gen.hh deleted file mode 100644 index 2e817d847..000000000 --- a/src/mem/cache/tags/iic_repl/gen.hh +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2002-2005 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Erik Hallnor - */ - -/** - * @file - * Declarations of generational replacement policy - */ - -#ifndef ___GEN_HH__ -#define __GEN_HH__ - -#include <list> - -#include "base/statistics.hh" -#include "mem/cache/tags/iic_repl/repl.hh" -#include "params/GenRepl.hh" - -/** - * Generational Replacement entry. - */ -class GenReplEntry -{ - public: - /** Valid flag, used to quickly invalidate bogus entries. */ - bool valid; - /** The difference between this entry and the previous in the pool. */ - int delta; - /** Pointer to the corresponding tag in the IIC. */ - unsigned long tag_ptr; -}; - -/** - * Generational replacement pool - */ -class GenPool -{ - public: - /** The time the last entry was added. */ - Tick newest; - /** The time the oldest entry was added. */ - Tick oldest; - /** List of the replacement entries in this pool. */ - std::list<GenReplEntry*> entries; - - /** The number of entries in this pool. */ - int size; - - /** - * Simple constructor. - */ - GenPool() { - newest = 0; - oldest = 0; - size = 0; - } - - /** - * Add an entry to this pool. - * @param re The entry to add. - * @param now The current time. - */ - void push(GenReplEntry *re, Tick now) { - ++size; - if (!entries.empty()) { - re->delta = now - newest; - newest = now; - } else { - re->delta = 0; - newest = oldest = now; - } - entries.push_back(re); - } - - /** - * Remove an entry from the pool. - * @return The entry at the front of the list. - */ - GenReplEntry* pop() { - GenReplEntry *tmp = NULL; - if (!entries.empty()) { - --size; - tmp = entries.front(); - entries.pop_front(); - oldest += tmp->delta; - } - return tmp; - } - - /** - * Return the entry at the front of the list. - * @return the entry at the front of the list. - */ - GenReplEntry* top() { - return entries.front(); - } - - /** - * Destructor. - */ - ~GenPool() { - while (!entries.empty()) { - GenReplEntry *tmp = entries.front(); - entries.pop_front(); - delete tmp; - } - } -}; - -/** - * Generational replacement policy for use with the IIC. - * @todo update to use STL and for efficiency - */ -class GenRepl : public Repl -{ - public: - /** The number of pools. */ - int num_pools; - /** The amount of time to stay in the fresh pool. */ - int fresh_res; - /** The amount of time to stay in the normal pools. */ - int pool_res; - /** The maximum number of entries */ - int num_entries; - /** The number of entries currently in the pools. */ - int num_pool_entries; - /** The number of misses. Used as the internal time. */ - Tick misses; - /** The array of pools. */ - GenPool *pools; - - // Statistics - - /** - * @addtogroup CacheStatistics - * @{ - */ - /** The number of replacements from each pool. */ - Stats::Distribution repl_pool; - /** The number of advances out of each pool. */ - Stats::Distribution advance_pool; - /** The number of demotions from each pool. */ - Stats::Distribution demote_pool; - /** - * @} - */ - - typedef GenReplParams Params; - GenRepl(const Params *p); - - /** - * Destructor. - */ - ~GenRepl(); - - /** - * Returns the tag pointer of the cache block to replace. - * @return The tag to replace. - */ - virtual unsigned long getRepl(); - - /** - * Update replacement data - */ - virtual void doAdvance(std::list<unsigned long> &demoted); - - /** - * Add a tag to the replacement policy and return a pointer to the - * replacement entry. - * @param tag_index The tag to add. - * @return The replacement entry. - */ - virtual void* add(unsigned long tag_index); - - /** - * Register statistics. - * @param name The name to prepend to statistic descriptions. - */ - virtual void regStatsWithSuffix(const std::string name); - - /** - * Update the tag pointer to when the tag moves. - * @param re The replacement entry of the tag. - * @param old_index The old tag pointer. - * @param new_index The new tag pointer. - * @return 1 if successful, 0 otherwise. - */ - virtual int fixTag(void *re, unsigned long old_index, - unsigned long new_index); - - /** - * Remove this entry from the replacement policy. - * @param re The replacement entry to remove - */ - virtual void removeEntry(void *re) - { - ((GenReplEntry*)re)->valid = false; - } - - protected: - /** - * Debug function to verify that there is only one repl entry per tag. - * @param index The tag index to check. - */ - bool findTagPtr(unsigned long index); -}; - -#endif /* __GEN_HH__ */ diff --git a/src/mem/cache/tags/iic_repl/repl.hh b/src/mem/cache/tags/iic_repl/repl.hh deleted file mode 100644 index dd25842a0..000000000 --- a/src/mem/cache/tags/iic_repl/repl.hh +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2002-2005 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Erik Hallnor - * Steve Reinhardt - * Nathan Binkert - */ - -/** - * @file - * Declaration of a base replacement policy class. - */ - -#ifndef __REPL_HH__ -#define __REPL_HH__ - -#include <list> -#include <string> - -#include "base/types.hh" -#include "cpu/smt.hh" -#include "sim/sim_object.hh" - -class IIC; - -/** - * A pure virtual base class that defines the interface of a replacement - * policy. - */ -class Repl : public SimObject -{ - public: - /** Pointer to the IIC using this policy. */ - IIC *iic; - - Repl (const Params *params) - : SimObject(params) - { - iic = NULL; - } - - /** - * Set the back pointer to the IIC. - * @param iic_ptr Pointer to the IIC. - */ - void setIIC(IIC *iic_ptr) - { - iic = iic_ptr; - } - - /** - * Returns the tag pointer of the cache block to replace. - * @return The tag to replace. - */ - virtual unsigned long getRepl() = 0; - - /** - * Update replacement data - */ - virtual void doAdvance(std::list<unsigned long> &demoted) = 0; - - /** - * Add a tag to the replacement policy and return a pointer to the - * replacement entry. - * @param tag_index The tag to add. - * @return The replacement entry. - */ - virtual void* add(unsigned long tag_index) = 0; - - /** - * Register statistics. - * @param name The name to prepend to statistic descriptions. - */ - virtual void regStatsWithSuffix(const std::string name) = 0; - - /** - * Update the tag pointer to when the tag moves. - * @param re The replacement entry of the tag. - * @param old_index The old tag pointer. - * @param new_index The new tag pointer. - * @return 1 if successful, 0 otherwise. - */ - virtual int fixTag(void *re, unsigned long old_index, - unsigned long new_index) = 0; - - /** - * Remove this entry from the replacement policy. - * @param re The replacement entry to remove - */ - virtual void removeEntry(void *re) = 0; -}; - -#endif /* SMT_REPL_HH */ |