Skip to content

Commit f1bd77c

Browse files
committed
changed depth calculations to normal for sketch columns
1 parent 6f6cc89 commit f1bd77c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

include/bucket.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ namespace Bucket_Boruvka {
5050
inline static col_hash_t get_index_depth(const vec_t update_idx, const long seed, const long col,
5151
const vec_hash_t max_depth);
5252

53+
54+
inline static col_hash_t get_index_depth_legacy(const vec_t update_idx, const long seed_and_col, const vec_hash_t max_depth) {
55+
col_hash_t depth_hash = col_hash(&update_idx, sizeof(vec_t), seed_and_col);
56+
depth_hash |= (1ull << max_depth); // assert not > max_depth by ORing
57+
return __builtin_ctzll(depth_hash);
58+
}
59+
5360
inline static void get_all_index_depths(
5461
const vec_t update_idx,
5562
uint32_t *depths_buffer,

src/sketch_columns.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void FixedSizeSketchColumn::merge(FixedSizeSketchColumn &other) {
5959

6060
void FixedSizeSketchColumn::update(const vec_t update) {
6161
vec_hash_t checksum = Bucket_Boruvka::get_index_hash(update, seed);
62-
col_hash_t depth = Bucket_Boruvka::get_index_depth(update, seed, col_idx, capacity-1);
62+
col_hash_t depth = Bucket_Boruvka::get_index_depth_legacy(update, seed + col_idx, capacity-1);
6363
// assert(depth < capacity);
6464
buckets[depth] ^= {update, checksum};
6565
deterministic_bucket ^= {update, checksum};
@@ -128,7 +128,7 @@ void ResizeableSketchColumn::update(const vec_t update) {
128128
// TODO - remove magic number
129129
// TODO - get_index_depth needs to be fixed. hashes need to be longer
130130
// than 32 bits if we're not using the deep bucket buffer idea.
131-
col_hash_t depth = Bucket_Boruvka::get_index_depth(update, seed, col_idx, 60);
131+
col_hash_t depth = Bucket_Boruvka::get_index_depth_legacy(update, seed + col_idx, 60);
132132
deterministic_bucket ^= {update, checksum};
133133

134134
if (depth >= capacity) {
@@ -221,7 +221,7 @@ void ResizeableAlignedSketchColumn::update(const vec_t update) {
221221
// TODO - remove magic number
222222
// TODO - get_index_depth needs to be fixed. hashes need to be longer
223223
// than 32 bits if we're not using the deep bucket buffer idea.
224-
col_hash_t depth = Bucket_Boruvka::get_index_depth(update, seed, col_idx, 60);
224+
col_hash_t depth = Bucket_Boruvka::get_index_depth_legacy(update, seed + col_idx, 60);
225225
deterministic_bucket ^= {update, checksum};
226226

227227
if (depth >= capacity) {

0 commit comments

Comments
 (0)