Skip to content
Snippets Groups Projects
Commit 3b7377ee authored by Wlad's avatar Wlad
Browse files

wip: add new lookup hasher and extend parameters

parent 5e6ba58f
No related branches found
No related tags found
No related merge requests found
Pipeline #96875 failed
......@@ -6,16 +6,17 @@
* Own Implementations
*/
#include <bloom/bloom_filter.hpp>
#include <xor/xor_filter.hpp>
#include <cuckoo/cuckoo_filter.hpp>
#include <lookup/lookup_filter.hpp>
#include <xor/xor_filter.hpp>
/*
* Reference Implementations
*/
#include <reference/amd_mortonfilter/amd_mortonfilter_filter.hpp>
#include <reference/efficient_cuckoofilter/efficient_cuckoofilter_filter.hpp>
#include <reference/fastfilter/fastfilter_filter.hpp>
#include <reference/impala/impala_bloom_filter.hpp>
#include <reference/efficient_cuckoofilter/efficient_cuckoofilter_filter.hpp>
#include <reference/amd_mortonfilter/amd_mortonfilter_filter.hpp>
#include <reference/vacuumfilter/vacuumfilter_filter.hpp>
#ifdef ENABLE_BSD
......
......@@ -7,71 +7,71 @@
namespace filters {
enum class FilterType : size_t {
Bloom,
Xor,
Cuckoo,
FastfilterBloom,
FastfilterXor,
ImpalaBloom,
BSDBloom,
BSDCuckoo,
EfficientCuckooFilter,
AMDMortonFilter,
VacuumFilter,
MaskedBloomFilter
Bloom,
Xor,
Cuckoo,
FastfilterBloom,
FastfilterXor,
ImpalaBloom,
BSDBloom,
BSDCuckoo,
EfficientCuckooFilter,
AMDMortonFilter,
VacuumFilter,
LookupBloom,
};
template <FilterType filter, typename FilterParameter, size_t k, typename OptimizationParameter>
struct Filter {
static constexpr bool supports_add = false;
static constexpr bool supports_add_partition = false;
using Vector = simd::Vector<OptimizationParameter::registerSize, OptimizationParameter::simd>;
using T = typename Vector::T;
using M = typename Vector::M;
Filter(size_t /*s*/,
size_t /*n_partitions*/,
size_t /*n_threads*/,
size_t /*n_tasks_per_level*/) {
throw std::logic_error{"not implemented!"};
}
void init(const T *) {
throw std::logic_error{"not implemented!"};
}
bool contains(const T &) {
throw std::logic_error{"not implemented!"};
}
bool add(const T &) {
throw std::logic_error{"not implemented!"};
}
bool construct(T *, size_t) {
throw std::logic_error{"not implemented!"};
}
size_t count(T *, size_t) {
throw std::logic_error{"not implemented!"};
}
size_t size() {
throw std::logic_error{"not implemented!"};
}
size_t avg_size() {
throw std::logic_error{"not implemented!"};
};
size_t retries() {
throw std::logic_error{"not implemented"};
}
std::string to_string() {
throw std::logic_error{"not implemented!"};
}
static constexpr bool supports_add = false;
static constexpr bool supports_add_partition = false;
using Vector = simd::Vector<OptimizationParameter::registerSize, OptimizationParameter::simd>;
using T = typename Vector::T;
using M = typename Vector::M;
Filter(size_t /*s*/,
size_t /*n_partitions*/,
size_t /*n_threads*/,
size_t /*n_tasks_per_level*/) {
throw std::logic_error{"not implemented! (constructor)"};
}
void init(const T *) {
throw std::logic_error{"not implemented! (init)"};
}
bool contains(const T &) {
throw std::logic_error{"not implemented! (contains)"};
}
bool add(const T &) {
throw std::logic_error{"not implemented! (add)"};
}
bool construct(T *, size_t) {
throw std::logic_error{"not implemented! (construct)"};
}
size_t count(T *, size_t) {
throw std::logic_error{"not implemented! (count)"};
}
size_t size() {
throw std::logic_error{"not implemented! (size)"};
}
size_t avg_size() {
throw std::logic_error{"not implemented! (avg_size)"};
};
size_t retries() {
throw std::logic_error{"not implemented! (retries)"};
}
std::string to_string() {
throw std::logic_error{"not implemented! (to_string)"};
}
};
} // namespace filters
#pragma once
#include "hasher_identity.hpp"
#include "hasher_lookup.hpp"
#include "hasher_murmur.hpp"
#include "hasher_fasthash.hpp"
#include "hasher_mul.hpp"
......
#pragma once
#include <compiler/compiler_hints.hpp>
#include <cstddef>
#include <parameter/parameter.hpp>
#include "hasher_base.hpp"
namespace filters::hash {
using HashingMode = parameter::HashingMode;
const uint16_t bloomLookup3[256] = {
7, 11, 19, 21, 25, 28, 35, 41, 44, 67, 69, 76, 81,
82, 88, 100, 131, 134, 137, 138, 145, 152, 161, 162, 168, 193,
208, 259, 274, 290, 292, 296, 304, 322, 324, 328, 352, 388, 416,
448, 518, 522, 546, 552, 560, 578, 580, 608, 656, 672, 704, 772,
776, 784, 1029, 1030, 1034, 1036, 1041, 1042, 1060, 1072, 1090, 1120, 1156,
1216, 1281, 1288, 1296, 1537, 1538, 1544, 1568, 1664, 1792, 2053, 2054, 2060,
2068, 2072, 2081, 2088, 2096, 2128, 2144, 2178, 2208, 2305, 2306, 2312, 2336,
2432, 2561, 2562, 2568, 2576, 2624, 2688, 3074, 3080, 3136, 4105, 4106, 4114,
4116, 4129, 4132, 4162, 4168, 4232, 4240, 4288, 4353, 4354, 4356, 4368, 4480,
4609, 4612, 4624, 4640, 4672, 5121, 5136, 5248, 5376, 6148, 6176, 6208, 6272,
7168, 8198, 8210, 8212, 8216, 8225, 8226, 8240, 8257, 8272, 8288, 8324, 8449,
8456, 8576, 8705, 8706, 8708, 8712, 8768, 8832, 9220, 9248, 9280, 9728, 10241,
10256, 10368, 10496, 11264, 12289, 12290, 12292, 12296, 12416, 14336, 16389, 16390, 16393,
16394, 16402, 16404, 16418, 16432, 16449, 16452, 16456, 16513, 16516, 16520, 16641, 16656,
16704, 16897, 16900, 17024, 17152, 17409, 17424, 17440, 17536, 18436, 18440, 18496, 18944,
19456, 20482, 20488, 20496, 20512, 20736, 21504, 24584, 24608, 24640, 24704, 24832, 25600,
32777, 32778, 32780, 32785, 32788, 32801, 32804, 32840, 32864, 32897, 32898, 32900, 32912,
33026, 33028, 33088, 33152, 33281, 33288, 33296, 33536, 33800, 33824, 33856, 33920, 34048,
34817, 34818, 34820, 34832, 36896, 36928, 37376, 37888, 38912, 40962, 40964, 40968, 40976,
41024, 41216, 41984, 49154, 49184, 49216, 49664, 51200, 53248};
const uint16_t lookupSize = sizeof(bloomLookup3) / sizeof(bloomLookup3[0]);
template <typename Vector, size_t config>
struct Hasher<HashingMode::Lookup, Vector, config> {
static constexpr size_t hash_bits = static_cast<size_t>(Vector::registerSize);
forceinline static Vector hash(const Vector &value) {
// static_assert(hash_bits != 16, "Hashing mode not supported");
// FIXME: use AVX in the future
Vector res(0);
for (size_t i = 0; i < Vector::n_elements; ++i) {
res.elements[i] = (typename Vector::T)
bloomLookup3[static_cast<uint16_t>(value.elements[i] % lookupSize)];
}
return res;
}
template <size_t>
forceinline static Vector rehash(const Vector &value, const Vector &) {
// FIXME: use AVX in the future
// FIXME: implement rehash
throw std::runtime_error("Not implemented");
}
};
} // namespace filters::hash
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment