OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JoinHashImpl.h File Reference
#include <cstdint>
#include <functional>
#include "../../../Shared/funcannotations.h"
#include "../../../Shared/shard_key.h"
+ Include dependency graph for JoinHashImpl.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define insert_key_cas(address, compare, val)   __sync_val_compare_and_swap(address, compare, val)
 

Functions

ALWAYS_INLINE DEVICE int SUFFIX() fill_one_to_one_hashtable (size_t idx, int32_t *entry_ptr, const int32_t invalid_slot_val)
 
ALWAYS_INLINE DEVICE int SUFFIX() fill_hashtable_for_semi_join (size_t idx, int32_t *entry_ptr, const int32_t invalid_slot_val)
 
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 translated_null_val, 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_hash_slot_bitwise_eq (int32_t *buff, const int64_t key, const int64_t min_key, const int64_t translated_null_val)
 
ALWAYS_INLINE DEVICE int32_t
*SUFFIX() 
get_bucketized_hash_slot_sharded (int32_t *buff, const int64_t key, const int64_t min_key, const int64_t translated_null_val, 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 (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)
 
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 int64_t translated_null_val, 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_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)
 

Macro Definition Documentation

#define insert_key_cas (   address,
  compare,
  val 
)    __sync_val_compare_and_swap(address, compare, val)

Definition at line 40 of file JoinHashImpl.h.

Referenced by fill_hashtable_for_semi_join(), and fill_one_to_one_hashtable().

Function Documentation

ALWAYS_INLINE DEVICE int SUFFIX() fill_hashtable_for_semi_join ( size_t  idx,
int32_t *  entry_ptr,
const int32_t  invalid_slot_val 
)

Definition at line 54 of file JoinHashImpl.h.

References insert_key_cas.

Referenced by fill_hash_join_buff(), fill_hash_join_buff_bitwise_eq(), fill_hash_join_buff_bucketized(), fill_hash_join_buff_sharded(), and fill_hash_join_buff_sharded_bucketized().

57  {
58  // just mark the existence of value to the corresponding hash slot
59  // regardless of hashtable collision
60  insert_key_cas(entry_ptr, invalid_slot_val, idx);
61  return 0;
62 }
#define insert_key_cas(address, compare, val)
Definition: JoinHashImpl.h:40

+ Here is the caller graph for this function:

ALWAYS_INLINE DEVICE int SUFFIX() fill_one_to_one_hashtable ( size_t  idx,
int32_t *  entry_ptr,
const int32_t  invalid_slot_val 
)

Definition at line 44 of file JoinHashImpl.h.

References insert_key_cas.

Referenced by fill_hash_join_buff(), fill_hash_join_buff_bitwise_eq(), fill_hash_join_buff_bucketized(), fill_hash_join_buff_sharded(), and fill_hash_join_buff_sharded_bucketized().

47  {
48  if (insert_key_cas(entry_ptr, invalid_slot_val, idx) != invalid_slot_val) {
49  return -1;
50  }
51  return 0;
52 }
#define insert_key_cas(address, compare, val)
Definition: JoinHashImpl.h:40

+ Here is the caller graph for this function:

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  translated_null_val,
const int64_t  bucket_normalization 
)

Definition at line 66 of file JoinHashImpl.h.

Referenced by bucketized_hash_join_idx(), count_matches_bucketized(), fill_hash_join_buff_bucketized(), and fill_row_ids_bucketized().

71  {
72  auto hash_slot = key / bucket_normalization - min_key + (key == translated_null_val);
73  return buff + hash_slot;
74 }

+ Here is the caller graph for this function:

ALWAYS_INLINE DEVICE int32_t* SUFFIX() get_bucketized_hash_slot_sharded ( int32_t *  buff,
const int64_t  key,
const int64_t  min_key,
const int64_t  translated_null_val,
const uint32_t  entry_count_per_shard,
const uint32_t  num_shards,
const uint32_t  device_count,
const int64_t  bucket_normalization 
)

Definition at line 90 of file JoinHashImpl.h.

References SHARD_FOR_KEY.

Referenced by fill_row_ids_sharded_bucketized().

98  {
99  const uint32_t shard = SHARD_FOR_KEY(key, num_shards);
100  const uint32_t shard_buffer_index =
101  shard / device_count; // shard sub-buffer index within `buff`
102  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
103  auto hash_slot = ((key / bucket_normalization) - min_key) / num_shards +
104  (key == translated_null_val);
105  return shard_buffer + hash_slot;
106 }
#define SHARD_FOR_KEY(key, num_shards)
Definition: shard_key.h:20

+ Here is the caller graph for this function:

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 int64_t  translated_null_val,
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 
)

Definition at line 122 of file JoinHashImpl.h.

Referenced by fill_hash_join_buff_sharded_bucketized().

131  {
132  const uint32_t shard_buffer_index =
133  shard / device_count; // shard sub-buffer index within `buff`
134  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
135  int64_t hash_slot = ((key / bucket_normalization) - min_key) / num_shards +
136  (key == translated_null_val);
137  return shard_buffer + hash_slot;
138 }

+ Here is the caller graph for this function:

ALWAYS_INLINE DEVICE int32_t* SUFFIX() get_hash_slot ( int32_t *  buff,
const int64_t  key,
const int64_t  min_key 
)

Definition at line 76 of file JoinHashImpl.h.

Referenced by count_matches(), fill_hash_join_buff(), fill_row_ids(), and hash_join_idx().

78  {
79  return buff + (key - min_key);
80 }

+ Here is the caller graph for this function:

ALWAYS_INLINE DEVICE int32_t* SUFFIX() get_hash_slot_bitwise_eq ( int32_t *  buff,
const int64_t  key,
const int64_t  min_key,
const int64_t  translated_null_val 
)

Definition at line 82 of file JoinHashImpl.h.

Referenced by fill_hash_join_buff_bitwise_eq().

86  {
87  return buff + (key - min_key) + (key == translated_null_val);
88 }

+ Here is the caller graph for this function:

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 
)

Definition at line 108 of file JoinHashImpl.h.

References SHARD_FOR_KEY.

Referenced by count_matches_sharded(), fill_row_ids_sharded(), and hash_join_idx_sharded().

114  {
115  const uint32_t shard = SHARD_FOR_KEY(key, num_shards);
116  const uint32_t shard_buffer_index =
117  shard / device_count; // shard sub-buffer index within `buff`
118  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
119  return shard_buffer + (key - min_key) / num_shards;
120 }
#define SHARD_FOR_KEY(key, num_shards)
Definition: shard_key.h:20

+ Here is the caller graph for this function:

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 
)

Definition at line 140 of file JoinHashImpl.h.

Referenced by fill_hash_join_buff_sharded().

147  {
148  const uint32_t shard_buffer_index =
149  shard / device_count; // shard sub-buffer index within `buff`
150  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
151  return shard_buffer + (key - min_key) / num_shards;
152 }

+ Here is the caller graph for this function: