OmniSciDB  91042dcc5b
 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 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 (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 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 41 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 55 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().

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

+ 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 45 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().

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

+ 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  bucket_normalization 
)

Definition at line 67 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  return buff + (key - min_key) / bucket_normalization;
73 }

+ 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 uint32_t  entry_count_per_shard,
const uint32_t  num_shards,
const uint32_t  device_count,
const int64_t  bucket_normalization 
)

Definition at line 81 of file JoinHashImpl.h.

References SHARD_FOR_KEY.

Referenced by fill_row_ids_sharded_bucketized().

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

Referenced by fill_hash_join_buff_sharded_bucketized().

118  {
119  const uint32_t shard_buffer_index =
120  shard / device_count; // shard sub-buffer index within `buff`
121  int32_t* shard_buffer = buff + shard_buffer_index * entry_count_per_shard;
122  return shard_buffer + (key - min_key) / bucket_normalization / num_shards;
123 }

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

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

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

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

References SHARD_FOR_KEY.

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

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

Referenced by fill_hash_join_buff_sharded().

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

+ Here is the caller graph for this function: