From 4ed2c5f7456b95d40623fc7e7a95177614b68e50 Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Wed, 8 May 2019 11:54:41 +0200 Subject: [PATCH] mem-ruby: Standardize Bloom Filter deletion support Standard Bloom Filters do not support element deletion by default, however some variants do. Allow calling the unset function with all filters, and do nothing by default. Change-Id: Icf4b0f8b997c4c70fa714b2576474810275db78b Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18730 Maintainer: Nikos Nikoleris Tested-by: kokoro Reviewed-by: Nikos Nikoleris --- src/mem/ruby/filters/AbstractBloomFilter.hh | 10 +++++++++- src/mem/ruby/filters/BlockBloomFilter.hh | 2 +- src/mem/ruby/filters/BulkBloomFilter.cc | 6 ------ src/mem/ruby/filters/BulkBloomFilter.hh | 1 - src/mem/ruby/filters/H3BloomFilter.cc | 6 ------ src/mem/ruby/filters/H3BloomFilter.hh | 1 - src/mem/ruby/filters/LSB_CountingBloomFilter.hh | 2 +- src/mem/ruby/filters/MultiBitSelBloomFilter.cc | 6 ------ src/mem/ruby/filters/MultiBitSelBloomFilter.hh | 1 - src/mem/ruby/filters/MultiGrainBloomFilter.cc | 6 ------ src/mem/ruby/filters/MultiGrainBloomFilter.hh | 1 - src/mem/ruby/filters/NonCountingBloomFilter.hh | 2 +- 12 files changed, 12 insertions(+), 32 deletions(-) diff --git a/src/mem/ruby/filters/AbstractBloomFilter.hh b/src/mem/ruby/filters/AbstractBloomFilter.hh index 51c5e92b2..6da4a9d53 100644 --- a/src/mem/ruby/filters/AbstractBloomFilter.hh +++ b/src/mem/ruby/filters/AbstractBloomFilter.hh @@ -40,7 +40,15 @@ class AbstractBloomFilter virtual void clear() = 0; virtual void merge(AbstractBloomFilter * other_filter) = 0; virtual void set(Addr addr) = 0; - virtual void unset(Addr addr) = 0; + + /** + * Perform the filter specific function to clear the corresponding + * entries (can be multiple) of an address. By default a bloom + * filter does not support element deletion. + * + * @param addr The address being parsed. + */ + virtual void unset(Addr addr) {}; virtual bool isSet(Addr addr) = 0; virtual int getCount(Addr addr) = 0; diff --git a/src/mem/ruby/filters/BlockBloomFilter.hh b/src/mem/ruby/filters/BlockBloomFilter.hh index bd24aa66a..d015e1e0e 100644 --- a/src/mem/ruby/filters/BlockBloomFilter.hh +++ b/src/mem/ruby/filters/BlockBloomFilter.hh @@ -44,7 +44,7 @@ class BlockBloomFilter : public AbstractBloomFilter void clear(); void merge(AbstractBloomFilter * other_filter); void set(Addr addr); - void unset(Addr addr); + void unset(Addr addr) override; bool isSet(Addr addr); int getCount(Addr addr); diff --git a/src/mem/ruby/filters/BulkBloomFilter.cc b/src/mem/ruby/filters/BulkBloomFilter.cc index 4a80d538a..a7e02781f 100644 --- a/src/mem/ruby/filters/BulkBloomFilter.cc +++ b/src/mem/ruby/filters/BulkBloomFilter.cc @@ -91,12 +91,6 @@ BulkBloomFilter::set(Addr addr) m_filter[c1] = 1; } -void -BulkBloomFilter::unset(Addr addr) -{ - // not used -} - bool BulkBloomFilter::isSet(Addr addr) { diff --git a/src/mem/ruby/filters/BulkBloomFilter.hh b/src/mem/ruby/filters/BulkBloomFilter.hh index 231622125..683bbe14c 100644 --- a/src/mem/ruby/filters/BulkBloomFilter.hh +++ b/src/mem/ruby/filters/BulkBloomFilter.hh @@ -44,7 +44,6 @@ class BulkBloomFilter : public AbstractBloomFilter void clear(); void merge(AbstractBloomFilter * other_filter); void set(Addr addr); - void unset(Addr addr); bool isSet(Addr addr); int getCount(Addr addr); diff --git a/src/mem/ruby/filters/H3BloomFilter.cc b/src/mem/ruby/filters/H3BloomFilter.cc index 91aa16857..6fa182f9a 100644 --- a/src/mem/ruby/filters/H3BloomFilter.cc +++ b/src/mem/ruby/filters/H3BloomFilter.cc @@ -423,12 +423,6 @@ H3BloomFilter::set(Addr addr) } } -void -H3BloomFilter::unset(Addr addr) -{ - panic("ERROR: Unset should never be called in a Bloom filter"); -} - bool H3BloomFilter::isSet(Addr addr) { diff --git a/src/mem/ruby/filters/H3BloomFilter.hh b/src/mem/ruby/filters/H3BloomFilter.hh index efbdec341..b9890e7b6 100644 --- a/src/mem/ruby/filters/H3BloomFilter.hh +++ b/src/mem/ruby/filters/H3BloomFilter.hh @@ -44,7 +44,6 @@ class H3BloomFilter : public AbstractBloomFilter void clear(); void merge(AbstractBloomFilter * other_filter); void set(Addr addr); - void unset(Addr addr); bool isSet(Addr addr); int getCount(Addr addr); diff --git a/src/mem/ruby/filters/LSB_CountingBloomFilter.hh b/src/mem/ruby/filters/LSB_CountingBloomFilter.hh index 48e83805a..03602a381 100644 --- a/src/mem/ruby/filters/LSB_CountingBloomFilter.hh +++ b/src/mem/ruby/filters/LSB_CountingBloomFilter.hh @@ -44,7 +44,7 @@ class LSB_CountingBloomFilter : public AbstractBloomFilter void clear(); void merge(AbstractBloomFilter * other_filter); void set(Addr addr); - void unset(Addr addr); + void unset(Addr addr) override; bool isSet(Addr addr); int getCount(Addr addr); diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc index f46442ece..3dc392f8b 100644 --- a/src/mem/ruby/filters/MultiBitSelBloomFilter.cc +++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.cc @@ -78,12 +78,6 @@ MultiBitSelBloomFilter::set(Addr addr) } } -void -MultiBitSelBloomFilter::unset(Addr addr) -{ - panic("ERROR: Unset should never be called in a Bloom filter"); -} - bool MultiBitSelBloomFilter::isSet(Addr addr) { diff --git a/src/mem/ruby/filters/MultiBitSelBloomFilter.hh b/src/mem/ruby/filters/MultiBitSelBloomFilter.hh index 315e2725f..1f652b2a4 100644 --- a/src/mem/ruby/filters/MultiBitSelBloomFilter.hh +++ b/src/mem/ruby/filters/MultiBitSelBloomFilter.hh @@ -46,7 +46,6 @@ class MultiBitSelBloomFilter : public AbstractBloomFilter void clear(); void merge(AbstractBloomFilter * other_filter); void set(Addr addr); - void unset(Addr addr); bool isSet(Addr addr); int getCount(Addr addr); diff --git a/src/mem/ruby/filters/MultiGrainBloomFilter.cc b/src/mem/ruby/filters/MultiGrainBloomFilter.cc index 5f541b5a8..fef8fa820 100644 --- a/src/mem/ruby/filters/MultiGrainBloomFilter.cc +++ b/src/mem/ruby/filters/MultiGrainBloomFilter.cc @@ -81,12 +81,6 @@ MultiGrainBloomFilter::set(Addr addr) } -void -MultiGrainBloomFilter::unset(Addr addr) -{ - // not used -} - bool MultiGrainBloomFilter::isSet(Addr addr) { diff --git a/src/mem/ruby/filters/MultiGrainBloomFilter.hh b/src/mem/ruby/filters/MultiGrainBloomFilter.hh index 8bfd39b46..c2329273f 100644 --- a/src/mem/ruby/filters/MultiGrainBloomFilter.hh +++ b/src/mem/ruby/filters/MultiGrainBloomFilter.hh @@ -44,7 +44,6 @@ class MultiGrainBloomFilter : public AbstractBloomFilter void clear(); void merge(AbstractBloomFilter * other_filter); void set(Addr addr); - void unset(Addr addr); bool isSet(Addr addr); int getCount(Addr addr); diff --git a/src/mem/ruby/filters/NonCountingBloomFilter.hh b/src/mem/ruby/filters/NonCountingBloomFilter.hh index bdd05db3a..9d1ad0067 100644 --- a/src/mem/ruby/filters/NonCountingBloomFilter.hh +++ b/src/mem/ruby/filters/NonCountingBloomFilter.hh @@ -44,7 +44,7 @@ class NonCountingBloomFilter : public AbstractBloomFilter void clear(); void merge(AbstractBloomFilter * other_filter); void set(Addr addr); - void unset(Addr addr); + void unset(Addr addr) override; bool isSet(Addr addr); int getCount(Addr addr); -- 2.30.2