OmniSciDB  eb3a3d0a03
 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 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  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().

70  {
71  return buff + (key - min_key) / bucket_normalization;
72 }

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

References SHARD_FOR_KEY.

Referenced by fill_row_ids_sharded_bucketized().

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

Referenced by fill_hash_join_buff_sharded_bucketized().

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

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

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

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

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

References SHARD_FOR_KEY.

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

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

Referenced by fill_hash_join_buff_sharded().

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  return shard_buffer + (key - min_key) / num_shards;
136 }

+ Here is the caller graph for this function: