24 #ifndef QUERYENGINE_GROUPBYFASTIMPL_H 25 #define QUERYENGINE_GROUPBYFASTIMPL_H 28 #include "../../../Shared/funcannotations.h" 29 #include "../../../Shared/shard_key.h" 34 const int64_t min_key,
35 const int64_t bucket_normalization) {
36 return buff + (key - min_key) / bucket_normalization;
41 const int64_t min_key) {
42 return buff + (key - min_key);
48 const int64_t min_key,
49 const uint32_t entry_count_per_shard,
50 const uint32_t num_shards,
51 const uint32_t device_count,
52 const int64_t bucket_normalization) {
54 const uint32_t shard_buffer_index =
56 int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
57 return shard_buffer + (key - min_key) / bucket_normalization / num_shards;
63 const int64_t min_key,
64 const uint32_t entry_count_per_shard,
65 const uint32_t num_shards,
66 const uint32_t device_count) {
68 const uint32_t shard_buffer_index =
70 int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
71 return shard_buffer + (key - min_key) / num_shards;
77 const int64_t min_key,
78 const uint32_t entry_count_per_shard,
80 const uint32_t num_shards,
81 const uint32_t device_count,
82 const int64_t bucket_normalization) {
83 const uint32_t shard_buffer_index =
85 int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
86 return shard_buffer + (key - min_key) / bucket_normalization / num_shards;
92 const int64_t min_key,
93 const uint32_t entry_count_per_shard,
95 const uint32_t num_shards,
96 const uint32_t device_count) {
97 const uint32_t shard_buffer_index =
99 int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
100 return shard_buffer + (key - min_key) / num_shards;
103 #endif // QUERYENGINE_GROUPBYFASTIMPL_H ALWAYS_INLINE DEVICE int32_t *SUFFIX() get_bucketized_hash_slot(int32_t *buff, const int64_t key, const int64_t min_key, const int64_t bucket_normalization)
ALWAYS_INLINE DEVICE int32_t *SUFFIX() get_bucketized_hash_slot_sharded_opt(int32_t *buff, const int64_t key, const int64_t min_key, const uint32_t entry_count_per_shard, const uint32_t shard, const uint32_t num_shards, const uint32_t device_count, const int64_t bucket_normalization)
ALWAYS_INLINE DEVICE int32_t *SUFFIX() get_hash_slot(int32_t *buff, const int64_t key, const int64_t min_key)
ALWAYS_INLINE DEVICE int32_t *SUFFIX() get_bucketized_hash_slot_sharded(int32_t *buff, const int64_t key, const int64_t min_key, const uint32_t entry_count_per_shard, const uint32_t num_shards, const uint32_t device_count, const int64_t bucket_normalization)
ALWAYS_INLINE DEVICE int32_t *SUFFIX() get_hash_slot_sharded_opt(int32_t *buff, const int64_t key, const int64_t min_key, const uint32_t entry_count_per_shard, const uint32_t shard, const uint32_t num_shards, const uint32_t device_count)
ALWAYS_INLINE DEVICE int32_t *SUFFIX() get_hash_slot_sharded(int32_t *buff, const int64_t key, const int64_t min_key, const uint32_t entry_count_per_shard, const uint32_t num_shards, const uint32_t device_count)
#define SHARD_FOR_KEY(key, num_shards)