Skip to content

Commit

Permalink
faster merge code for row-major
Browse files Browse the repository at this point in the history
  • Loading branch information
Gillgamesh committed Dec 22, 2024
1 parent f6dcdf6 commit 3c74865
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/sketch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,18 @@ void Sketch::merge(const Sketch &other) {
inject_buffer_buckets();
}
Bucket &deterministic_bucket = get_deterministic_bucket();
#ifdef ROW_MAJOR_SKETCHES
size_t smaller_row = std::min(bkt_per_col, other.bkt_per_col);
size_t num_buck = num_columns * smaller_row;
#pragma omp simd
for (size_t i=0; i < num_buck; ++i) {
buckets[i] ^= other.buckets[i];
}
// for (size_t row=0; row < bkt_per_col; ++row) {
// for (size_t col=0; col < num_columns; ++col) {
// get_bucket(col, row) ^= other.get_bucket(col, row);
// }
#else
for (size_t i=0; i < num_columns; ++i) {
size_t other_effective_size = other.effective_size(i);
#pragma omp simd
Expand All @@ -388,6 +400,7 @@ void Sketch::merge(const Sketch &other) {
recalculate_flags(i, 0, other_effective_size);
#endif
}
#endif

// seperately update the deterministic bucket
deterministic_bucket ^= other.get_deterministic_bucket();
Expand Down

0 comments on commit 3c74865

Please sign in to comment.