mem-ruby: Remove Bloom Filters' ruby dependency
Substitute the common ruby header by base's bitfield to eliminate all ruby dependency in Bloom Filters. As a side note, BulkBloomFilter now assumes addresses are 64 bit long. Change-Id: Ibdb1f926ddcc06c848851c1e6a34863541808360 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18738 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com> Maintainer: Anthony Gutierrez <anthony.gutierrez@amd.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
24ff97e0d7
commit
97863a8209
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "mem/ruby/filters/BlockBloomFilter.hh"
|
||||
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include "base/bitfield.hh"
|
||||
#include "params/BlockBloomFilter.hh"
|
||||
|
||||
BlockBloomFilter::BlockBloomFilter(const BlockBloomFilterParams* p)
|
||||
@@ -64,10 +64,10 @@ BlockBloomFilter::hash(Addr addr) const
|
||||
// Pull out some bit field ==> B1
|
||||
// Pull out additional bits, not the same as B1 ==> B2
|
||||
// XOR B1 and B2 to get hash index
|
||||
Addr block_bits = bitSelect(addr, offsetBits, 2 * offsetBits - 1);
|
||||
Addr block_bits = bits(addr, 2 * offsetBits - 1, offsetBits);
|
||||
int offset = 5;
|
||||
Addr other_bits = bitSelect(addr, 2 * offsetBits + offset,
|
||||
2 * offsetBits + offset + sizeBits - 1);
|
||||
Addr other_bits = bits(addr, 2 * offsetBits + offset + sizeBits - 1,
|
||||
2 * offsetBits + offset);
|
||||
int index = block_bits ^ other_bits;
|
||||
assert(index < filter.size());
|
||||
return index;
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
#include "mem/ruby/filters/BulkBloomFilter.hh"
|
||||
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include <limits>
|
||||
|
||||
#include "base/bitfield.hh"
|
||||
#include "params/BulkBloomFilter.hh"
|
||||
|
||||
BulkBloomFilter::BulkBloomFilter(const BulkBloomFilterParams* p)
|
||||
@@ -44,12 +46,11 @@ void
|
||||
BulkBloomFilter::set(Addr addr)
|
||||
{
|
||||
// c0 contains the cache index bits
|
||||
int set_bits = sectorBits;
|
||||
int c0 = bitSelect(addr, offsetBits, offsetBits + set_bits - 1);
|
||||
int c0 = bits(addr, offsetBits + sectorBits - 1, offsetBits);
|
||||
// c1 contains the lower sectorBits permuted bits
|
||||
//Address permuted_bits = permute(addr);
|
||||
//int c1 = permuted_bits.bitSelect(0, set_bits-1);
|
||||
int c1 = bitSelect(addr, offsetBits+set_bits, (offsetBits+2*set_bits) - 1);
|
||||
int c1 = bits(addr, (offsetBits + 2 * sectorBits) - 1,
|
||||
offsetBits + sectorBits);
|
||||
//assert(c0 < (filter_size/2));
|
||||
//assert(c0 + (filter_size/2) < filter_size);
|
||||
//assert(c1 < (filter_size/2));
|
||||
@@ -64,12 +65,11 @@ BulkBloomFilter::isSet(Addr addr) const
|
||||
{
|
||||
// c0 contains the cache index bits
|
||||
const int filter_size = filter.size();
|
||||
int set_bits = sectorBits;
|
||||
int c0 = bitSelect(addr, offsetBits, offsetBits + set_bits - 1);
|
||||
int c0 = bits(addr, offsetBits + sectorBits - 1, offsetBits);
|
||||
// c1 contains the lower 10 permuted bits
|
||||
//Address permuted_bits = permute(addr);
|
||||
//int c1 = permuted_bits.bitSelect(0, set_bits-1);
|
||||
int c1 = bitSelect(addr, offsetBits+set_bits, (offsetBits+2*set_bits) - 1);
|
||||
int c1 = bits(addr, (offsetBits + 2 * sectorBits) - 1,
|
||||
offsetBits + sectorBits);
|
||||
//assert(c0 < (filter_size/2));
|
||||
//assert(c0 + (filter_size/2) < filter_size);
|
||||
//assert(c1 < (filter_size/2));
|
||||
@@ -127,27 +127,26 @@ Addr
|
||||
BulkBloomFilter::hash(Addr addr) const
|
||||
{
|
||||
// permutes the original address bits according to Table 5
|
||||
Addr part1 = bitSelect(addr, offsetBits, offsetBits + 6),
|
||||
part2 = bitSelect(addr, offsetBits + 9, offsetBits + 9),
|
||||
part3 = bitSelect(addr, offsetBits + 11, offsetBits + 11),
|
||||
part4 = bitSelect(addr, offsetBits + 17, offsetBits + 17),
|
||||
part5 = bitSelect(addr, offsetBits + 7, offsetBits + 8),
|
||||
part6 = bitSelect(addr, offsetBits + 10, offsetBits + 10),
|
||||
part7 = bitSelect(addr, offsetBits + 12, offsetBits + 12),
|
||||
part8 = bitSelect(addr, offsetBits + 13, offsetBits + 13),
|
||||
part9 = bitSelect(addr, offsetBits + 15, offsetBits + 16),
|
||||
part10 = bitSelect(addr, offsetBits + 18, offsetBits + 20),
|
||||
part11 = bitSelect(addr, offsetBits + 14, offsetBits + 14);
|
||||
Addr part1 = bits(addr, offsetBits + 6, offsetBits),
|
||||
part2 = bits(addr, offsetBits + 9),
|
||||
part3 = bits(addr, offsetBits + 11),
|
||||
part4 = bits(addr, offsetBits + 17),
|
||||
part5 = bits(addr, offsetBits + 8, offsetBits + 7),
|
||||
part6 = bits(addr, offsetBits + 10),
|
||||
part7 = bits(addr, offsetBits + 12),
|
||||
part8 = bits(addr, offsetBits + 13),
|
||||
part9 = bits(addr, offsetBits + 16, offsetBits + 15),
|
||||
part10 = bits(addr, offsetBits + 20, offsetBits + 18),
|
||||
part11 = bits(addr, offsetBits + 14);
|
||||
|
||||
Addr result =
|
||||
(part1 << 14) | (part2 << 13) | (part3 << 12) | (part4 << 11) |
|
||||
(part5 << 9) | (part6 << 8) | (part7 << 7) | (part8 << 6) |
|
||||
(part9 << 4) | (part10 << 1) | (part11);
|
||||
|
||||
// assume 32 bit addresses (both virtual and physical)
|
||||
// select the remaining high-order 11 bits
|
||||
Addr remaining_bits =
|
||||
bitSelect(addr, offsetBits + 21, 31) << 21;
|
||||
// Select the remaining high-order bits
|
||||
Addr remaining_bits = bits(addr, std::numeric_limits<Addr>::digits - 1,
|
||||
offsetBits + 21) << 21;
|
||||
result = result | remaining_bits;
|
||||
|
||||
return result;
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
|
||||
#include "mem/ruby/filters/H3BloomFilter.hh"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "base/logging.hh"
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include "base/bitfield.hh"
|
||||
#include "params/H3BloomFilter.hh"
|
||||
|
||||
static int H3[64][16] = {
|
||||
@@ -396,7 +398,7 @@ H3BloomFilter::getCount(Addr addr) const
|
||||
int
|
||||
H3BloomFilter::hash(Addr addr, int hash_number) const
|
||||
{
|
||||
uint64_t x = maskLowOrderBits(addr, offsetBits);
|
||||
uint64_t x = bits(addr, std::numeric_limits<Addr>::digits - 1, offsetBits);
|
||||
int y = hashH3(x, hash_number);
|
||||
|
||||
if (isParallel) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "mem/ruby/filters/LSB_CountingBloomFilter.hh"
|
||||
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include "base/bitfield.hh"
|
||||
#include "params/LSB_CountingBloomFilter.hh"
|
||||
|
||||
LSB_CountingBloomFilter::LSB_CountingBloomFilter(
|
||||
@@ -66,7 +66,7 @@ LSB_CountingBloomFilter::getCount(Addr addr) const
|
||||
int
|
||||
LSB_CountingBloomFilter::hash(Addr addr) const
|
||||
{
|
||||
return bitSelect(addr, offsetBits, offsetBits + sizeBits - 1);
|
||||
return bits(addr, offsetBits + sizeBits - 1, offsetBits);
|
||||
}
|
||||
|
||||
LSB_CountingBloomFilter*
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
|
||||
#include "mem/ruby/filters/MultiBitSelBloomFilter.hh"
|
||||
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include <limits>
|
||||
|
||||
#include "base/bitfield.hh"
|
||||
#include "params/MultiBitSelBloomFilter.hh"
|
||||
|
||||
MultiBitSelBloomFilter::MultiBitSelBloomFilter(
|
||||
@@ -76,7 +78,8 @@ MultiBitSelBloomFilter::getCount(Addr addr) const
|
||||
int
|
||||
MultiBitSelBloomFilter::hash(Addr addr, int hash_number) const
|
||||
{
|
||||
uint64_t x = (maskLowOrderBits(addr, offsetBits) >> skipBits);
|
||||
uint64_t x = bits(addr, std::numeric_limits<Addr>::digits - 1,
|
||||
offsetBits) >> skipBits;
|
||||
int y = hashBitsel(x, hash_number, numHashes, 30, sizeBits);
|
||||
//36-bit addresses, 6-bit cache lines
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "mem/ruby/filters/MultiGrainBloomFilter.hh"
|
||||
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include "base/bitfield.hh"
|
||||
#include "params/MultiGrainBloomFilter.hh"
|
||||
|
||||
MultiGrainBloomFilter::MultiGrainBloomFilter(
|
||||
@@ -87,16 +87,16 @@ int
|
||||
MultiGrainBloomFilter::hash(Addr addr) const
|
||||
{
|
||||
// grap a chunk of bits after byte offset
|
||||
return bitSelect(addr, offsetBits, offsetBits + sizeBits - 1);
|
||||
return bits(addr, offsetBits + sizeBits - 1, offsetBits);
|
||||
}
|
||||
|
||||
int
|
||||
MultiGrainBloomFilter::pageHash(Addr addr) const
|
||||
{
|
||||
int bits = offsetBits + sizeBits - 1;
|
||||
int num_bits = offsetBits + sizeBits - 1;
|
||||
|
||||
// grap a chunk of bits after first chunk
|
||||
return bitSelect(addr, bits, bits + pageFilterSizeBits - 1);
|
||||
return bits(addr, num_bits + pageFilterSizeBits - 1, num_bits);
|
||||
}
|
||||
|
||||
MultiGrainBloomFilter*
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include "mem/ruby/filters/NonCountingBloomFilter.hh"
|
||||
|
||||
#include "mem/ruby/common/Address.hh"
|
||||
#include "base/bitfield.hh"
|
||||
#include "params/NonCountingBloomFilter.hh"
|
||||
|
||||
NonCountingBloomFilter::NonCountingBloomFilter(
|
||||
@@ -72,8 +72,7 @@ NonCountingBloomFilter::getCount(Addr addr) const
|
||||
int
|
||||
NonCountingBloomFilter::hash(Addr addr) const
|
||||
{
|
||||
return bitSelect(addr, offsetBits + skipBits,
|
||||
offsetBits + skipBits + sizeBits - 1);
|
||||
return bits(addr, offsetBits + skipBits + sizeBits - 1, offsetBits + skipBits);
|
||||
}
|
||||
|
||||
NonCountingBloomFilter*
|
||||
|
||||
Reference in New Issue
Block a user