mem-ruby: Remove NonCountingBloomFilter

Make BlockBloomFilter accept having a single bitfield, in which
case it behaves exactly as the NonCountingBloomFilter, and thus
the latter can be removed.

Change-Id: I56d96a89290c933293ce434bbe0e8bcd4bbcaa42
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18871
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-05-09 22:51:48 +02:00
committed by Daniel Carvalho
parent cbf8f7019c
commit a6643d6174
5 changed files with 2 additions and 150 deletions

View File

@@ -38,8 +38,8 @@ BlockBloomFilter::BlockBloomFilter(const BlockBloomFilterParams* p)
{
fatal_if(masksLSBs.size() != masksSizes.size(),
"Masks haven't been properly provided");
fatal_if(masksLSBs.size() < 2,
"There must be at least two masks to XOR");
fatal_if(masksLSBs.size() < 1,
"There must be at least one mask to extract an address bitfield");
for (int i = 0; i < masksLSBs.size(); i++) {
fatal_if((masksSizes[i] > sizeBits) || (masksSizes[i] <= 0),

View File

@@ -105,10 +105,3 @@ class MultiGrainBloomFilter(AbstractBloomFilter):
# By default match this with the number of sub-filters
threshold = 2
class NonCountingBloomFilter(AbstractBloomFilter):
type = 'NonCountingBloomFilter'
cxx_class = 'NonCountingBloomFilter'
cxx_header = "mem/ruby/filters/NonCountingBloomFilter.hh"
skip_bits = Param.Int(2, "Offset from block number")

View File

@@ -1,82 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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.
*/
#include "mem/ruby/filters/NonCountingBloomFilter.hh"
#include "base/bitfield.hh"
#include "params/NonCountingBloomFilter.hh"
NonCountingBloomFilter::NonCountingBloomFilter(
const NonCountingBloomFilterParams* p)
: AbstractBloomFilter(p), skipBits(p->skip_bits)
{
}
NonCountingBloomFilter::~NonCountingBloomFilter()
{
}
void
NonCountingBloomFilter::merge(const AbstractBloomFilter *other)
{
auto* cast_other = static_cast<const NonCountingBloomFilter*>(other);
assert(filter.size() == cast_other->filter.size());
for (int i = 0; i < filter.size(); ++i){
filter[i] |= cast_other->filter[i];
}
}
void
NonCountingBloomFilter::set(Addr addr)
{
filter[hash(addr)] = 1;
}
void
NonCountingBloomFilter::unset(Addr addr)
{
filter[hash(addr)] = 0;
}
int
NonCountingBloomFilter::getCount(Addr addr) const
{
return filter[hash(addr)];
}
int
NonCountingBloomFilter::hash(Addr addr) const
{
return bits(addr, offsetBits + skipBits + sizeBits - 1, offsetBits + skipBits);
}
NonCountingBloomFilter*
NonCountingBloomFilterParams::create()
{
return new NonCountingBloomFilter(this);
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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.
*/
#ifndef __MEM_RUBY_FILTERS_NONCOUNTINGBLOOMFILTER_HH__
#define __MEM_RUBY_FILTERS_NONCOUNTINGBLOOMFILTER_HH__
#include "mem/ruby/filters/AbstractBloomFilter.hh"
struct NonCountingBloomFilterParams;
class NonCountingBloomFilter : public AbstractBloomFilter
{
public:
NonCountingBloomFilter(const NonCountingBloomFilterParams* p);
~NonCountingBloomFilter();
void merge(const AbstractBloomFilter* other) override;
void set(Addr addr) override;
void unset(Addr addr) override;
int getCount(Addr addr) const override;
private:
int hash(Addr addr) const;
/**
* Bit offset from block number. Used to simulate bit selection hashing
* on larger than cache-line granularities, by skipping some bits.
*/
int skipBits;
};
#endif // __MEM_RUBY_FILTERS_NONCOUNTINGBLOOMFILTER_HH__

View File

@@ -41,4 +41,3 @@ Source('H3BloomFilter.cc')
Source('LSB_CountingBloomFilter.cc')
Source('MultiBitSelBloomFilter.cc')
Source('MultiGrainBloomFilter.cc')
Source('NonCountingBloomFilter.cc')