OmniSciDB  c1a53651b2
 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_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_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_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 82 of file JoinHashImpl.h.

References SHARD_FOR_KEY.

Referenced by fill_row_ids_sharded_bucketized().

90  {
91  const uint32_t shard = SHARD_FOR_KEY(key, num_shards);
92  const uint32_t shard_buffer_index =
93  shard / device_count; // shard sub-buffer index within `buff`
94  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
95  auto hash_slot = ((key / bucket_normalization) - min_key) / num_shards +
96  (key == translated_null_val);
97  return shard_buffer + hash_slot;
98 }
#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 114 of file JoinHashImpl.h.

Referenced by fill_hash_join_buff_sharded_bucketized().

123  {
124  const uint32_t shard_buffer_index =
125  shard / device_count; // shard sub-buffer index within `buff`
126  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
127  int64_t hash_slot = ((key / bucket_normalization) - min_key) / num_shards +
128  (key == translated_null_val);
129  return shard_buffer + hash_slot;
130 }

+ 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_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 100 of file JoinHashImpl.h.

References SHARD_FOR_KEY.

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

106  {
107  const uint32_t shard = SHARD_FOR_KEY(key, num_shards);
108  const uint32_t shard_buffer_index =
109  shard / device_count; // shard sub-buffer index within `buff`
110  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
111  return shard_buffer + (key - min_key) / num_shards;
112 }
#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 132 of file JoinHashImpl.h.

Referenced by fill_hash_join_buff_sharded().

139  {
140  const uint32_t shard_buffer_index =
141  shard / device_count; // shard sub-buffer index within `buff`
142  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
143  return shard_buffer + (key - min_key) / num_shards;
144 }

+ Here is the caller graph for this function: