OmniSciDB  340b00dbf6
 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 <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)
 
const Valueanonymous_namespace{ResultSetReductionJIT.cpp}::emit_checked_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, 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 485 of file ResultSetReductionJIT.cpp.

References dynamic_watchdog(), g_enable_dynamic_watchdog, and UNLIKELY.

485  {
486  if (UNLIKELY(g_enable_dynamic_watchdog && (sample_seed & 0x3F) == 0 &&
487  dynamic_watchdog())) {
488  return true;
489  }
490  return false;
491 }
__device__ bool dynamic_watchdog()
bool g_enable_dynamic_watchdog
Definition: Execute.cpp:74
#define UNLIKELY(x)
Definition: likely.h:25

+ 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 442 of file ResultSetReductionJIT.cpp.

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

446  {
447  const auto that_qmd = reinterpret_cast<const QueryMemoryDescriptor*>(that_qmd_handle);
448  const auto this_qmd = reinterpret_cast<const QueryMemoryDescriptor*>(this_qmd_handle);
449  const auto& new_count_distinct_desc =
450  that_qmd->getCountDistinctDescriptor(target_logical_idx);
451  const auto& old_count_distinct_desc =
452  this_qmd->getCountDistinctDescriptor(target_logical_idx);
453  CHECK(old_count_distinct_desc.impl_type_ != CountDistinctImplType::Invalid);
454  CHECK(old_count_distinct_desc.impl_type_ == new_count_distinct_desc.impl_type_);
456  new_set_handle, old_set_handle, new_count_distinct_desc, old_count_distinct_desc);
457 }
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)
const CountDistinctDescriptor & getCountDistinctDescriptor(const size_t idx) const
#define CHECK(condition)
Definition: Logger.h:197

+ 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 459 of file ResultSetReductionJIT.cpp.

References result_set::get_group_value_reduction().

468  {
469  const auto& this_qmd = *reinterpret_cast<const QueryMemoryDescriptor*>(this_qmd_handle);
470  const auto gvi =
471  result_set::get_group_value_reduction(reinterpret_cast<int64_t*>(groups_buffer),
472  this_qmd.getEntryCount(),
473  reinterpret_cast<const int64_t*>(key),
474  key_count,
475  this_qmd.getEffectiveKeyWidth(),
476  this_qmd,
477  reinterpret_cast<const int64_t*>(that_buff),
478  that_entry_idx,
479  that_entry_count,
480  row_size_bytes >> 3);
481  *buff_out = gvi.first;
482  *empty = gvi.second;
483 }
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 412 of file ResultSetReductionJIT.cpp.

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

419  {
420  if (!serialized_varlen_buffer_handle) {
421  varlen_buffer_sample(this_ptr1, this_ptr2, that_ptr1, that_ptr2, init_val);
422  return;
423  }
424  const auto& serialized_varlen_buffer =
425  *reinterpret_cast<const std::vector<std::string>*>(serialized_varlen_buffer_handle);
426  if (!serialized_varlen_buffer.empty()) {
427  const auto rhs_proj_col = *reinterpret_cast<const int64_t*>(that_ptr1);
428  CHECK_LT(static_cast<size_t>(rhs_proj_col), serialized_varlen_buffer.size());
429  const auto& varlen_bytes_str = serialized_varlen_buffer[rhs_proj_col];
430  const auto str_ptr = reinterpret_cast<const int8_t*>(varlen_bytes_str.c_str());
431  *reinterpret_cast<int64_t*>(this_ptr1) = reinterpret_cast<const int64_t>(str_ptr);
432  *reinterpret_cast<int64_t*>(this_ptr2) =
433  static_cast<int64_t>(varlen_bytes_str.size() / length_to_elems);
434  } else {
435  varlen_buffer_sample(this_ptr1, this_ptr2, that_ptr1, that_ptr2, init_val);
436  }
437 }
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:207

+ Here is the call graph for this function:

Variable Documentation

std::unique_ptr<llvm::Module> g_rt_module