OmniSciDB  bf83d84833
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RuntimeFunctions.cpp File Reference
#include "RuntimeFunctions.h"
#include "../Shared/funcannotations.h"
#include "BufferCompaction.h"
#include "HyperLogLogRank.h"
#include "MurmurHash.h"
#include "Shared/quantile.h"
#include "TypePunning.h"
#include <algorithm>
#include <atomic>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <thread>
#include <tuple>
#include "DecodersImpl.h"
#include "GroupByRuntime.cpp"
#include "JoinHashTable/Runtime/JoinHashTableQueryRuntime.cpp"
#include "TopKRuntime.cpp"
+ Include dependency graph for RuntimeFunctions.cpp:

Go to the source code of this file.

Macros

#define DEF_ARITH_NULLABLE(type, null_type, opname, opsym)
 
#define DEF_ARITH_NULLABLE_LHS(type, null_type, opname, opsym)
 
#define DEF_ARITH_NULLABLE_RHS(type, null_type, opname, opsym)
 
#define DEF_CMP_NULLABLE(type, null_type, opname, opsym)
 
#define DEF_CMP_NULLABLE_LHS(type, null_type, opname, opsym)
 
#define DEF_CMP_NULLABLE_RHS(type, null_type, opname, opsym)
 
#define DEF_SAFE_DIV_NULLABLE(type, null_type, opname)
 
#define DEF_BINARY_NULLABLE_ALL_OPS(type, null_type)
 
#define DEF_UMINUS_NULLABLE(type, null_type)
 
#define DEF_CAST_NULLABLE(from_type, to_type)
 
#define DEF_CAST_NULLABLE_BIDIR(type1, type2)
 
#define GPU_RT_STUB   NEVER_INLINE __attribute__((optnone))
 
#define DEF_AGG_MAX_INT(n)
 
#define DEF_AGG_MIN_INT(n)
 
#define DEF_AGG_ID_INT(n)
 
#define DEF_CHECKED_SINGLE_AGG_ID_INT(n)
 
#define DEF_WRITE_PROJECTION_INT(n)
 
#define DEF_SKIP_AGG_ADD(base_agg_func)
 
#define DEF_SKIP_AGG(base_agg_func)
 
#define DATA_T   int64_t
 
#define DATA_T   int32_t
 
#define DATA_T   int16_t
 
#define DATA_T   int8_t
 
#define DEF_SKIP_AGG_ADD(base_agg_func)
 
#define DEF_SKIP_AGG(base_agg_func)
 
#define DATA_T   double
 
#define ADDR_T   int64_t
 
#define DATA_T   float
 
#define ADDR_T   int32_t
 
#define DEF_SHARED_AGG_RET_STUBS(base_agg_func)
 
#define DEF_SHARED_AGG_STUBS(base_agg_func)
 

Functions

ALWAYS_INLINE int64_t scale_decimal_up (const int64_t operand, const uint64_t scale, const int64_t operand_null_val, const int64_t result_null_val)
 
ALWAYS_INLINE int64_t scale_decimal_down_nullable (const int64_t operand, const int64_t scale, const int64_t null_val)
 
ALWAYS_INLINE int64_t scale_decimal_down_not_nullable (const int64_t operand, const int64_t scale, const int64_t null_val)
 
ALWAYS_INLINE int64_t floor_div_lhs (const int64_t dividend, const int64_t divisor)
 
ALWAYS_INLINE int64_t floor_div_nullable_lhs (const int64_t dividend, const int64_t divisor, const int64_t null_val)
 
ALWAYS_INLINE int8_t logical_not (const int8_t operand, const int8_t null_val)
 
ALWAYS_INLINE int8_t logical_and (const int8_t lhs, const int8_t rhs, const int8_t null_val)
 
ALWAYS_INLINE int8_t logical_or (const int8_t lhs, const int8_t rhs, const int8_t null_val)
 
ALWAYS_INLINE uint64_t agg_count (uint64_t *agg, const int64_t)
 
ALWAYS_INLINE void agg_count_distinct_bitmap (int64_t *agg, const int64_t val, const int64_t min_val)
 
GPU_RT_STUB void agg_count_distinct_bitmap_gpu (int64_t *, const int64_t, const int64_t, const int64_t, const int64_t, const uint64_t, const uint64_t)
 
NEVER_INLINE void agg_approximate_count_distinct (int64_t *agg, const int64_t key, const uint32_t b)
 
GPU_RT_STUB void agg_approximate_count_distinct_gpu (int64_t *, const int64_t, const uint32_t, const int64_t, const int64_t)
 
NEVER_INLINE void agg_approx_median (int64_t *agg, const double val)
 
ALWAYS_INLINE void agg_approx_median_skip_val (int64_t *agg, const double val, const int64_t skip_val)
 
ALWAYS_INLINE int8_t bit_is_set (const int64_t bitset, const int64_t val, const int64_t min_val, const int64_t max_val, const int64_t null_val, const int8_t null_bool_val)
 
ALWAYS_INLINE int64_t agg_sum (int64_t *agg, const int64_t val)
 
ALWAYS_INLINE void agg_max (int64_t *agg, const int64_t val)
 
ALWAYS_INLINE void agg_min (int64_t *agg, const int64_t val)
 
ALWAYS_INLINE void agg_id (int64_t *agg, const int64_t val)
 
ALWAYS_INLINE int32_t checked_single_agg_id (int64_t *agg, const int64_t val, const int64_t null_val)
 
ALWAYS_INLINE void agg_count_distinct_bitmap_skip_val (int64_t *agg, const int64_t val, const int64_t min_val, const int64_t skip_val)
 
GPU_RT_STUB void agg_count_distinct_bitmap_skip_val_gpu (int64_t *, const int64_t, const int64_t, const int64_t, const int64_t, const int64_t, const uint64_t, const uint64_t)
 
ALWAYS_INLINE uint32_t agg_count_int32 (uint32_t *agg, const int32_t)
 
ALWAYS_INLINE int32_t agg_sum_int32 (int32_t *agg, const int32_t val)
 
ALWAYS_INLINE int64_t agg_sum_skip_val (int64_t *agg, const int64_t val, const int64_t skip_val)
 
ALWAYS_INLINE int32_t agg_sum_int32_skip_val (int32_t *agg, const int32_t val, const int32_t skip_val)
 
ALWAYS_INLINE uint64_t agg_count_skip_val (uint64_t *agg, const int64_t val, const int64_t skip_val)
 
ALWAYS_INLINE uint32_t agg_count_int32_skip_val (uint32_t *agg, const int32_t val, const int32_t skip_val)
 
ALWAYS_INLINE uint64_t agg_count_double (uint64_t *agg, const double val)
 
ALWAYS_INLINE void agg_sum_double (int64_t *agg, const double val)
 
ALWAYS_INLINE void agg_max_double (int64_t *agg, const double val)
 
ALWAYS_INLINE void agg_min_double (int64_t *agg, const double val)
 
ALWAYS_INLINE void agg_id_double (int64_t *agg, const double val)
 
ALWAYS_INLINE int32_t checked_single_agg_id_double (int64_t *agg, const double val, const double null_val)
 
ALWAYS_INLINE uint32_t agg_count_float (uint32_t *agg, const float val)
 
ALWAYS_INLINE void agg_sum_float (int32_t *agg, const float val)
 
ALWAYS_INLINE void agg_max_float (int32_t *agg, const float val)
 
ALWAYS_INLINE void agg_min_float (int32_t *agg, const float val)
 
ALWAYS_INLINE void agg_id_float (int32_t *agg, const float val)
 
ALWAYS_INLINE int32_t checked_single_agg_id_float (int32_t *agg, const float val, const float null_val)
 
ALWAYS_INLINE uint64_t agg_count_double_skip_val (uint64_t *agg, const double val, const double skip_val)
 
ALWAYS_INLINE uint32_t agg_count_float_skip_val (uint32_t *agg, const float val, const float skip_val)
 
ALWAYS_INLINE int64_t decimal_floor (const int64_t x, const int64_t scale)
 
ALWAYS_INLINE int64_t decimal_ceil (const int64_t x, const int64_t scale)
 
GPU_RT_STUB int32_t checked_single_agg_id_shared (int64_t *agg, const int64_t val, const int64_t null_val)
 
GPU_RT_STUB int32_t checked_single_agg_id_int32_shared (int32_t *agg, const int32_t val, const int32_t null_val)
 
GPU_RT_STUB int32_t checked_single_agg_id_int16_shared (int16_t *agg, const int16_t val, const int16_t null_val)
 
GPU_RT_STUB int32_t checked_single_agg_id_int8_shared (int8_t *agg, const int8_t val, const int8_t null_val)
 
GPU_RT_STUB int32_t checked_single_agg_id_double_shared (int64_t *agg, const double val, const double null_val)
 
GPU_RT_STUB int32_t checked_single_agg_id_float_shared (int32_t *agg, const float val, const float null_val)
 
GPU_RT_STUB void agg_max_int16_skip_val_shared (int16_t *agg, const int16_t val, const int16_t skip_val)
 
GPU_RT_STUB void agg_max_int8_skip_val_shared (int8_t *agg, const int8_t val, const int8_t skip_val)
 
GPU_RT_STUB void agg_min_int16_skip_val_shared (int16_t *agg, const int16_t val, const int16_t skip_val)
 
GPU_RT_STUB void agg_min_int8_skip_val_shared (int8_t *agg, const int8_t val, const int8_t skip_val)
 
GPU_RT_STUB void agg_id_double_shared_slow (int64_t *agg, const double *val)
 
GPU_RT_STUB int64_t agg_sum_shared (int64_t *agg, const int64_t val)
 
GPU_RT_STUB int64_t agg_sum_skip_val_shared (int64_t *agg, const int64_t val, const int64_t skip_val)
 
GPU_RT_STUB int32_t agg_sum_int32_shared (int32_t *agg, const int32_t val)
 
GPU_RT_STUB int32_t agg_sum_int32_skip_val_shared (int32_t *agg, const int32_t val, const int32_t skip_val)
 
GPU_RT_STUB void agg_sum_double_shared (int64_t *agg, const double val)
 
GPU_RT_STUB void agg_sum_double_skip_val_shared (int64_t *agg, const double val, const double skip_val)
 
GPU_RT_STUB void agg_sum_float_shared (int32_t *agg, const float val)
 
GPU_RT_STUB void agg_sum_float_skip_val_shared (int32_t *agg, const float val, const float skip_val)
 
GPU_RT_STUB void force_sync ()
 
GPU_RT_STUB void sync_warp ()
 
GPU_RT_STUB void sync_warp_protected (int64_t thread_pos, int64_t row_count)
 
GPU_RT_STUB void sync_threadblock ()
 
GPU_RT_STUB void write_back_non_grouped_agg (int64_t *input_buffer, int64_t *output_buffer, const int32_t num_agg_cols)
 
NEVER_INLINE int32_t pos_start_impl (int32_t *error_code)
 
NEVER_INLINE int32_t group_buff_idx_impl ()
 
NEVER_INLINE int32_t pos_step_impl ()
 
GPU_RT_STUB int8_t thread_warp_idx (const int8_t warp_sz)
 
GPU_RT_STUB int64_t get_thread_index ()
 
GPU_RT_STUB int64_t * declare_dynamic_shared_memory ()
 
GPU_RT_STUB int64_t get_block_index ()
 
ALWAYS_INLINE void record_error_code (const int32_t err_code, int32_t *error_codes)
 
ALWAYS_INLINE int32_t get_error_code (int32_t *error_codes)
 
NEVER_INLINE const int64_t * init_shared_mem_nop (const int64_t *groups_buffer, const int32_t groups_buffer_size)
 
NEVER_INLINE void write_back_nop (int64_t *dest, int64_t *src, const int32_t sz)
 
int64_t * init_shared_mem (const int64_t *global_groups_buffer, const int32_t groups_buffer_size)
 
NEVER_INLINE void init_group_by_buffer_gpu (int64_t *groups_buffer, const int64_t *init_vals, const uint32_t groups_buffer_entry_count, const uint32_t key_qw_count, const uint32_t agg_col_count, const bool keyless, const int8_t warp_size)
 
NEVER_INLINE void init_columnar_group_by_buffer_gpu (int64_t *groups_buffer, const int64_t *init_vals, const uint32_t groups_buffer_entry_count, const uint32_t key_qw_count, const uint32_t agg_col_count, const bool keyless, const bool blocks_share_memory, const int32_t frag_idx)
 
NEVER_INLINE void init_group_by_buffer_impl (int64_t *groups_buffer, const int64_t *init_vals, const uint32_t groups_buffer_entry_count, const uint32_t key_qw_count, const uint32_t agg_col_count, const bool keyless, const int8_t warp_size)
 
template<typename T >
ALWAYS_INLINE int64_t * get_matching_group_value (int64_t *groups_buffer, const uint32_t h, const T *key, const uint32_t key_count, const uint32_t row_size_quad)
 
ALWAYS_INLINE int64_t * get_matching_group_value (int64_t *groups_buffer, const uint32_t h, const int64_t *key, const uint32_t key_count, const uint32_t key_width, const uint32_t row_size_quad)
 
template<typename T >
ALWAYS_INLINE int32_t get_matching_group_value_columnar_slot (int64_t *groups_buffer, const uint32_t entry_count, const uint32_t h, const T *key, const uint32_t key_count)
 
ALWAYS_INLINE int32_t get_matching_group_value_columnar_slot (int64_t *groups_buffer, const uint32_t entry_count, const uint32_t h, const int64_t *key, const uint32_t key_count, const uint32_t key_width)
 
ALWAYS_INLINE int64_t * get_matching_group_value_columnar (int64_t *groups_buffer, const uint32_t h, const int64_t *key, const uint32_t key_qw_count, const size_t entry_count)
 
ALWAYS_INLINE int64_t * get_matching_group_value_perfect_hash (int64_t *groups_buffer, const uint32_t hashed_index, const int64_t *key, const uint32_t key_count, const uint32_t row_size_quad)
 
ALWAYS_INLINE int64_t * get_matching_group_value_perfect_hash_keyless (int64_t *groups_buffer, const uint32_t hashed_index, const uint32_t row_size_quad)
 
ALWAYS_INLINE void set_matching_group_value_perfect_hash_columnar (int64_t *groups_buffer, const uint32_t hashed_index, const int64_t *key, const uint32_t key_count, const uint32_t entry_count)
 
ALWAYS_INLINE int64_t * get_group_value_fast_keyless (int64_t *groups_buffer, const int64_t key, const int64_t min_key, const int64_t, const uint32_t row_size_quad)
 
ALWAYS_INLINE int64_t * get_group_value_fast_keyless_semiprivate (int64_t *groups_buffer, const int64_t key, const int64_t min_key, const int64_t, const uint32_t row_size_quad, const uint8_t thread_warp_idx, const uint8_t warp_size)
 
ALWAYS_INLINE int8_t * extract_str_ptr (const uint64_t str_and_len)
 
ALWAYS_INLINE int32_t extract_str_len (const uint64_t str_and_len)
 
NEVER_INLINE int8_t * extract_str_ptr_noinline (const uint64_t str_and_len)
 
NEVER_INLINE int32_t extract_str_len_noinline (const uint64_t str_and_len)
 
ALWAYS_INLINE uint64_t string_pack (const int8_t *ptr, const int32_t len)
 
ALWAYS_INLINE DEVICE int32_t char_length (const char *str, const int32_t str_len)
 
ALWAYS_INLINE DEVICE int32_t char_length_nullable (const char *str, const int32_t str_len, const int32_t int_null)
 
ALWAYS_INLINE DEVICE int32_t key_for_string_encoded (const int32_t str_id)
 
ALWAYS_INLINE DEVICE bool sample_ratio (const double proportion, const int64_t row_offset)
 
ALWAYS_INLINE int64_t row_number_window_func (const int64_t output_buff, const int64_t pos)
 
ALWAYS_INLINE double percent_window_func (const int64_t output_buff, const int64_t pos)
 
ALWAYS_INLINE double load_double (const int64_t *agg)
 
ALWAYS_INLINE float load_float (const int32_t *agg)
 
ALWAYS_INLINE double load_avg_int (const int64_t *sum, const int64_t *count, const double null_val)
 
ALWAYS_INLINE double load_avg_decimal (const int64_t *sum, const int64_t *count, const double null_val, const uint32_t scale)
 
ALWAYS_INLINE double load_avg_double (const int64_t *agg, const int64_t *count, const double null_val)
 
ALWAYS_INLINE double load_avg_float (const int32_t *agg, const int32_t *count, const double null_val)
 
NEVER_INLINE void linear_probabilistic_count (uint8_t *bitmap, const uint32_t bitmap_bytes, const uint8_t *key_bytes, const uint32_t key_len)
 
NEVER_INLINE void query_stub_hoisted_literals (const int8_t **col_buffers, const int8_t *literals, const int64_t *num_rows, const uint64_t *frag_row_offsets, const int32_t *max_matched, const int64_t *init_agg_value, int64_t **out, uint32_t frag_idx, const int64_t *join_hash_tables, int32_t *error_code, int32_t *total_matched)
 
void multifrag_query_hoisted_literals (const int8_t ***col_buffers, const uint64_t *num_fragments, const int8_t *literals, const int64_t *num_rows, const uint64_t *frag_row_offsets, const int32_t *max_matched, int32_t *total_matched, const int64_t *init_agg_value, int64_t **out, int32_t *error_code, const uint32_t *num_tables_ptr, const int64_t *join_hash_tables)
 
NEVER_INLINE void query_stub (const int8_t **col_buffers, const int64_t *num_rows, const uint64_t *frag_row_offsets, const int32_t *max_matched, const int64_t *init_agg_value, int64_t **out, uint32_t frag_idx, const int64_t *join_hash_tables, int32_t *error_code, int32_t *total_matched)
 
void multifrag_query (const int8_t ***col_buffers, const uint64_t *num_fragments, const int64_t *num_rows, const uint64_t *frag_row_offsets, const int32_t *max_matched, int32_t *total_matched, const int64_t *init_agg_value, int64_t **out, int32_t *error_code, const uint32_t *num_tables_ptr, const int64_t *join_hash_tables)
 
ALWAYS_INLINE DEVICE bool check_interrupt ()
 
bool check_interrupt_init (unsigned command)
 

Macro Definition Documentation

#define ADDR_T   int64_t

Definition at line 725 of file RuntimeFunctions.cpp.

#define ADDR_T   int32_t

Definition at line 725 of file RuntimeFunctions.cpp.

#define DATA_T   int64_t

Definition at line 724 of file RuntimeFunctions.cpp.

#define DATA_T   int32_t

Definition at line 724 of file RuntimeFunctions.cpp.

#define DATA_T   int16_t

Definition at line 724 of file RuntimeFunctions.cpp.

#define DATA_T   int8_t

Definition at line 724 of file RuntimeFunctions.cpp.

#define DATA_T   double

Definition at line 724 of file RuntimeFunctions.cpp.

#define DATA_T   float

Definition at line 724 of file RuntimeFunctions.cpp.

#define DEF_AGG_ID_INT (   n)
Value:
extern "C" ALWAYS_INLINE void agg_id_int##n(int##n##_t* agg, const int##n##_t val) { \
*agg = val; \
}
#define ALWAYS_INLINE

Definition at line 458 of file RuntimeFunctions.cpp.

#define DEF_AGG_MAX_INT (   n)
Value:
extern "C" ALWAYS_INLINE void agg_max_int##n(int##n##_t* agg, const int##n##_t val) { \
*agg = std::max(*agg, val); \
}
#define ALWAYS_INLINE

Definition at line 438 of file RuntimeFunctions.cpp.

#define DEF_AGG_MIN_INT (   n)
Value:
extern "C" ALWAYS_INLINE void agg_min_int##n(int##n##_t* agg, const int##n##_t val) { \
*agg = std::min(*agg, val); \
}
#define ALWAYS_INLINE

Definition at line 448 of file RuntimeFunctions.cpp.

#define DEF_ARITH_NULLABLE (   type,
  null_type,
  opname,
  opsym 
)
Value:
extern "C" ALWAYS_INLINE type opname##_##type##_nullable( \
const type lhs, const type rhs, const null_type null_val) { \
if (lhs != null_val && rhs != null_val) { \
return lhs opsym rhs; \
} \
return null_val; \
}
#define ALWAYS_INLINE

Definition at line 44 of file RuntimeFunctions.cpp.

#define DEF_ARITH_NULLABLE_LHS (   type,
  null_type,
  opname,
  opsym 
)
Value:
extern "C" ALWAYS_INLINE type opname##_##type##_nullable_lhs( \
const type lhs, const type rhs, const null_type null_val) { \
if (lhs != null_val) { \
return lhs opsym rhs; \
} \
return null_val; \
}
#define ALWAYS_INLINE

Definition at line 53 of file RuntimeFunctions.cpp.

#define DEF_ARITH_NULLABLE_RHS (   type,
  null_type,
  opname,
  opsym 
)
Value:
extern "C" ALWAYS_INLINE type opname##_##type##_nullable_rhs( \
const type lhs, const type rhs, const null_type null_val) { \
if (rhs != null_val) { \
return lhs opsym rhs; \
} \
return null_val; \
}
#define ALWAYS_INLINE

Definition at line 62 of file RuntimeFunctions.cpp.

#define DEF_BINARY_NULLABLE_ALL_OPS (   type,
  null_type 
)

Definition at line 116 of file RuntimeFunctions.cpp.

#define DEF_CAST_NULLABLE (   from_type,
  to_type 
)
Value:
extern "C" ALWAYS_INLINE to_type cast_##from_type##_to_##to_type##_nullable( \
const from_type operand, \
const from_type from_null_val, \
const to_type to_null_val) { \
return operand == from_null_val ? to_null_val : operand; \
}
#define ALWAYS_INLINE

Definition at line 235 of file RuntimeFunctions.cpp.

#define DEF_CAST_NULLABLE_BIDIR (   type1,
  type2 
)
Value:
DEF_CAST_NULLABLE(type1, type2) \
DEF_CAST_NULLABLE(type2, type1)
#define DEF_CAST_NULLABLE(from_type, to_type)

Definition at line 243 of file RuntimeFunctions.cpp.

#define DEF_CHECKED_SINGLE_AGG_ID_INT (   n)
Value:
extern "C" ALWAYS_INLINE int32_t checked_single_agg_id_int##n( \
int##n##_t* agg, const int##n##_t val, const int##n##_t null_val) { \
if (val == null_val) { \
return 0; \
} \
if (*agg == val) { \
return 0; \
} else if (*agg == null_val) { \
*agg = val; \
return 0; \
} else { \
/* see Execute::ERR_SINGLE_VALUE_FOUND_MULTIPLE_VALUES*/ \
return 15; \
} \
}
#define ALWAYS_INLINE

Definition at line 463 of file RuntimeFunctions.cpp.

#define DEF_CMP_NULLABLE (   type,
  null_type,
  opname,
  opsym 
)
Value:
extern "C" ALWAYS_INLINE int8_t opname##_##type##_nullable( \
const type lhs, \
const type rhs, \
const null_type null_val, \
const int8_t null_bool_val) { \
if (lhs != null_val && rhs != null_val) { \
return lhs opsym rhs; \
} \
return null_bool_val; \
}
#define ALWAYS_INLINE

Definition at line 71 of file RuntimeFunctions.cpp.

#define DEF_CMP_NULLABLE_LHS (   type,
  null_type,
  opname,
  opsym 
)
Value:
extern "C" ALWAYS_INLINE int8_t opname##_##type##_nullable_lhs( \
const type lhs, \
const type rhs, \
const null_type null_val, \
const int8_t null_bool_val) { \
if (lhs != null_val) { \
return lhs opsym rhs; \
} \
return null_bool_val; \
}
#define ALWAYS_INLINE

Definition at line 83 of file RuntimeFunctions.cpp.

#define DEF_CMP_NULLABLE_RHS (   type,
  null_type,
  opname,
  opsym 
)
Value:
extern "C" ALWAYS_INLINE int8_t opname##_##type##_nullable_rhs( \
const type lhs, \
const type rhs, \
const null_type null_val, \
const int8_t null_bool_val) { \
if (rhs != null_val) { \
return lhs opsym rhs; \
} \
return null_bool_val; \
}
#define ALWAYS_INLINE

Definition at line 95 of file RuntimeFunctions.cpp.

#define DEF_SAFE_DIV_NULLABLE (   type,
  null_type,
  opname 
)
Value:
extern "C" ALWAYS_INLINE type safe_div_##type( \
const type lhs, const type rhs, const null_type null_val) { \
if (lhs != null_val && rhs != null_val && rhs != 0) { \
return lhs / rhs; \
} \
return null_val; \
}
#define ALWAYS_INLINE

Definition at line 107 of file RuntimeFunctions.cpp.

#define DEF_SHARED_AGG_RET_STUBS (   base_agg_func)

Definition at line 751 of file RuntimeFunctions.cpp.

#define DEF_SHARED_AGG_STUBS (   base_agg_func)
Value:
extern "C" GPU_RT_STUB void base_agg_func##_shared(int64_t* agg, const int64_t val) {} \
\
extern "C" GPU_RT_STUB void base_agg_func##_skip_val_shared( \
int64_t* agg, const int64_t val, const int64_t skip_val) {} \
extern "C" GPU_RT_STUB void base_agg_func##_int32_shared(int32_t* agg, \
const int32_t val) {} \
extern "C" GPU_RT_STUB void base_agg_func##_int16_shared(int16_t* agg, \
const int16_t val) {} \
extern "C" GPU_RT_STUB void base_agg_func##_int8_shared(int8_t* agg, \
const int8_t val) {} \
\
extern "C" GPU_RT_STUB void base_agg_func##_int32_skip_val_shared( \
int32_t* agg, const int32_t val, const int32_t skip_val) {} \
\
extern "C" GPU_RT_STUB void base_agg_func##_double_shared(int64_t* agg, \
const double val) {} \
\
extern "C" GPU_RT_STUB void base_agg_func##_double_skip_val_shared( \
int64_t* agg, const double val, const double skip_val) {} \
extern "C" GPU_RT_STUB void base_agg_func##_float_shared(int32_t* agg, \
const float val) {} \
\
extern "C" GPU_RT_STUB void base_agg_func##_float_skip_val_shared( \
int32_t* agg, const float val, const float skip_val) {}
#define GPU_RT_STUB

Definition at line 790 of file RuntimeFunctions.cpp.

#define DEF_SKIP_AGG (   base_agg_func)
Value:
extern "C" ALWAYS_INLINE void base_agg_func##_skip_val( \
DATA_T* agg, const DATA_T val, const DATA_T skip_val) { \
if (val != skip_val) { \
const DATA_T old_agg = *agg; \
if (old_agg != skip_val) { \
base_agg_func(agg, val); \
} else { \
*agg = val; \
} \
} \
}
#define DATA_T
#define ALWAYS_INLINE

Definition at line 703 of file RuntimeFunctions.cpp.

#define DEF_SKIP_AGG (   base_agg_func)
Value:
extern "C" ALWAYS_INLINE void base_agg_func##_skip_val( \
ADDR_T* agg, const DATA_T val, const DATA_T skip_val) { \
if (val != skip_val) { \
const ADDR_T old_agg = *agg; \
if (old_agg != *reinterpret_cast<const ADDR_T*>(may_alias_ptr(&skip_val))) { \
base_agg_func(agg, val); \
} else { \
*agg = *reinterpret_cast<const ADDR_T*>(may_alias_ptr(&val)); \
} \
} \
}
#define DATA_T
#define ADDR_T
#define ALWAYS_INLINE

Definition at line 703 of file RuntimeFunctions.cpp.

#define DEF_SKIP_AGG_ADD (   base_agg_func)
Value:
extern "C" ALWAYS_INLINE void base_agg_func##_skip_val( \
DATA_T* agg, const DATA_T val, const DATA_T skip_val) { \
if (val != skip_val) { \
base_agg_func(agg, val); \
} \
}
#define DATA_T
#define ALWAYS_INLINE

Definition at line 695 of file RuntimeFunctions.cpp.

#define DEF_SKIP_AGG_ADD (   base_agg_func)
Value:
extern "C" ALWAYS_INLINE void base_agg_func##_skip_val( \
ADDR_T* agg, const DATA_T val, const DATA_T skip_val) { \
if (val != skip_val) { \
base_agg_func(agg, val); \
} \
}
#define DATA_T
#define ADDR_T
#define ALWAYS_INLINE

Definition at line 695 of file RuntimeFunctions.cpp.

#define DEF_UMINUS_NULLABLE (   type,
  null_type 
)
Value:
extern "C" ALWAYS_INLINE type uminus_##type##_nullable(const type operand, \
const null_type null_val) { \
return operand == null_val ? null_val : -operand; \
}
#define ALWAYS_INLINE

Definition at line 220 of file RuntimeFunctions.cpp.

#define DEF_WRITE_PROJECTION_INT (   n)
Value:
extern "C" ALWAYS_INLINE void write_projection_int##n( \
int8_t* slot_ptr, const int##n##_t val, const int64_t init_val) { \
if (val != init_val) { \
*reinterpret_cast<int##n##_t*>(slot_ptr) = val; \
} \
}
#define ALWAYS_INLINE

Definition at line 491 of file RuntimeFunctions.cpp.

#define GPU_RT_STUB   NEVER_INLINE __attribute__((optnone))

Definition at line 312 of file RuntimeFunctions.cpp.

Function Documentation

NEVER_INLINE void agg_approx_median ( int64_t *  agg,
const double  val 
)

Definition at line 339 of file RuntimeFunctions.cpp.

References quantile::detail::TDigest< RealType, IndexType >::add().

Referenced by agg_approx_median_skip_val().

339  {
340  auto* t_digest = reinterpret_cast<quantile::TDigest*>(*agg);
341  t_digest->add(val);
342 }
DEVICE void add(RealType value)
Definition: quantile.h:555

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ALWAYS_INLINE void agg_approx_median_skip_val ( int64_t *  agg,
const double  val,
const int64_t  skip_val 
)

Definition at line 344 of file RuntimeFunctions.cpp.

References agg_approx_median().

346  {
347  if (*reinterpret_cast<int64_t const*>(may_alias_ptr(&val)) != skip_val) {
348  agg_approx_median(agg, val);
349  }
350 }
NEVER_INLINE void agg_approx_median(int64_t *agg, const double val)

+ Here is the call graph for this function:

NEVER_INLINE void agg_approximate_count_distinct ( int64_t *  agg,
const int64_t  key,
const uint32_t  b 
)

Definition at line 323 of file RuntimeFunctions.cpp.

References get_rank(), and MurmurHash64A().

325  {
326  const uint64_t hash = MurmurHash64A(&key, sizeof(key), 0);
327  const uint32_t index = hash >> (64 - b);
328  const uint8_t rank = get_rank(hash << b, 64 - b);
329  uint8_t* M = reinterpret_cast<uint8_t*>(*agg);
330  M[index] = std::max(M[index], rank);
331 }
FORCE_INLINE uint8_t get_rank(uint64_t x, uint32_t b)
NEVER_INLINE DEVICE uint64_t MurmurHash64A(const void *key, int len, uint64_t seed)
Definition: MurmurHash.cpp:26

+ Here is the call graph for this function:

GPU_RT_STUB void agg_approximate_count_distinct_gpu ( int64_t *  ,
const int64_t  ,
const uint32_t  ,
const int64_t  ,
const int64_t   
)

Definition at line 333 of file RuntimeFunctions.cpp.

337  {}
ALWAYS_INLINE uint64_t agg_count ( uint64_t *  agg,
const int64_t   
)

Definition at line 298 of file RuntimeFunctions.cpp.

Referenced by agg_count_skip_val(), and anonymous_namespace{GroupByAndAggregate.cpp}::get_agg_count().

298  {
299  return (*agg)++;
300 }

+ Here is the caller graph for this function:

ALWAYS_INLINE void agg_count_distinct_bitmap ( int64_t *  agg,
const int64_t  val,
const int64_t  min_val 
)

Definition at line 302 of file RuntimeFunctions.cpp.

Referenced by agg_count_distinct_bitmap_skip_val(), WindowFunctionContext::fillPartitionEnd(), WindowFunctionContext::fillPartitionStart(), anonymous_namespace{WindowContext.cpp}::index_to_partition_end(), and InValuesBitmap::InValuesBitmap().

304  {
305  const uint64_t bitmap_idx = val - min_val;
306  reinterpret_cast<int8_t*>(*agg)[bitmap_idx >> 3] |= (1 << (bitmap_idx & 7));
307 }

+ Here is the caller graph for this function:

GPU_RT_STUB void agg_count_distinct_bitmap_gpu ( int64_t *  ,
const int64_t  ,
const int64_t  ,
const int64_t  ,
const int64_t  ,
const uint64_t  ,
const uint64_t   
)

Definition at line 315 of file RuntimeFunctions.cpp.

321  {}
ALWAYS_INLINE void agg_count_distinct_bitmap_skip_val ( int64_t *  agg,
const int64_t  val,
const int64_t  min_val,
const int64_t  skip_val 
)

Definition at line 410 of file RuntimeFunctions.cpp.

References agg_count_distinct_bitmap().

413  {
414  if (val != skip_val) {
415  agg_count_distinct_bitmap(agg, val, min_val);
416  }
417 }
ALWAYS_INLINE void agg_count_distinct_bitmap(int64_t *agg, const int64_t val, const int64_t min_val)

+ Here is the call graph for this function:

GPU_RT_STUB void agg_count_distinct_bitmap_skip_val_gpu ( int64_t *  ,
const int64_t  ,
const int64_t  ,
const int64_t  ,
const int64_t  ,
const int64_t  ,
const uint64_t  ,
const uint64_t   
)

Definition at line 419 of file RuntimeFunctions.cpp.

426  {}
ALWAYS_INLINE uint64_t agg_count_double ( uint64_t *  agg,
const double  val 
)

Definition at line 595 of file RuntimeFunctions.cpp.

Referenced by agg_count_double_skip_val().

595  {
596  return (*agg)++;
597 }

+ Here is the caller graph for this function:

ALWAYS_INLINE uint64_t agg_count_double_skip_val ( uint64_t *  agg,
const double  val,
const double  skip_val 
)

Definition at line 677 of file RuntimeFunctions.cpp.

References agg_count_double().

679  {
680  if (val != skip_val) {
681  return agg_count_double(agg, val);
682  }
683  return *agg;
684 }
ALWAYS_INLINE uint64_t agg_count_double(uint64_t *agg, const double val)

+ Here is the call graph for this function:

ALWAYS_INLINE uint32_t agg_count_float ( uint32_t *  agg,
const float  val 
)

Definition at line 636 of file RuntimeFunctions.cpp.

Referenced by agg_count_float_skip_val().

636  {
637  return (*agg)++;
638 }

+ Here is the caller graph for this function:

ALWAYS_INLINE uint32_t agg_count_float_skip_val ( uint32_t *  agg,
const float  val,
const float  skip_val 
)

Definition at line 686 of file RuntimeFunctions.cpp.

References agg_count_float().

688  {
689  if (val != skip_val) {
690  return agg_count_float(agg, val);
691  }
692  return *agg;
693 }
ALWAYS_INLINE uint32_t agg_count_float(uint32_t *agg, const float val)

+ Here is the call graph for this function:

ALWAYS_INLINE uint32_t agg_count_int32 ( uint32_t *  agg,
const int32_t   
)

Definition at line 428 of file RuntimeFunctions.cpp.

Referenced by agg_count_int32_skip_val().

428  {
429  return (*agg)++;
430 }

+ Here is the caller graph for this function:

ALWAYS_INLINE uint32_t agg_count_int32_skip_val ( uint32_t *  agg,
const int32_t  val,
const int32_t  skip_val 
)

Definition at line 540 of file RuntimeFunctions.cpp.

References agg_count_int32().

542  {
543  if (val != skip_val) {
544  return agg_count_int32(agg, val);
545  }
546  return *agg;
547 }
ALWAYS_INLINE uint32_t agg_count_int32(uint32_t *agg, const int32_t)

+ Here is the call graph for this function:

ALWAYS_INLINE uint64_t agg_count_skip_val ( uint64_t *  agg,
const int64_t  val,
const int64_t  skip_val 
)

Definition at line 531 of file RuntimeFunctions.cpp.

References agg_count().

533  {
534  if (val != skip_val) {
535  return agg_count(agg, val);
536  }
537  return *agg;
538 }
ALWAYS_INLINE uint64_t agg_count(uint64_t *agg, const int64_t)

+ Here is the call graph for this function:

ALWAYS_INLINE void agg_id ( int64_t *  agg,
const int64_t  val 
)

Definition at line 388 of file RuntimeFunctions.cpp.

388  {
389  *agg = val;
390 }
ALWAYS_INLINE void agg_id_double ( int64_t *  agg,
const double  val 
)

Definition at line 614 of file RuntimeFunctions.cpp.

614  {
615  *agg = *(reinterpret_cast<const int64_t*>(may_alias_ptr(&val)));
616 }
GPU_RT_STUB void agg_id_double_shared_slow ( int64_t *  agg,
const double *  val 
)

Definition at line 874 of file RuntimeFunctions.cpp.

874 {}
ALWAYS_INLINE void agg_id_float ( int32_t *  agg,
const float  val 
)

Definition at line 655 of file RuntimeFunctions.cpp.

655  {
656  *agg = *(reinterpret_cast<const int32_t*>(may_alias_ptr(&val)));
657 }
ALWAYS_INLINE void agg_max ( int64_t *  agg,
const int64_t  val 
)

Definition at line 380 of file RuntimeFunctions.cpp.

380  {
381  *agg = std::max(*agg, val);
382 }
ALWAYS_INLINE void agg_max_double ( int64_t *  agg,
const double  val 
)

Definition at line 604 of file RuntimeFunctions.cpp.

604  {
605  const auto r = std::max(*reinterpret_cast<const double*>(agg), val);
606  *agg = *(reinterpret_cast<const int64_t*>(may_alias_ptr(&r)));
607 }
ALWAYS_INLINE void agg_max_float ( int32_t *  agg,
const float  val 
)

Definition at line 645 of file RuntimeFunctions.cpp.

645  {
646  const auto r = std::max(*reinterpret_cast<const float*>(agg), val);
647  *agg = *(reinterpret_cast<const int32_t*>(may_alias_ptr(&r)));
648 }
GPU_RT_STUB void agg_max_int16_skip_val_shared ( int16_t *  agg,
const int16_t  val,
const int16_t  skip_val 
)

Definition at line 858 of file RuntimeFunctions.cpp.

860  {}
GPU_RT_STUB void agg_max_int8_skip_val_shared ( int8_t *  agg,
const int8_t  val,
const int8_t  skip_val 
)

Definition at line 862 of file RuntimeFunctions.cpp.

864  {}
ALWAYS_INLINE void agg_min ( int64_t *  agg,
const int64_t  val 
)

Definition at line 384 of file RuntimeFunctions.cpp.

384  {
385  *agg = std::min(*agg, val);
386 }
ALWAYS_INLINE void agg_min_double ( int64_t *  agg,
const double  val 
)

Definition at line 609 of file RuntimeFunctions.cpp.

609  {
610  const auto r = std::min(*reinterpret_cast<const double*>(agg), val);
611  *agg = *(reinterpret_cast<const int64_t*>(may_alias_ptr(&r)));
612 }
ALWAYS_INLINE void agg_min_float ( int32_t *  agg,
const float  val 
)

Definition at line 650 of file RuntimeFunctions.cpp.

650  {
651  const auto r = std::min(*reinterpret_cast<const float*>(agg), val);
652  *agg = *(reinterpret_cast<const int32_t*>(may_alias_ptr(&r)));
653 }
GPU_RT_STUB void agg_min_int16_skip_val_shared ( int16_t *  agg,
const int16_t  val,
const int16_t  skip_val 
)

Definition at line 866 of file RuntimeFunctions.cpp.

868  {}
GPU_RT_STUB void agg_min_int8_skip_val_shared ( int8_t *  agg,
const int8_t  val,
const int8_t  skip_val 
)

Definition at line 870 of file RuntimeFunctions.cpp.

872  {}
ALWAYS_INLINE int64_t agg_sum ( int64_t *  agg,
const int64_t  val 
)

Definition at line 374 of file RuntimeFunctions.cpp.

Referenced by agg_sum_skip_val().

374  {
375  const auto old = *agg;
376  *agg += val;
377  return old;
378 }

+ Here is the caller graph for this function:

ALWAYS_INLINE void agg_sum_double ( int64_t *  agg,
const double  val 
)

Definition at line 599 of file RuntimeFunctions.cpp.

599  {
600  const auto r = *reinterpret_cast<const double*>(agg) + val;
601  *agg = *reinterpret_cast<const int64_t*>(may_alias_ptr(&r));
602 }
GPU_RT_STUB void agg_sum_double_shared ( int64_t *  agg,
const double  val 
)

Definition at line 895 of file RuntimeFunctions.cpp.

895 {}
GPU_RT_STUB void agg_sum_double_skip_val_shared ( int64_t *  agg,
const double  val,
const double  skip_val 
)

Definition at line 897 of file RuntimeFunctions.cpp.

899  {}
ALWAYS_INLINE void agg_sum_float ( int32_t *  agg,
const float  val 
)

Definition at line 640 of file RuntimeFunctions.cpp.

640  {
641  const auto r = *reinterpret_cast<const float*>(agg) + val;
642  *agg = *reinterpret_cast<const int32_t*>(may_alias_ptr(&r));
643 }
GPU_RT_STUB void agg_sum_float_shared ( int32_t *  agg,
const float  val 
)

Definition at line 900 of file RuntimeFunctions.cpp.

900 {}
GPU_RT_STUB void agg_sum_float_skip_val_shared ( int32_t *  agg,
const float  val,
const float  skip_val 
)

Definition at line 902 of file RuntimeFunctions.cpp.

904  {}
ALWAYS_INLINE int32_t agg_sum_int32 ( int32_t *  agg,
const int32_t  val 
)

Definition at line 432 of file RuntimeFunctions.cpp.

Referenced by agg_sum_int32_skip_val().

432  {
433  const auto old = *agg;
434  *agg += val;
435  return old;
436 }

+ Here is the caller graph for this function:

GPU_RT_STUB int32_t agg_sum_int32_shared ( int32_t *  agg,
const int32_t  val 
)

Definition at line 885 of file RuntimeFunctions.cpp.

885  {
886  return 0;
887 }
ALWAYS_INLINE int32_t agg_sum_int32_skip_val ( int32_t *  agg,
const int32_t  val,
const int32_t  skip_val 
)

Definition at line 517 of file RuntimeFunctions.cpp.

References agg_sum_int32().

519  {
520  const auto old = *agg;
521  if (val != skip_val) {
522  if (old != skip_val) {
523  return agg_sum_int32(agg, val);
524  } else {
525  *agg = val;
526  }
527  }
528  return old;
529 }
ALWAYS_INLINE int32_t agg_sum_int32(int32_t *agg, const int32_t val)

+ Here is the call graph for this function:

GPU_RT_STUB int32_t agg_sum_int32_skip_val_shared ( int32_t *  agg,
const int32_t  val,
const int32_t  skip_val 
)

Definition at line 889 of file RuntimeFunctions.cpp.

891  {
892  return 0;
893 }
GPU_RT_STUB int64_t agg_sum_shared ( int64_t *  agg,
const int64_t  val 
)

Definition at line 876 of file RuntimeFunctions.cpp.

876  {
877  return 0;
878 }
ALWAYS_INLINE int64_t agg_sum_skip_val ( int64_t *  agg,
const int64_t  val,
const int64_t  skip_val 
)

Definition at line 503 of file RuntimeFunctions.cpp.

References agg_sum().

Referenced by Executor::reduceResults().

505  {
506  const auto old = *agg;
507  if (val != skip_val) {
508  if (old != skip_val) {
509  return agg_sum(agg, val);
510  } else {
511  *agg = val;
512  }
513  }
514  return old;
515 }
ALWAYS_INLINE int64_t agg_sum(int64_t *agg, const int64_t val)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GPU_RT_STUB int64_t agg_sum_skip_val_shared ( int64_t *  agg,
const int64_t  val,
const int64_t  skip_val 
)

Definition at line 880 of file RuntimeFunctions.cpp.

882  {
883  return 0;
884 }
ALWAYS_INLINE int8_t bit_is_set ( const int64_t  bitset,
const int64_t  val,
const int64_t  min_val,
const int64_t  max_val,
const int64_t  null_val,
const int8_t  null_bool_val 
)

Definition at line 352 of file RuntimeFunctions.cpp.

357  {
358  if (val == null_val) {
359  return null_bool_val;
360  }
361  if (val < min_val || val > max_val) {
362  return 0;
363  }
364  if (!bitset) {
365  return 0;
366  }
367  const uint64_t bitmap_idx = val - min_val;
368  return (reinterpret_cast<const int8_t*>(bitset))[bitmap_idx >> 3] &
369  (1 << (bitmap_idx & 7))
370  ? 1
371  : 0;
372 }
ALWAYS_INLINE DEVICE int32_t char_length ( const char *  str,
const int32_t  str_len 
)

Definition at line 1246 of file RuntimeFunctions.cpp.

Referenced by ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visit().

1247  {
1248  return str_len;
1249 }

+ Here is the caller graph for this function:

ALWAYS_INLINE DEVICE int32_t char_length_nullable ( const char *  str,
const int32_t  str_len,
const int32_t  int_null 
)

Definition at line 1251 of file RuntimeFunctions.cpp.

1253  {
1254  if (!str) {
1255  return int_null;
1256  }
1257  return str_len;
1258 }
ALWAYS_INLINE DEVICE bool check_interrupt ( )

Definition at line 1407 of file RuntimeFunctions.cpp.

References check_interrupt_init(), INT_CHECK, and runtime_interrupt_flag.

1407  {
1408  if (check_interrupt_init(static_cast<unsigned>(INT_CHECK))) {
1409  return true;
1410  }
1411  return false;
1412 }
bool check_interrupt_init(unsigned command)

+ Here is the call graph for this function:

bool check_interrupt_init ( unsigned  command)

Definition at line 1414 of file RuntimeFunctions.cpp.

References INT_ABORT, INT_CHECK, INT_RESET, and runtime_interrupt_flag.

Referenced by check_interrupt(), Executor::interrupt(), and Executor::resetInterrupt().

1414  {
1415  static std::atomic_bool runtime_interrupt_flag{false};
1416 
1417  if (command == static_cast<unsigned>(INT_CHECK)) {
1418  if (runtime_interrupt_flag.load()) {
1419  return true;
1420  }
1421  return false;
1422  }
1423  if (command == static_cast<unsigned>(INT_ABORT)) {
1424  runtime_interrupt_flag.store(true);
1425  return false;
1426  }
1427  if (command == static_cast<unsigned>(INT_RESET)) {
1428  runtime_interrupt_flag.store(false);
1429  return false;
1430  }
1431  return false;
1432 }
__device__ int32_t runtime_interrupt_flag
Definition: cuda_mapd_rt.cu:96

+ Here is the caller graph for this function:

ALWAYS_INLINE int32_t checked_single_agg_id ( int64_t *  agg,
const int64_t  val,
const int64_t  null_val 
)

Definition at line 392 of file RuntimeFunctions.cpp.

394  {
395  if (val == null_val) {
396  return 0;
397  }
398 
399  if (*agg == val) {
400  return 0;
401  } else if (*agg == null_val) {
402  *agg = val;
403  return 0;
404  } else {
405  // see Execute::ERR_SINGLE_VALUE_FOUND_MULTIPLE_VALUES
406  return 15;
407  }
408 }
ALWAYS_INLINE int32_t checked_single_agg_id_double ( int64_t *  agg,
const double  val,
const double  null_val 
)

Definition at line 618 of file RuntimeFunctions.cpp.

620  {
621  if (val == null_val) {
622  return 0;
623  }
624 
625  if (*agg == *(reinterpret_cast<const int64_t*>(may_alias_ptr(&val)))) {
626  return 0;
627  } else if (*agg == *(reinterpret_cast<const int64_t*>(may_alias_ptr(&null_val)))) {
628  *agg = *(reinterpret_cast<const int64_t*>(may_alias_ptr(&val)));
629  return 0;
630  } else {
631  // see Execute::ERR_SINGLE_VALUE_FOUND_MULTIPLE_VALUES
632  return 15;
633  }
634 }
GPU_RT_STUB int32_t checked_single_agg_id_double_shared ( int64_t *  agg,
const double  val,
const double  null_val 
)

Definition at line 846 of file RuntimeFunctions.cpp.

848  {
849  return 0;
850 }
ALWAYS_INLINE int32_t checked_single_agg_id_float ( int32_t *  agg,
const float  val,
const float  null_val 
)

Definition at line 659 of file RuntimeFunctions.cpp.

661  {
662  if (val == null_val) {
663  return 0;
664  }
665 
666  if (*agg == *(reinterpret_cast<const int32_t*>(may_alias_ptr(&val)))) {
667  return 0;
668  } else if (*agg == *(reinterpret_cast<const int32_t*>(may_alias_ptr(&null_val)))) {
669  *agg = *(reinterpret_cast<const int32_t*>(may_alias_ptr(&val)));
670  return 0;
671  } else {
672  // see Execute::ERR_SINGLE_VALUE_FOUND_MULTIPLE_VALUES
673  return 15;
674  }
675 }
GPU_RT_STUB int32_t checked_single_agg_id_float_shared ( int32_t *  agg,
const float  val,
const float  null_val 
)

Definition at line 852 of file RuntimeFunctions.cpp.

854  {
855  return 0;
856 }
GPU_RT_STUB int32_t checked_single_agg_id_int16_shared ( int16_t *  agg,
const int16_t  val,
const int16_t  null_val 
)

Definition at line 834 of file RuntimeFunctions.cpp.

836  {
837  return 0;
838 }
GPU_RT_STUB int32_t checked_single_agg_id_int32_shared ( int32_t *  agg,
const int32_t  val,
const int32_t  null_val 
)

Definition at line 828 of file RuntimeFunctions.cpp.

830  {
831  return 0;
832 }
GPU_RT_STUB int32_t checked_single_agg_id_int8_shared ( int8_t *  agg,
const int8_t  val,
const int8_t  null_val 
)

Definition at line 839 of file RuntimeFunctions.cpp.

841  {
842  return 0;
843 }
GPU_RT_STUB int32_t checked_single_agg_id_shared ( int64_t *  agg,
const int64_t  val,
const int64_t  null_val 
)

Definition at line 821 of file RuntimeFunctions.cpp.

823  {
824  return 0;
825 }
ALWAYS_INLINE int64_t decimal_ceil ( const int64_t  x,
const int64_t  scale 
)

Definition at line 745 of file RuntimeFunctions.cpp.

References decimal_floor().

745  {
746  return decimal_floor(x, scale) + (x % scale ? scale : 0);
747 }
ALWAYS_INLINE int64_t decimal_floor(const int64_t x, const int64_t scale)

+ Here is the call graph for this function:

ALWAYS_INLINE int64_t decimal_floor ( const int64_t  x,
const int64_t  scale 
)

Definition at line 735 of file RuntimeFunctions.cpp.

Referenced by decimal_ceil().

735  {
736  if (x >= 0) {
737  return x / scale * scale;
738  }
739  if (!(x % scale)) {
740  return x;
741  }
742  return x / scale * scale - scale;
743 }

+ Here is the caller graph for this function:

GPU_RT_STUB int64_t* declare_dynamic_shared_memory ( )

Definition at line 942 of file RuntimeFunctions.cpp.

942  {
943  return nullptr;
944 }
ALWAYS_INLINE int32_t extract_str_len ( const uint64_t  str_and_len)

Definition at line 1221 of file RuntimeFunctions.cpp.

Referenced by extract_str_len_noinline().

1221  {
1222  return static_cast<int64_t>(str_and_len) >> 48;
1223 }

+ Here is the caller graph for this function:

NEVER_INLINE int32_t extract_str_len_noinline ( const uint64_t  str_and_len)

Definition at line 1229 of file RuntimeFunctions.cpp.

References extract_str_len().

Referenced by string_compress().

1229  {
1230  return extract_str_len(str_and_len);
1231 }
ALWAYS_INLINE int32_t extract_str_len(const uint64_t str_and_len)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ALWAYS_INLINE int8_t* extract_str_ptr ( const uint64_t  str_and_len)

Definition at line 1217 of file RuntimeFunctions.cpp.

Referenced by extract_str_ptr_noinline().

1217  {
1218  return reinterpret_cast<int8_t*>(str_and_len & 0xffffffffffff);
1219 }

+ Here is the caller graph for this function:

NEVER_INLINE int8_t* extract_str_ptr_noinline ( const uint64_t  str_and_len)

Definition at line 1225 of file RuntimeFunctions.cpp.

References extract_str_ptr().

Referenced by string_compress().

1225  {
1226  return extract_str_ptr(str_and_len);
1227 }
ALWAYS_INLINE int8_t * extract_str_ptr(const uint64_t str_and_len)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ALWAYS_INLINE int64_t floor_div_lhs ( const int64_t  dividend,
const int64_t  divisor 
)

Definition at line 207 of file RuntimeFunctions.cpp.

Referenced by floor_div_nullable_lhs().

208  {
209  return (dividend < 0 ? dividend - (divisor - 1) : dividend) / divisor;
210 }

+ Here is the caller graph for this function:

ALWAYS_INLINE int64_t floor_div_nullable_lhs ( const int64_t  dividend,
const int64_t  divisor,
const int64_t  null_val 
)

Definition at line 214 of file RuntimeFunctions.cpp.

References floor_div_lhs().

216  {
217  return dividend == null_val ? null_val : floor_div_lhs(dividend, divisor);
218 }
ALWAYS_INLINE int64_t floor_div_lhs(const int64_t dividend, const int64_t divisor)

+ Here is the call graph for this function:

GPU_RT_STUB void force_sync ( )

Definition at line 906 of file RuntimeFunctions.cpp.

906 {}
GPU_RT_STUB int64_t get_block_index ( )

Definition at line 946 of file RuntimeFunctions.cpp.

946  {
947  return 0;
948 }
ALWAYS_INLINE int32_t get_error_code ( int32_t *  error_codes)

Definition at line 965 of file RuntimeFunctions.cpp.

References pos_start_impl().

965  {
966  return error_codes[pos_start_impl(nullptr)];
967 }
__device__ int32_t pos_start_impl(const int32_t *row_index_resume)
Definition: cuda_mapd_rt.cu:28

+ Here is the call graph for this function:

ALWAYS_INLINE int64_t* get_group_value_fast_keyless ( int64_t *  groups_buffer,
const int64_t  key,
const int64_t  min_key,
const int64_t  ,
const uint32_t  row_size_quad 
)

Definition at line 1197 of file RuntimeFunctions.cpp.

1202  {
1203  return groups_buffer + row_size_quad * (key - min_key);
1204 }
ALWAYS_INLINE int64_t* get_group_value_fast_keyless_semiprivate ( int64_t *  groups_buffer,
const int64_t  key,
const int64_t  min_key,
const int64_t  ,
const uint32_t  row_size_quad,
const uint8_t  thread_warp_idx,
const uint8_t  warp_size 
)

Definition at line 1206 of file RuntimeFunctions.cpp.

1213  {
1214  return groups_buffer + row_size_quad * (warp_size * (key - min_key) + thread_warp_idx);
1215 }
__device__ int8_t thread_warp_idx(const int8_t warp_sz)
Definition: cuda_mapd_rt.cu:40
template<typename T >
ALWAYS_INLINE int64_t* get_matching_group_value ( int64_t *  groups_buffer,
const uint32_t  h,
const T *  key,
const uint32_t  key_count,
const uint32_t  row_size_quad 
)

Definition at line 1027 of file RuntimeFunctions.cpp.

References align_to_int64(), and omnisci.dtypes::T.

1031  {
1032  auto off = h * row_size_quad;
1033  auto row_ptr = reinterpret_cast<T*>(groups_buffer + off);
1034  if (*row_ptr == get_empty_key<T>()) {
1035  memcpy(row_ptr, key, key_count * sizeof(T));
1036  auto row_ptr_i8 = reinterpret_cast<int8_t*>(row_ptr + key_count);
1037  return reinterpret_cast<int64_t*>(align_to_int64(row_ptr_i8));
1038  }
1039  if (memcmp(row_ptr, key, key_count * sizeof(T)) == 0) {
1040  auto row_ptr_i8 = reinterpret_cast<int8_t*>(row_ptr + key_count);
1041  return reinterpret_cast<int64_t*>(align_to_int64(row_ptr_i8));
1042  }
1043  return nullptr;
1044 }
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)

+ Here is the call graph for this function:

ALWAYS_INLINE int64_t* get_matching_group_value ( int64_t *  groups_buffer,
const uint32_t  h,
const int64_t *  key,
const uint32_t  key_count,
const uint32_t  key_width,
const uint32_t  row_size_quad 
)

Definition at line 1046 of file RuntimeFunctions.cpp.

References get_matching_group_value().

1051  {
1052  switch (key_width) {
1053  case 4:
1054  return get_matching_group_value(groups_buffer,
1055  h,
1056  reinterpret_cast<const int32_t*>(key),
1057  key_count,
1058  row_size_quad);
1059  case 8:
1060  return get_matching_group_value(groups_buffer, h, key, key_count, row_size_quad);
1061  default:;
1062  }
1063  return nullptr;
1064 }
__device__ int64_t * get_matching_group_value(int64_t *groups_buffer, const uint32_t h, const T *key, const uint32_t key_count, const uint32_t row_size_quad)

+ Here is the call graph for this function:

ALWAYS_INLINE int64_t* get_matching_group_value_columnar ( int64_t *  groups_buffer,
const uint32_t  h,
const int64_t *  key,
const uint32_t  key_qw_count,
const size_t  entry_count 
)

Definition at line 1114 of file RuntimeFunctions.cpp.

References EMPTY_KEY_64.

1119  {
1120  auto off = h;
1121  if (groups_buffer[off] == EMPTY_KEY_64) {
1122  for (size_t i = 0; i < key_qw_count; ++i) {
1123  groups_buffer[off] = key[i];
1124  off += entry_count;
1125  }
1126  return &groups_buffer[off];
1127  }
1128  off = h;
1129  for (size_t i = 0; i < key_qw_count; ++i) {
1130  if (groups_buffer[off] != key[i]) {
1131  return nullptr;
1132  }
1133  off += entry_count;
1134  }
1135  return &groups_buffer[off];
1136 }
#define EMPTY_KEY_64
template<typename T >
ALWAYS_INLINE int32_t get_matching_group_value_columnar_slot ( int64_t *  groups_buffer,
const uint32_t  entry_count,
const uint32_t  h,
const T *  key,
const uint32_t  key_count 
)

Definition at line 1067 of file RuntimeFunctions.cpp.

References omnisci.dtypes::T.

1071  {
1072  auto off = h;
1073  auto key_buffer = reinterpret_cast<T*>(groups_buffer);
1074  if (key_buffer[off] == get_empty_key<T>()) {
1075  for (size_t i = 0; i < key_count; ++i) {
1076  key_buffer[off] = key[i];
1077  off += entry_count;
1078  }
1079  return h;
1080  }
1081  off = h;
1082  for (size_t i = 0; i < key_count; ++i) {
1083  if (key_buffer[off] != key[i]) {
1084  return -1;
1085  }
1086  off += entry_count;
1087  }
1088  return h;
1089 }
ALWAYS_INLINE int32_t get_matching_group_value_columnar_slot ( int64_t *  groups_buffer,
const uint32_t  entry_count,
const uint32_t  h,
const int64_t *  key,
const uint32_t  key_count,
const uint32_t  key_width 
)

Definition at line 1092 of file RuntimeFunctions.cpp.

References get_matching_group_value_columnar_slot().

1097  {
1098  switch (key_width) {
1099  case 4:
1100  return get_matching_group_value_columnar_slot(groups_buffer,
1101  entry_count,
1102  h,
1103  reinterpret_cast<const int32_t*>(key),
1104  key_count);
1105  case 8:
1107  groups_buffer, entry_count, h, key, key_count);
1108  default:
1109  return -1;
1110  }
1111  return -1;
1112 }
__device__ int32_t get_matching_group_value_columnar_slot(int64_t *groups_buffer, const uint32_t entry_count, const uint32_t h, const T *key, const uint32_t key_count)

+ Here is the call graph for this function:

ALWAYS_INLINE int64_t* get_matching_group_value_perfect_hash ( int64_t *  groups_buffer,
const uint32_t  hashed_index,
const int64_t *  key,
const uint32_t  key_count,
const uint32_t  row_size_quad 
)

Definition at line 1149 of file RuntimeFunctions.cpp.

References EMPTY_KEY_64.

1154  {
1155  uint32_t off = hashed_index * row_size_quad;
1156  if (groups_buffer[off] == EMPTY_KEY_64) {
1157  for (uint32_t i = 0; i < key_count; ++i) {
1158  groups_buffer[off + i] = key[i];
1159  }
1160  }
1161  return groups_buffer + off + key_count;
1162 }
#define EMPTY_KEY_64
ALWAYS_INLINE int64_t* get_matching_group_value_perfect_hash_keyless ( int64_t *  groups_buffer,
const uint32_t  hashed_index,
const uint32_t  row_size_quad 
)

For a particular hashed index (only used with multi-column perfect hash group by) it returns the row-wise offset of the group in the output buffer. Since it is intended for keyless hash use, it assumes there is no group columns prepending the output buffer.

Definition at line 1170 of file RuntimeFunctions.cpp.

1173  {
1174  return groups_buffer + row_size_quad * hashed_index;
1175 }
GPU_RT_STUB int64_t get_thread_index ( )

Definition at line 938 of file RuntimeFunctions.cpp.

938  {
939  return 0;
940 }
NEVER_INLINE int32_t group_buff_idx_impl ( )

Definition at line 926 of file RuntimeFunctions.cpp.

References pos_start_impl().

926  {
927  return pos_start_impl(nullptr);
928 }
__device__ int32_t pos_start_impl(const int32_t *row_index_resume)
Definition: cuda_mapd_rt.cu:28

+ Here is the call graph for this function:

NEVER_INLINE void init_columnar_group_by_buffer_gpu ( int64_t *  groups_buffer,
const int64_t *  init_vals,
const uint32_t  groups_buffer_entry_count,
const uint32_t  key_qw_count,
const uint32_t  agg_col_count,
const bool  keyless,
const bool  blocks_share_memory,
const int32_t  frag_idx 
)

Definition at line 1001 of file RuntimeFunctions.cpp.

1009  {
1010  // the body is not really needed, just make sure the call is not optimized away
1011  assert(groups_buffer);
1012 }
NEVER_INLINE void init_group_by_buffer_gpu ( int64_t *  groups_buffer,
const int64_t *  init_vals,
const uint32_t  groups_buffer_entry_count,
const uint32_t  key_qw_count,
const uint32_t  agg_col_count,
const bool  keyless,
const int8_t  warp_size 
)

Definition at line 989 of file RuntimeFunctions.cpp.

996  {
997  // the body is not really needed, just make sure the call is not optimized away
998  assert(groups_buffer);
999 }
NEVER_INLINE void init_group_by_buffer_impl ( int64_t *  groups_buffer,
const int64_t *  init_vals,
const uint32_t  groups_buffer_entry_count,
const uint32_t  key_qw_count,
const uint32_t  agg_col_count,
const bool  keyless,
const int8_t  warp_size 
)

Definition at line 1014 of file RuntimeFunctions.cpp.

1021  {
1022  // the body is not really needed, just make sure the call is not optimized away
1023  assert(groups_buffer);
1024 }
int64_t* init_shared_mem ( const int64_t *  global_groups_buffer,
const int32_t  groups_buffer_size 
)

Definition at line 984 of file RuntimeFunctions.cpp.

985  {
986  return nullptr;
987 }
NEVER_INLINE const int64_t* init_shared_mem_nop ( const int64_t *  groups_buffer,
const int32_t  groups_buffer_size 
)

Definition at line 971 of file RuntimeFunctions.cpp.

973  {
974  return groups_buffer;
975 }
ALWAYS_INLINE DEVICE int32_t key_for_string_encoded ( const int32_t  str_id)

Definition at line 1260 of file RuntimeFunctions.cpp.

1260  {
1261  return str_id;
1262 }
NEVER_INLINE void linear_probabilistic_count ( uint8_t *  bitmap,
const uint32_t  bitmap_bytes,
const uint8_t *  key_bytes,
const uint32_t  key_len 
)

Definition at line 1315 of file RuntimeFunctions.cpp.

References MurmurHash1().

1318  {
1319  const uint32_t bit_pos = MurmurHash1(key_bytes, key_len, 0) % (bitmap_bytes * 8);
1320  const uint32_t word_idx = bit_pos / 32;
1321  const uint32_t bit_idx = bit_pos % 32;
1322  reinterpret_cast<uint32_t*>(bitmap)[word_idx] |= 1 << bit_idx;
1323 }
NEVER_INLINE DEVICE uint32_t MurmurHash1(const void *key, int len, const uint32_t seed)
Definition: MurmurHash.cpp:20

+ Here is the call graph for this function:

ALWAYS_INLINE double load_avg_decimal ( const int64_t *  sum,
const int64_t *  count,
const double  null_val,
const uint32_t  scale 
)

Definition at line 1294 of file RuntimeFunctions.cpp.

1297  {
1298  return *count != 0 ? (static_cast<double>(*sum) / pow(10, scale)) / *count : null_val;
1299 }
ALWAYS_INLINE double load_avg_double ( const int64_t *  agg,
const int64_t *  count,
const double  null_val 
)

Definition at line 1301 of file RuntimeFunctions.cpp.

1303  {
1304  return *count != 0 ? *reinterpret_cast<const double*>(may_alias_ptr(agg)) / *count
1305  : null_val;
1306 }
ALWAYS_INLINE double load_avg_float ( const int32_t *  agg,
const int32_t *  count,
const double  null_val 
)

Definition at line 1308 of file RuntimeFunctions.cpp.

1310  {
1311  return *count != 0 ? *reinterpret_cast<const float*>(may_alias_ptr(agg)) / *count
1312  : null_val;
1313 }
ALWAYS_INLINE double load_avg_int ( const int64_t *  sum,
const int64_t *  count,
const double  null_val 
)

Definition at line 1288 of file RuntimeFunctions.cpp.

1290  {
1291  return *count != 0 ? static_cast<double>(*sum) / *count : null_val;
1292 }
ALWAYS_INLINE double load_double ( const int64_t *  agg)

Definition at line 1280 of file RuntimeFunctions.cpp.

1280  {
1281  return *reinterpret_cast<const double*>(may_alias_ptr(agg));
1282 }
ALWAYS_INLINE float load_float ( const int32_t *  agg)

Definition at line 1284 of file RuntimeFunctions.cpp.

1284  {
1285  return *reinterpret_cast<const float*>(may_alias_ptr(agg));
1286 }
ALWAYS_INLINE int8_t logical_and ( const int8_t  lhs,
const int8_t  rhs,
const int8_t  null_val 
)

Definition at line 272 of file RuntimeFunctions.cpp.

274  {
275  if (lhs == null_val) {
276  return rhs == 0 ? rhs : null_val;
277  }
278  if (rhs == null_val) {
279  return lhs == 0 ? lhs : null_val;
280  }
281  return (lhs && rhs) ? 1 : 0;
282 }
ALWAYS_INLINE int8_t logical_not ( const int8_t  operand,
const int8_t  null_val 
)

Definition at line 268 of file RuntimeFunctions.cpp.

268  {
269  return operand == null_val ? operand : (operand ? 0 : 1);
270 }
ALWAYS_INLINE int8_t logical_or ( const int8_t  lhs,
const int8_t  rhs,
const int8_t  null_val 
)

Definition at line 284 of file RuntimeFunctions.cpp.

286  {
287  if (lhs == null_val) {
288  return rhs == 0 ? null_val : rhs;
289  }
290  if (rhs == null_val) {
291  return lhs == 0 ? null_val : lhs;
292  }
293  return (lhs || rhs) ? 1 : 0;
294 }
void multifrag_query ( const int8_t ***  col_buffers,
const uint64_t *  num_fragments,
const int64_t *  num_rows,
const uint64_t *  frag_row_offsets,
const int32_t *  max_matched,
int32_t *  total_matched,
const int64_t *  init_agg_value,
int64_t **  out,
int32_t *  error_code,
const uint32_t *  num_tables_ptr,
const int64_t *  join_hash_tables 
)

Definition at line 1382 of file RuntimeFunctions.cpp.

References query_stub().

1392  {
1393  for (uint32_t i = 0; i < *num_fragments; ++i) {
1394  query_stub(col_buffers ? col_buffers[i] : nullptr,
1395  &num_rows[i * (*num_tables_ptr)],
1396  &frag_row_offsets[i * (*num_tables_ptr)],
1397  max_matched,
1398  init_agg_value,
1399  out,
1400  i,
1401  join_hash_tables,
1402  total_matched,
1403  error_code);
1404  }
1405 }
NEVER_INLINE void query_stub(const int8_t **col_buffers, const int64_t *num_rows, const uint64_t *frag_row_offsets, const int32_t *max_matched, const int64_t *init_agg_value, int64_t **out, uint32_t frag_idx, const int64_t *join_hash_tables, int32_t *error_code, int32_t *total_matched)

+ Here is the call graph for this function:

void multifrag_query_hoisted_literals ( const int8_t ***  col_buffers,
const uint64_t *  num_fragments,
const int8_t *  literals,
const int64_t *  num_rows,
const uint64_t *  frag_row_offsets,
const int32_t *  max_matched,
int32_t *  total_matched,
const int64_t *  init_agg_value,
int64_t **  out,
int32_t *  error_code,
const uint32_t *  num_tables_ptr,
const int64_t *  join_hash_tables 
)

Definition at line 1341 of file RuntimeFunctions.cpp.

References query_stub_hoisted_literals().

1352  {
1353  for (uint32_t i = 0; i < *num_fragments; ++i) {
1354  query_stub_hoisted_literals(col_buffers ? col_buffers[i] : nullptr,
1355  literals,
1356  &num_rows[i * (*num_tables_ptr)],
1357  &frag_row_offsets[i * (*num_tables_ptr)],
1358  max_matched,
1359  init_agg_value,
1360  out,
1361  i,
1362  join_hash_tables,
1363  total_matched,
1364  error_code);
1365  }
1366 }
NEVER_INLINE void query_stub_hoisted_literals(const int8_t **col_buffers, const int8_t *literals, const int64_t *num_rows, const uint64_t *frag_row_offsets, const int32_t *max_matched, const int64_t *init_agg_value, int64_t **out, uint32_t frag_idx, const int64_t *join_hash_tables, int32_t *error_code, int32_t *total_matched)

+ Here is the call graph for this function:

ALWAYS_INLINE double percent_window_func ( const int64_t  output_buff,
const int64_t  pos 
)

Definition at line 1275 of file RuntimeFunctions.cpp.

1276  {
1277  return reinterpret_cast<const double*>(output_buff)[pos];
1278 }
NEVER_INLINE int32_t pos_start_impl ( int32_t *  error_code)

Definition at line 917 of file RuntimeFunctions.cpp.

917  {
918  int32_t row_index_resume{0};
919  if (error_code) {
920  row_index_resume = error_code[0];
921  error_code[0] = 0;
922  }
923  return row_index_resume;
924 }
NEVER_INLINE int32_t pos_step_impl ( )

Definition at line 930 of file RuntimeFunctions.cpp.

930  {
931  return 1;
932 }
NEVER_INLINE void query_stub ( const int8_t **  col_buffers,
const int64_t *  num_rows,
const uint64_t *  frag_row_offsets,
const int32_t *  max_matched,
const int64_t *  init_agg_value,
int64_t **  out,
uint32_t  frag_idx,
const int64_t *  join_hash_tables,
int32_t *  error_code,
int32_t *  total_matched 
)

Definition at line 1368 of file RuntimeFunctions.cpp.

Referenced by multifrag_query().

1377  {
1378  assert(col_buffers || num_rows || frag_row_offsets || max_matched || init_agg_value ||
1379  out || frag_idx || error_code || join_hash_tables || total_matched);
1380 }

+ Here is the caller graph for this function:

NEVER_INLINE void query_stub_hoisted_literals ( const int8_t **  col_buffers,
const int8_t *  literals,
const int64_t *  num_rows,
const uint64_t *  frag_row_offsets,
const int32_t *  max_matched,
const int64_t *  init_agg_value,
int64_t **  out,
uint32_t  frag_idx,
const int64_t *  join_hash_tables,
int32_t *  error_code,
int32_t *  total_matched 
)

Definition at line 1325 of file RuntimeFunctions.cpp.

Referenced by multifrag_query_hoisted_literals().

1335  {
1336  assert(col_buffers || literals || num_rows || frag_row_offsets || max_matched ||
1337  init_agg_value || out || frag_idx || error_code || join_hash_tables ||
1338  total_matched);
1339 }

+ Here is the caller graph for this function:

ALWAYS_INLINE void record_error_code ( const int32_t  err_code,
int32_t *  error_codes 
)

Definition at line 952 of file RuntimeFunctions.cpp.

References pos_start_impl().

953  {
954  // NB: never override persistent error codes (with code greater than zero).
955  // On GPU, a projection query with a limit can run out of slots without it
956  // being an actual error if the limit has been hit. If a persistent error
957  // (division by zero, for example) occurs before running out of slots, we
958  // have to avoid overriding it, because there's a risk that the query would
959  // go through if we override with a potentially benign out-of-slots code.
960  if (err_code && error_codes[pos_start_impl(nullptr)] <= 0) {
961  error_codes[pos_start_impl(nullptr)] = err_code;
962  }
963 }
__device__ int32_t pos_start_impl(const int32_t *row_index_resume)
Definition: cuda_mapd_rt.cu:28

+ Here is the call graph for this function:

ALWAYS_INLINE int64_t row_number_window_func ( const int64_t  output_buff,
const int64_t  pos 
)

Definition at line 1270 of file RuntimeFunctions.cpp.

1271  {
1272  return reinterpret_cast<const int64_t*>(output_buff)[pos];
1273 }
ALWAYS_INLINE DEVICE bool sample_ratio ( const double  proportion,
const int64_t  row_offset 
)

Definition at line 1264 of file RuntimeFunctions.cpp.

Referenced by ScalarExprVisitor< std::unordered_set< InputColDescriptor > >::visit().

1265  {
1266  const int64_t threshold = 4294967296 * proportion;
1267  return (row_offset * 2654435761) % 4294967296 < threshold;
1268 }

+ Here is the caller graph for this function:

ALWAYS_INLINE int64_t scale_decimal_down_not_nullable ( const int64_t  operand,
const int64_t  scale,
const int64_t  null_val 
)

Definition at line 197 of file RuntimeFunctions.cpp.

199  {
200  int64_t tmp = scale >> 1;
201  tmp = operand >= 0 ? operand + tmp : operand - tmp;
202  return tmp / scale;
203 }
ALWAYS_INLINE int64_t scale_decimal_down_nullable ( const int64_t  operand,
const int64_t  scale,
const int64_t  null_val 
)

Definition at line 184 of file RuntimeFunctions.cpp.

186  {
187  // rounded scale down of a decimal
188  if (operand == null_val) {
189  return null_val;
190  }
191 
192  int64_t tmp = scale >> 1;
193  tmp = operand >= 0 ? operand + tmp : operand - tmp;
194  return tmp / scale;
195 }
ALWAYS_INLINE int64_t scale_decimal_up ( const int64_t  operand,
const uint64_t  scale,
const int64_t  operand_null_val,
const int64_t  result_null_val 
)

Definition at line 177 of file RuntimeFunctions.cpp.

180  {
181  return operand != operand_null_val ? operand * scale : result_null_val;
182 }
ALWAYS_INLINE void set_matching_group_value_perfect_hash_columnar ( int64_t *  groups_buffer,
const uint32_t  hashed_index,
const int64_t *  key,
const uint32_t  key_count,
const uint32_t  entry_count 
)

Definition at line 1181 of file RuntimeFunctions.cpp.

References EMPTY_KEY_64.

1186  {
1187  if (groups_buffer[hashed_index] == EMPTY_KEY_64) {
1188  for (uint32_t i = 0; i < key_count; i++) {
1189  groups_buffer[i * entry_count + hashed_index] = key[i];
1190  }
1191  }
1192 }
#define EMPTY_KEY_64
ALWAYS_INLINE uint64_t string_pack ( const int8_t *  ptr,
const int32_t  len 
)

Definition at line 1233 of file RuntimeFunctions.cpp.

1233  {
1234  return (reinterpret_cast<const uint64_t>(ptr) & 0xffffffffffff) |
1235  (static_cast<const uint64_t>(len) << 48);
1236 }
GPU_RT_STUB void sync_threadblock ( )

Definition at line 910 of file RuntimeFunctions.cpp.

910 {}
GPU_RT_STUB void sync_warp ( )

Definition at line 908 of file RuntimeFunctions.cpp.

908 {}
GPU_RT_STUB void sync_warp_protected ( int64_t  thread_pos,
int64_t  row_count 
)

Definition at line 909 of file RuntimeFunctions.cpp.

909 {}
GPU_RT_STUB int8_t thread_warp_idx ( const int8_t  warp_sz)

Definition at line 934 of file RuntimeFunctions.cpp.

934  {
935  return 0;
936 }
GPU_RT_STUB void write_back_non_grouped_agg ( int64_t *  input_buffer,
int64_t *  output_buffer,
const int32_t  num_agg_cols 
)

Definition at line 912 of file RuntimeFunctions.cpp.

914  {};
NEVER_INLINE void write_back_nop ( int64_t *  dest,
int64_t *  src,
const int32_t  sz 
)

Definition at line 977 of file RuntimeFunctions.cpp.

979  {
980  // the body is not really needed, just make sure the call is not optimized away
981  assert(dest);
982 }