OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ResultSetReduction.cpp File Reference

Reduction part of the row set interface. More...

#include "DynamicWatchdog.h"
#include "Execute.h"
#include "ResultSet.h"
#include "ResultSetReductionInterpreter.h"
#include "ResultSetReductionJIT.h"
#include "RuntimeFunctions.h"
#include "Shared/SqlTypesLayout.h"
#include "Shared/likely.h"
#include "Shared/thread_count.h"
#include <llvm/ExecutionEngine/GenericValue.h>
#include <algorithm>
#include <future>
#include <numeric>
+ Include dependency graph for ResultSetReduction.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{ResultSetReduction.cpp}
 

Macros

#define mapd_cas(address, compare, val)   __sync_val_compare_and_swap(address, compare, val)
 
#define cas_cst(ptr, expected, desired)
 
#define store_cst(ptr, val)   __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST)
 
#define load_cst(ptr)   __atomic_load_n(ptr, __ATOMIC_SEQ_CST)
 
#define AGGREGATE_ONE_VALUE(agg_kind__, val_ptr__, other_ptr__, chosen_bytes__, agg_info__)
 
#define AGGREGATE_ONE_NULLABLE_VALUE(agg_kind__, val_ptr__, other_ptr__, init_val__, chosen_bytes__, agg_info__)
 
#define AGGREGATE_ONE_COUNT(val_ptr__, other_ptr__, chosen_bytes__)
 
#define AGGREGATE_ONE_NULLABLE_COUNT(val_ptr__, other_ptr__, init_val__, chosen_bytes__, agg_info__)
 
#define AGGREGATE_ONE_VALUE_SMALL(agg_kind__, val_ptr__, other_ptr__, chosen_bytes__, agg_info__)
 
#define AGGREGATE_ONE_NULLABLE_VALUE_SMALL(agg_kind__, val_ptr__, other_ptr__, init_val__, chosen_bytes__, agg_info__)
 

Functions

bool anonymous_namespace{ResultSetReduction.cpp}::use_multithreaded_reduction (const size_t entry_count)
 
size_t anonymous_namespace{ResultSetReduction.cpp}::get_row_qw_count (const QueryMemoryDescriptor &query_mem_desc)
 
std::vector< int64_t > anonymous_namespace{ResultSetReduction.cpp}::make_key (const int64_t *buff, const size_t entry_count, const size_t key_count)
 
void anonymous_namespace{ResultSetReduction.cpp}::fill_slots (int64_t *dst_entry, const size_t dst_entry_count, const int64_t *src_buff, const size_t src_entry_idx, const size_t src_entry_count, const QueryMemoryDescriptor &query_mem_desc)
 
ALWAYS_INLINE void anonymous_namespace{ResultSetReduction.cpp}::fill_empty_key_32 (int32_t *key_ptr_i32, const size_t key_count)
 
ALWAYS_INLINE void anonymous_namespace{ResultSetReduction.cpp}::fill_empty_key_64 (int64_t *key_ptr_i64, const size_t key_count)
 
int64_t anonymous_namespace{ResultSetReduction.cpp}::get_component (const int8_t *group_by_buffer, const size_t comp_sz, const size_t index=0)
 
void anonymous_namespace{ResultSetReduction.cpp}::run_reduction_code (const size_t executor_id, const ReductionCode &reduction_code, int8_t *this_buff, const int8_t *that_buff, const int32_t start_entry_index, const int32_t end_entry_index, const int32_t that_entry_count, const void *this_qmd, const void *that_qmd, const void *serialized_varlen_buffer)
 
ALWAYS_INLINE void anonymous_namespace{ResultSetReduction.cpp}::check_watchdog ()
 
ALWAYS_INLINE void anonymous_namespace{ResultSetReduction.cpp}::check_watchdog_with_seed (const size_t sample_seed)
 
GroupValueInfo anonymous_namespace{ResultSetReduction.cpp}::get_matching_group_value_columnar_reduction (int64_t *groups_buffer, const uint32_t h, const int64_t *key, const uint32_t key_qw_count, const size_t entry_count)
 
GroupValueInfo anonymous_namespace{ResultSetReduction.cpp}::get_group_value_columnar_reduction (int64_t *groups_buffer, const uint32_t groups_buffer_entry_count, const int64_t *key, const uint32_t key_qw_count)
 
template<typename T = int64_t>
GroupValueInfo anonymous_namespace{ResultSetReduction.cpp}::get_matching_group_value_reduction (int64_t *groups_buffer, const uint32_t h, const T *key, const uint32_t key_count, const QueryMemoryDescriptor &query_mem_desc, const int64_t *that_buff_i64, const size_t that_entry_idx, const size_t that_entry_count, const uint32_t row_size_quad)
 
GroupValueInfo anonymous_namespace{ResultSetReduction.cpp}::get_matching_group_value_reduction (int64_t *groups_buffer, const uint32_t h, const int64_t *key, const uint32_t key_count, const size_t key_width, const QueryMemoryDescriptor &query_mem_desc, const int64_t *that_buff_i64, const size_t that_entry_idx, const size_t that_entry_count, const uint32_t row_size_quad)
 

Variables

bool g_enable_dynamic_watchdog
 

Detailed Description

Reduction part of the row set interface.

Definition in file ResultSetReduction.cpp.

Macro Definition Documentation

#define AGGREGATE_ONE_COUNT (   val_ptr__,
  other_ptr__,
  chosen_bytes__ 
)
Value:
do { \
if (chosen_bytes__ == sizeof(int32_t)) { \
auto val_ptr = reinterpret_cast<int32_t*>(val_ptr__); \
auto other_ptr = reinterpret_cast<const int32_t*>(other_ptr__); \
agg_sum_int32(val_ptr, *other_ptr); \
} else { \
auto val_ptr = reinterpret_cast<int64_t*>(val_ptr__); \
auto other_ptr = reinterpret_cast<const int64_t*>(other_ptr__); \
agg_sum(val_ptr, *other_ptr); \
} \
} while (0)
RUNTIME_EXPORT ALWAYS_INLINE int32_t agg_sum_int32(int32_t *agg, const int32_t val)
RUNTIME_EXPORT ALWAYS_INLINE int64_t agg_sum(int64_t *agg, const int64_t val)

Definition at line 1311 of file ResultSetReduction.cpp.

Referenced by ResultSetStorage::reduceOneSlot(), and ResultSetStorage::reduceSingleRow().

#define AGGREGATE_ONE_NULLABLE_COUNT (   val_ptr__,
  other_ptr__,
  init_val__,
  chosen_bytes__,
  agg_info__ 
)

Definition at line 1324 of file ResultSetReduction.cpp.

Referenced by ResultSetStorage::reduceSingleRow().

#define AGGREGATE_ONE_NULLABLE_VALUE (   agg_kind__,
  val_ptr__,
  other_ptr__,
  init_val__,
  chosen_bytes__,
  agg_info__ 
)
#define AGGREGATE_ONE_NULLABLE_VALUE_SMALL (   agg_kind__,
  val_ptr__,
  other_ptr__,
  init_val__,
  chosen_bytes__,
  agg_info__ 
)
Value:
do { \
if (agg_info__.skip_null_val) { \
if (chosen_bytes__ == sizeof(int16_t)) { \
int16_t* val_ptr = reinterpret_cast<int16_t*>(val_ptr__); \
const int16_t* other_ptr = reinterpret_cast<const int16_t*>(other_ptr__); \
const auto null_val = static_cast<int16_t>(init_val__); \
agg_##agg_kind__##_int16_skip_val(val_ptr, *other_ptr, null_val); \
} else if (chosen_bytes == sizeof(int8_t)) { \
int8_t* val_ptr = reinterpret_cast<int8_t*>(val_ptr__); \
const int8_t* other_ptr = reinterpret_cast<const int8_t*>(other_ptr__); \
const auto null_val = static_cast<int8_t>(init_val__); \
agg_##agg_kind__##_int8_skip_val(val_ptr, *other_ptr, null_val); \
} \
} else { \
agg_kind__, val_ptr__, other_ptr__, chosen_bytes__, agg_info__); \
} \
} while (0)
#define AGGREGATE_ONE_VALUE_SMALL(agg_kind__, val_ptr__, other_ptr__, chosen_bytes__, agg_info__)

Definition at line 1377 of file ResultSetReduction.cpp.

Referenced by ResultSetStorage::reduceOneSlot(), and ResultSetStorage::reduceSingleRow().

#define AGGREGATE_ONE_VALUE (   agg_kind__,
  val_ptr__,
  other_ptr__,
  chosen_bytes__,
  agg_info__ 
)
Value:
do { \
const auto sql_type = get_compact_type(agg_info__); \
if (sql_type.is_fp()) { \
if (chosen_bytes__ == sizeof(float)) { \
agg_##agg_kind__##_float(reinterpret_cast<int32_t*>(val_ptr__), \
*reinterpret_cast<const float*>(other_ptr__)); \
} else { \
agg_##agg_kind__##_double(reinterpret_cast<int64_t*>(val_ptr__), \
*reinterpret_cast<const double*>(other_ptr__)); \
} \
} else { \
if (chosen_bytes__ == sizeof(int32_t)) { \
auto val_ptr = reinterpret_cast<int32_t*>(val_ptr__); \
auto other_ptr = reinterpret_cast<const int32_t*>(other_ptr__); \
agg_##agg_kind__##_int32(val_ptr, *other_ptr); \
} else { \
auto val_ptr = reinterpret_cast<int64_t*>(val_ptr__); \
auto other_ptr = reinterpret_cast<const int64_t*>(other_ptr__); \
agg_##agg_kind__(val_ptr, *other_ptr); \
} \
} \
} while (0)
const SQLTypeInfo get_compact_type(const TargetInfo &target)

Definition at line 1250 of file ResultSetReduction.cpp.

#define AGGREGATE_ONE_VALUE_SMALL (   agg_kind__,
  val_ptr__,
  other_ptr__,
  chosen_bytes__,
  agg_info__ 
)
Value:
do { \
if (chosen_bytes__ == sizeof(int16_t)) { \
auto val_ptr = reinterpret_cast<int16_t*>(val_ptr__); \
auto other_ptr = reinterpret_cast<const int16_t*>(other_ptr__); \
agg_##agg_kind__##_int16(val_ptr, *other_ptr); \
} else if (chosen_bytes__ == sizeof(int8_t)) { \
auto val_ptr = reinterpret_cast<int8_t*>(val_ptr__); \
auto other_ptr = reinterpret_cast<const int8_t*>(other_ptr__); \
agg_##agg_kind__##_int8(val_ptr, *other_ptr); \
} else { \
} \
} while (0)
#define UNREACHABLE()
Definition: Logger.h:338

Definition at line 1360 of file ResultSetReduction.cpp.

#define cas_cst (   ptr,
  expected,
  desired 
)
Value:
__atomic_compare_exchange_n( \
ptr, expected, desired, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)

Definition at line 690 of file ResultSetReduction.cpp.

Referenced by anonymous_namespace{ResultSetReduction.cpp}::get_matching_group_value_reduction().

#define load_cst (   ptr)    __atomic_load_n(ptr, __ATOMIC_SEQ_CST)
#define mapd_cas (   address,
  compare,
  val 
)    __sync_val_compare_and_swap(address, compare, val)
#define store_cst (   ptr,
  val 
)    __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST)

Variable Documentation

bool g_enable_dynamic_watchdog

Definition at line 81 of file Execute.cpp.