OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResultSetReductionJIT.cpp File Reference
#include "ResultSetReductionJIT.h"
#include "ResultSetReductionCodegen.h"
#include "ResultSetReductionInterpreterStubs.h"
#include "CodeGenerator.h"
#include "DynamicWatchdog.h"
#include "Execute.h"
#include "IRCodegenUtils.h"
#include "LLVMFunctionAttributesUtil.h"
#include "Shared/likely.h"
#include "Shared/mapdpath.h"
#include <llvm/Bitcode/BitcodeReader.h>
#include <llvm/IR/Function.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Verifier.h>
#include <llvm/Support/SourceMgr.h>
#include <llvm/Support/raw_os_ostream.h>
+ Include dependency graph for ResultSetReductionJIT.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{ResultSetReductionJIT.cpp}
 

Functions

Valueanonymous_namespace{ResultSetReductionJIT.cpp}::emit_load (Value *ptr, Type ptr_type, Function *function)
 
Valueanonymous_namespace{ResultSetReductionJIT.cpp}::emit_load_i32 (Value *ptr, Function *function)
 
Valueanonymous_namespace{ResultSetReductionJIT.cpp}::emit_load_i64 (Value *ptr, Function *function)
 
Valueanonymous_namespace{ResultSetReductionJIT.cpp}::emit_read_int_from_buff (Value *ptr, const int8_t compact_sz, Function *function)
 
void anonymous_namespace{ResultSetReductionJIT.cpp}::emit_aggregate_one_value (const std::string &agg_kind, Value *val_ptr, Value *other_ptr, const size_t chosen_bytes, const TargetInfo &agg_info, Function *ir_reduce_one_entry)
 
void anonymous_namespace{ResultSetReductionJIT.cpp}::emit_aggregate_one_nullable_value (const std::string &agg_kind, Value *val_ptr, Value *other_ptr, const int64_t init_val, const size_t chosen_bytes, const TargetInfo &agg_info, Function *ir_reduce_one_entry)
 
void anonymous_namespace{ResultSetReductionJIT.cpp}::emit_aggregate_one_count (Value *val_ptr, Value *other_ptr, const size_t chosen_bytes, Function *ir_reduce_one_entry)
 
void anonymous_namespace{ResultSetReductionJIT.cpp}::emit_write_projection (Value *slot_pi8, Value *other_pi8, const int64_t init_val, const size_t chosen_bytes, Function *ir_reduce_one_entry)
 
std::unique_ptr< Functionanonymous_namespace{ResultSetReductionJIT.cpp}::create_function (const std::string name, const std::vector< Function::NamedArg > &arg_types, const Type ret_type, const bool always_inline)
 
std::unique_ptr< Functionanonymous_namespace{ResultSetReductionJIT.cpp}::setup_is_empty_entry (ReductionCode *reduction_code)
 
std::unique_ptr< Functionanonymous_namespace{ResultSetReductionJIT.cpp}::setup_reduce_one_entry (ReductionCode *reduction_code, const QueryDescriptionType hash_type)
 
std::unique_ptr< Functionanonymous_namespace{ResultSetReductionJIT.cpp}::setup_reduce_one_entry_idx (ReductionCode *reduction_code)
 
std::unique_ptr< Functionanonymous_namespace{ResultSetReductionJIT.cpp}::setup_reduce_loop (ReductionCode *reduction_code)
 
llvm::Function * anonymous_namespace{ResultSetReductionJIT.cpp}::create_llvm_function (const Function *function, const CgenState *cgen_state)
 
ReductionCode anonymous_namespace{ResultSetReductionJIT.cpp}::setup_functions_ir (const QueryDescriptionType hash_type)
 
bool anonymous_namespace{ResultSetReductionJIT.cpp}::is_aggregate_query (const QueryDescriptionType hash_type)
 
void anonymous_namespace{ResultSetReductionJIT.cpp}::varlen_buffer_sample (int8_t *this_ptr1, int8_t *this_ptr2, const int8_t *that_ptr1, const int8_t *that_ptr2, const int64_t init_val)
 
void serialized_varlen_buffer_sample (const void *serialized_varlen_buffer_handle, int8_t *this_ptr1, int8_t *this_ptr2, const int8_t *that_ptr1, const int8_t *that_ptr2, const int64_t init_val, const int64_t length_to_elems)
 
void count_distinct_set_union_jit_rt (const int64_t new_set_handle, const int64_t old_set_handle, const void *that_qmd_handle, const void *this_qmd_handle, const int64_t target_logical_idx)
 
void get_group_value_reduction_rt (int8_t *groups_buffer, const int8_t *key, const uint32_t key_count, const void *this_qmd_handle, const int8_t *that_buff, const uint32_t that_entry_idx, const uint32_t that_entry_count, const uint32_t row_size_bytes, int64_t **buff_out, uint8_t *empty)
 
uint8_t check_watchdog_rt (const size_t sample_seed)
 
void anonymous_namespace{ResultSetReductionJIT.cpp}::generate_loop_body (For *for_loop, Function *ir_reduce_loop, Function *ir_reduce_one_entry_idx, Value *this_buff, Value *that_buff, Value *start_index, Value *that_entry_count, Value *this_qmd_handle, Value *that_qmd_handle, Value *serialized_varlen_buffer)
 
std::string anonymous_namespace{ResultSetReductionJIT.cpp}::target_info_key (const TargetInfo &target_info)
 

Variables

std::unique_ptr< llvm::Module > g_rt_module
 
const int32_t anonymous_namespace{ResultSetReductionJIT.cpp}::WATCHDOG_ERROR
 
const size_t anonymous_namespace{ResultSetReductionJIT.cpp}::INTERP_THRESHOLD {25}
 

Function Documentation

uint8_t check_watchdog_rt ( const size_t  sample_seed)

Definition at line 446 of file ResultSetReductionJIT.cpp.

References dynamic_watchdog(), g_enable_dynamic_watchdog, and UNLIKELY.

446  {
447  if (UNLIKELY(g_enable_dynamic_watchdog && (sample_seed & 0x3F) == 0 &&
448  dynamic_watchdog())) {
449  return true;
450  }
451  return false;
452 }
__device__ bool dynamic_watchdog()
bool g_enable_dynamic_watchdog
Definition: Execute.cpp:72
#define UNLIKELY(x)
Definition: likely.h:20

+ Here is the call graph for this function:

void count_distinct_set_union_jit_rt ( const int64_t  new_set_handle,
const int64_t  old_set_handle,
const void *  that_qmd_handle,
const void *  this_qmd_handle,
const int64_t  target_logical_idx 
)

Definition at line 404 of file ResultSetReductionJIT.cpp.

References CHECK(), count_distinct_set_union(), QueryMemoryDescriptor::getCountDistinctDescriptor(), and Invalid.

408  {
409  const auto that_qmd = reinterpret_cast<const QueryMemoryDescriptor*>(that_qmd_handle);
410  const auto this_qmd = reinterpret_cast<const QueryMemoryDescriptor*>(this_qmd_handle);
411  const auto& new_count_distinct_desc =
412  that_qmd->getCountDistinctDescriptor(target_logical_idx);
413  const auto& old_count_distinct_desc =
414  this_qmd->getCountDistinctDescriptor(target_logical_idx);
415  CHECK(old_count_distinct_desc.impl_type_ != CountDistinctImplType::Invalid);
416  CHECK(old_count_distinct_desc.impl_type_ == new_count_distinct_desc.impl_type_);
418  new_set_handle, old_set_handle, new_count_distinct_desc, old_count_distinct_desc);
419 }
void count_distinct_set_union(const int64_t new_set_handle, const int64_t old_set_handle, const CountDistinctDescriptor &new_count_distinct_desc, const CountDistinctDescriptor &old_count_distinct_desc)
CHECK(cgen_state)
const CountDistinctDescriptor & getCountDistinctDescriptor(const size_t idx) const

+ Here is the call graph for this function:

void get_group_value_reduction_rt ( int8_t *  groups_buffer,
const int8_t *  key,
const uint32_t  key_count,
const void *  this_qmd_handle,
const int8_t *  that_buff,
const uint32_t  that_entry_idx,
const uint32_t  that_entry_count,
const uint32_t  row_size_bytes,
int64_t **  buff_out,
uint8_t *  empty 
)

Definition at line 421 of file ResultSetReductionJIT.cpp.

References get_group_value_reduction().

430  {
431  const auto& this_qmd = *reinterpret_cast<const QueryMemoryDescriptor*>(this_qmd_handle);
432  const auto gvi = get_group_value_reduction(reinterpret_cast<int64_t*>(groups_buffer),
433  this_qmd.getEntryCount(),
434  reinterpret_cast<const int64_t*>(key),
435  key_count,
436  this_qmd.getEffectiveKeyWidth(),
437  this_qmd,
438  reinterpret_cast<const int64_t*>(that_buff),
439  that_entry_idx,
440  that_entry_count,
441  row_size_bytes >> 3);
442  *buff_out = gvi.first;
443  *empty = gvi.second;
444 }
const int32_t groups_buffer_size return groups_buffer
GroupValueInfo get_group_value_reduction(int64_t *groups_buffer, const uint32_t groups_buffer_entry_count, 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)

+ Here is the call graph for this function:

void serialized_varlen_buffer_sample ( const void *  serialized_varlen_buffer_handle,
int8_t *  this_ptr1,
int8_t *  this_ptr2,
const int8_t *  that_ptr1,
const int8_t *  that_ptr2,
const int64_t  init_val,
const int64_t  length_to_elems 
)

Definition at line 374 of file ResultSetReductionJIT.cpp.

References CHECK_LT, and anonymous_namespace{ResultSetReductionJIT.cpp}::varlen_buffer_sample().

381  {
382  if (!serialized_varlen_buffer_handle) {
383  varlen_buffer_sample(this_ptr1, this_ptr2, that_ptr1, that_ptr2, init_val);
384  return;
385  }
386  const auto& serialized_varlen_buffer =
387  *reinterpret_cast<const std::vector<std::string>*>(serialized_varlen_buffer_handle);
388  if (!serialized_varlen_buffer.empty()) {
389  const auto rhs_proj_col = *reinterpret_cast<const int64_t*>(that_ptr1);
390  CHECK_LT(static_cast<size_t>(rhs_proj_col), serialized_varlen_buffer.size());
391  const auto& varlen_bytes_str = serialized_varlen_buffer[rhs_proj_col];
392  const auto str_ptr = reinterpret_cast<const int8_t*>(varlen_bytes_str.c_str());
393  *reinterpret_cast<int64_t*>(this_ptr1) = reinterpret_cast<const int64_t>(str_ptr);
394  *reinterpret_cast<int64_t*>(this_ptr2) =
395  static_cast<int64_t>(varlen_bytes_str.size() / length_to_elems);
396  } else {
397  varlen_buffer_sample(this_ptr1, this_ptr2, that_ptr1, that_ptr2, init_val);
398  }
399 }
void varlen_buffer_sample(int8_t *this_ptr1, int8_t *this_ptr2, const int8_t *that_ptr1, const int8_t *that_ptr2, const int64_t init_val)
#define CHECK_LT(x, y)
Definition: Logger.h:200

+ Here is the call graph for this function:

Variable Documentation

std::unique_ptr<llvm::Module> g_rt_module