OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ResultSetReductionJIT Class Reference

#include <ResultSetReductionJIT.h>

+ Collaboration diagram for ResultSetReductionJIT:

Public Member Functions

 ResultSetReductionJIT (const QueryMemoryDescriptor &query_mem_desc, const std::vector< TargetInfo > &targets, const std::vector< int64_t > &target_init_vals)
 
ReductionCode codegen () const
 

Static Public Member Functions

static void clearCache ()
 

Private Member Functions

void isEmpty (const ReductionCode &reduction_code) const
 
void reduceOneEntryNoCollisions (const ReductionCode &reduction_code) const
 
void reduceOneEntryTargetsNoCollisions (Function *ir_reduce_one_entry, Value *this_targets_start_ptr, Value *that_targets_start_ptr) const
 
void reduceOneEntryBaseline (const ReductionCode &reduction_code) const
 
void reduceOneEntryNoCollisionsIdx (const ReductionCode &reduction_code) const
 
void reduceOneEntryBaselineIdx (const ReductionCode &reduction_code) const
 
void reduceLoop (const ReductionCode &reduction_code) const
 
void reduceOneSlot (Value *this_ptr1, Value *this_ptr2, Value *that_ptr1, Value *that_ptr2, const TargetInfo &target_info, const size_t target_logical_idx, const size_t target_slot_idx, const size_t init_agg_val_idx, const size_t first_slot_idx_for_target, Function *ir_reduce_one_entry) const
 
void reduceOneAggregateSlot (Value *this_ptr1, Value *this_ptr2, Value *that_ptr1, Value *that_ptr2, const TargetInfo &target_info, const size_t target_logical_idx, const size_t target_slot_idx, const int64_t init_val, const int8_t chosen_bytes, Function *ir_reduce_one_entry) const
 
void reduceOneCountDistinctSlot (Value *this_ptr1, Value *that_ptr1, const size_t target_logical_idx, Function *ir_reduce_one_entry) const
 
ReductionCode finalizeReductionCode (ReductionCode reduction_code, const llvm::Function *ir_is_empty, const llvm::Function *ir_reduce_one_entry, const llvm::Function *ir_reduce_one_entry_idx, const CodeCacheKey &key) const
 
std::string cacheKey () const
 

Private Attributes

const QueryMemoryDescriptor query_mem_desc_
 
const std::vector< TargetInfotargets_
 
const std::vector< int64_t > target_init_vals_
 

Static Private Attributes

static CodeCache s_code_cache
 

Detailed Description

Definition at line 54 of file ResultSetReductionJIT.h.

Constructor & Destructor Documentation

ResultSetReductionJIT::ResultSetReductionJIT ( const QueryMemoryDescriptor query_mem_desc,
const std::vector< TargetInfo > &  targets,
const std::vector< int64_t > &  target_init_vals 
)

Definition at line 454 of file ResultSetReductionJIT.cpp.

457  : query_mem_desc_(query_mem_desc)
458  , targets_(targets)
459  , target_init_vals_(target_init_vals) {}
const std::vector< int64_t > target_init_vals_
const QueryMemoryDescriptor query_mem_desc_
const std::vector< TargetInfo > targets_

Member Function Documentation

std::string ResultSetReductionJIT::cacheKey ( ) const
private

Definition at line 1153 of file ResultSetReductionJIT.cpp.

References join(), query_mem_desc_, QueryMemoryDescriptor::reductionKey(), anonymous_namespace{ResultSetReductionJIT.cpp}::target_info_key(), target_init_vals_, targets_, and to_string().

Referenced by codegen().

1153  {
1154  std::vector<std::string> target_init_vals_strings;
1155  std::transform(target_init_vals_.begin(),
1156  target_init_vals_.end(),
1157  std::back_inserter(target_init_vals_strings),
1158  [](const int64_t v) { return std::to_string(v); });
1159  const auto target_init_vals_key =
1160  boost::algorithm::join(target_init_vals_strings, ", ");
1161  std::vector<std::string> targets_strings;
1162  std::transform(
1163  targets_.begin(),
1164  targets_.end(),
1165  std::back_inserter(targets_strings),
1166  [](const TargetInfo& target_info) { return target_info_key(target_info); });
1167  const auto targets_key = boost::algorithm::join(targets_strings, ", ");
1168  return query_mem_desc_.reductionKey() + "\n" + target_init_vals_key + "\n" +
1169  targets_key;
1170 }
std::string join(T const &container, std::string const &delim)
const std::vector< int64_t > target_init_vals_
const QueryMemoryDescriptor query_mem_desc_
std::string to_string(char const *&&v)
std::string target_info_key(const TargetInfo &target_info)
std::string reductionKey() const
const std::vector< TargetInfo > targets_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::clearCache ( )
static

Definition at line 568 of file ResultSetReductionJIT.cpp.

References LruCache< key_t, value_t, hash_t >::clear(), StubGenerator::clearCache(), g_rt_module, and s_code_cache.

568  {
569  // Clear stub cache to avoid crash caused by non-deterministic static destructor order
570  // of LLVM context and the cache.
573  g_rt_module = nullptr;
574 }
void clear()
Definition: LruCache.hpp:57
std::unique_ptr< llvm::Module > g_rt_module

+ Here is the call graph for this function:

ReductionCode ResultSetReductionJIT::codegen ( ) const

Definition at line 492 of file ResultSetReductionJIT.cpp.

References QueryMemoryDescriptor::blocksShareMemory(), cacheKey(), cgen_state, anonymous_namespace{ResultSetReductionJIT.cpp}::create_llvm_function(), QueryMemoryDescriptor::didOutputColumnar(), logger::FATAL, finalizeReductionCode(), LruCache< key_t, value_t, hash_t >::get(), QueryMemoryDescriptor::getEntryCount(), QueryMemoryDescriptor::getExecutor(), QueryMemoryDescriptor::getQueryDescriptionType(), GroupByBaselineHash, GroupByPerfectHash, anonymous_namespace{ResultSetReductionJIT.cpp}::INTERP_THRESHOLD, anonymous_namespace{ResultSetReductionJIT.cpp}::is_aggregate_query(), isEmpty(), LOG, module(), NonGroupedAggregate, query_mem_desc_, reduceLoop(), reduceOneEntryBaseline(), reduceOneEntryBaselineIdx(), reduceOneEntryNoCollisions(), reduceOneEntryNoCollisionsIdx(), runtime_module_shallow_copy(), s_code_cache, ReductionCode::s_reduction_mutex, anonymous_namespace{ResultSetReductionJIT.cpp}::setup_functions_ir(), and translate_function().

Referenced by ResultSetManager::reduce(), and Executor::reduceMultiDeviceResultSets().

492  {
493  const auto hash_type = query_mem_desc_.getQueryDescriptionType();
495  return {};
496  }
497  auto reduction_code = setup_functions_ir(hash_type);
498  isEmpty(reduction_code);
502  reduceOneEntryNoCollisions(reduction_code);
503  reduceOneEntryNoCollisionsIdx(reduction_code);
504  break;
505  }
507  reduceOneEntryBaseline(reduction_code);
508  reduceOneEntryBaselineIdx(reduction_code);
509  break;
510  }
511  default: {
512  LOG(FATAL) << "Unexpected query description type";
513  }
514  }
515  reduceLoop(reduction_code);
516  // For small result sets, avoid native code generation and use the interpreter instead.
519  return reduction_code;
520  }
521  std::lock_guard<std::mutex> reduction_guard(ReductionCode::s_reduction_mutex);
522  CodeCacheKey key{cacheKey()};
523  const auto val_ptr = s_code_cache.get(key);
524  if (val_ptr) {
525  return {reinterpret_cast<ReductionCode::FuncPtr>(std::get<0>(val_ptr->first.front())),
526  nullptr,
527  nullptr,
528  nullptr,
529  std::move(reduction_code.ir_is_empty),
530  std::move(reduction_code.ir_reduce_one_entry),
531  std::move(reduction_code.ir_reduce_one_entry_idx),
532  std::move(reduction_code.ir_reduce_loop)};
533  }
534  reduction_code.cgen_state.reset(new CgenState({}, false));
535  auto cgen_state = reduction_code.cgen_state.get();
536  std::unique_ptr<llvm::Module> module(runtime_module_shallow_copy(cgen_state));
537  cgen_state->module_ = module.get();
538  auto ir_is_empty = create_llvm_function(reduction_code.ir_is_empty.get(), cgen_state);
539  auto ir_reduce_one_entry =
540  create_llvm_function(reduction_code.ir_reduce_one_entry.get(), cgen_state);
541  auto ir_reduce_one_entry_idx =
542  create_llvm_function(reduction_code.ir_reduce_one_entry_idx.get(), cgen_state);
543  auto ir_reduce_loop =
544  create_llvm_function(reduction_code.ir_reduce_loop.get(), cgen_state);
545  std::unordered_map<const Function*, llvm::Function*> f;
546  f.emplace(reduction_code.ir_is_empty.get(), ir_is_empty);
547  f.emplace(reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry);
548  f.emplace(reduction_code.ir_reduce_one_entry_idx.get(), ir_reduce_one_entry_idx);
549  f.emplace(reduction_code.ir_reduce_loop.get(), ir_reduce_loop);
550  translate_function(reduction_code.ir_is_empty.get(), ir_is_empty, reduction_code, f);
552  reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry, reduction_code, f);
553  translate_function(reduction_code.ir_reduce_one_entry_idx.get(),
554  ir_reduce_one_entry_idx,
555  reduction_code,
556  f);
558  reduction_code.ir_reduce_loop.get(), ir_reduce_loop, reduction_code, f);
559  reduction_code.llvm_reduce_loop = ir_reduce_loop;
560  reduction_code.module = std::move(module);
561  return finalizeReductionCode(std::move(reduction_code),
562  ir_is_empty,
563  ir_reduce_one_entry,
564  ir_reduce_one_entry_idx,
565  key);
566 }
bool is_aggregate_query(const QueryDescriptionType hash_type)
std::unique_ptr< llvm::Module > module(runtime_module_shallow_copy(cgen_state))
std::unique_ptr< llvm::Module > runtime_module_shallow_copy(CgenState *cgen_state)
void reduceOneEntryNoCollisions(const ReductionCode &reduction_code) const
void reduceOneEntryBaselineIdx(const ReductionCode &reduction_code) const
#define LOG(tag)
Definition: Logger.h:185
void reduceLoop(const ReductionCode &reduction_code) const
void reduceOneEntryNoCollisionsIdx(const ReductionCode &reduction_code) const
std::vector< std::string > CodeCacheKey
Definition: CodeCache.h:61
ReductionCode finalizeReductionCode(ReductionCode reduction_code, const llvm::Function *ir_is_empty, const llvm::Function *ir_reduce_one_entry, const llvm::Function *ir_reduce_one_entry_idx, const CodeCacheKey &key) const
std::string cacheKey() const
int32_t(*)(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) FuncPtr
const QueryMemoryDescriptor query_mem_desc_
void translate_function(const Function *function, llvm::Function *llvm_function, const ReductionCode &reduction_code, const std::unordered_map< const Function *, llvm::Function * > &f)
false auto cgen_state
llvm::Function * create_llvm_function(const Function *function, const CgenState *cgen_state)
static std::mutex s_reduction_mutex
ReductionCode setup_functions_ir(const QueryDescriptionType hash_type)
QueryDescriptionType getQueryDescriptionType() const
void isEmpty(const ReductionCode &reduction_code) const
void reduceOneEntryBaseline(const ReductionCode &reduction_code) const
value_t * get(const key_t &key)
Definition: LruCache.hpp:39
const Executor * getExecutor() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ReductionCode ResultSetReductionJIT::finalizeReductionCode ( ReductionCode  reduction_code,
const llvm::Function *  ir_is_empty,
const llvm::Function *  ir_reduce_one_entry,
const llvm::Function *  ir_reduce_one_entry_idx,
const CodeCacheKey key 
) const
private

Definition at line 1114 of file ResultSetReductionJIT.cpp.

References CPU, CodeGenerator::generateNativeCPUCode(), ReductionCode::llvm_reduce_loop, ReductionCode::module, and ReductionJIT.

Referenced by codegen().

1119  {
1120  CompilationOptions co{
1122  reduction_code.module.release();
1124  reduction_code.llvm_reduce_loop, {reduction_code.llvm_reduce_loop}, co);
1125  reduction_code.func_ptr = reinterpret_cast<ReductionCode::FuncPtr>(
1126  ee->getPointerToFunction(reduction_code.llvm_reduce_loop));
1127  auto cache_val =
1128  std::make_tuple(reinterpret_cast<void*>(reduction_code.func_ptr), std::move(ee));
1129  std::vector<std::tuple<void*, ExecutionEngineWrapper>> cache_vals;
1130  cache_vals.emplace_back(std::move(cache_val));
1132  std::move(cache_vals),
1133  reduction_code.llvm_reduce_loop->getParent(),
1134  s_code_cache);
1135  return reduction_code;
1136 }
static void addCodeToCache(const CodeCacheKey &, std::vector< std::tuple< void *, ExecutionEngineWrapper >>, llvm::Module *, CodeCache &)
llvm::Function * llvm_reduce_loop
static ExecutionEngineWrapper generateNativeCPUCode(llvm::Function *func, const std::unordered_set< llvm::Function * > &live_funcs, const CompilationOptions &co)
int32_t(*)(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) FuncPtr
std::unique_ptr< llvm::Module > module

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::isEmpty ( const ReductionCode reduction_code) const
private

Definition at line 576 of file ResultSetReductionJIT.cpp.

References CHECK(), CHECK_GE, CHECK_LT, QueryMemoryDescriptor::didOutputColumnar(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_load_i32(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_load_i64(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_read_int_from_buff(), EMPTY_KEY_32, EMPTY_KEY_64, ICmp::EQ, logger::FATAL, get_byteoff_of_slot(), QueryMemoryDescriptor::getEffectiveKeyWidth(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getQueryDescriptionType(), QueryMemoryDescriptor::getTargetIdxForKey(), GroupByPerfectHash, QueryMemoryDescriptor::hasKeylessHash(), Int32, Int64, ReductionCode::ir_is_empty, anonymous_namespace{ResultSetReductionJIT.cpp}::is_aggregate_query(), LOG, query_mem_desc_, and target_init_vals_.

Referenced by codegen().

576  {
577  auto ir_is_empty = reduction_code.ir_is_empty.get();
580  Value* key{nullptr};
581  Value* empty_key_val{nullptr};
582  const auto keys_ptr = ir_is_empty->arg(0);
587  CHECK_LT(static_cast<size_t>(query_mem_desc_.getTargetIdxForKey()),
588  target_init_vals_.size());
589  const int64_t target_slot_off =
591  const auto slot_ptr = ir_is_empty->add<GetElementPtr>(
592  keys_ptr,
593  ir_is_empty->addConstant<ConstantInt>(target_slot_off, Type::Int32),
594  "is_empty_slot_ptr");
595  const auto compact_sz =
597  key = emit_read_int_from_buff(slot_ptr, compact_sz, ir_is_empty);
598  empty_key_val = ir_is_empty->addConstant<ConstantInt>(
600  } else {
602  case 4: {
605  key = emit_load_i32(keys_ptr, ir_is_empty);
606  empty_key_val = ir_is_empty->addConstant<ConstantInt>(EMPTY_KEY_32, Type::Int32);
607  break;
608  }
609  case 8: {
610  key = emit_load_i64(keys_ptr, ir_is_empty);
611  empty_key_val = ir_is_empty->addConstant<ConstantInt>(EMPTY_KEY_64, Type::Int64);
612  break;
613  }
614  default:
615  LOG(FATAL) << "Invalid key width";
616  }
617  }
618  const auto ret =
619  ir_is_empty->add<ICmp>(ICmp::Predicate::EQ, key, empty_key_val, "is_key_empty");
620  ir_is_empty->add<Ret>(ret);
621 }
bool is_aggregate_query(const QueryDescriptionType hash_type)
#define EMPTY_KEY_64
Value * emit_read_int_from_buff(Value *ptr, const int8_t compact_sz, Function *function)
#define LOG(tag)
Definition: Logger.h:185
size_t get_byteoff_of_slot(const size_t slot_idx, const QueryMemoryDescriptor &query_mem_desc)
#define CHECK_GE(x, y)
Definition: Logger.h:203
size_t getEffectiveKeyWidth() const
const std::vector< int64_t > target_init_vals_
const QueryMemoryDescriptor query_mem_desc_
std::unique_ptr< Function > ir_is_empty
Value * emit_load_i32(Value *ptr, Function *function)
CHECK(cgen_state)
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
QueryDescriptionType getQueryDescriptionType() const
#define CHECK_LT(x, y)
Definition: Logger.h:200
Value * emit_load_i64(Value *ptr, Function *function)
#define EMPTY_KEY_32
int32_t getTargetIdxForKey() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceLoop ( const ReductionCode reduction_code) const
private

Definition at line 939 of file ResultSetReductionJIT.cpp.

References anonymous_namespace{ResultSetReductionJIT.cpp}::generate_loop_body(), Int32, ReductionCode::ir_reduce_loop, and ReductionCode::ir_reduce_one_entry_idx.

Referenced by codegen().

939  {
940  auto ir_reduce_loop = reduction_code.ir_reduce_loop.get();
941  const auto this_buff_arg = ir_reduce_loop->arg(0);
942  const auto that_buff_arg = ir_reduce_loop->arg(1);
943  const auto start_index_arg = ir_reduce_loop->arg(2);
944  const auto end_index_arg = ir_reduce_loop->arg(3);
945  const auto that_entry_count_arg = ir_reduce_loop->arg(4);
946  const auto this_qmd_handle_arg = ir_reduce_loop->arg(5);
947  const auto that_qmd_handle_arg = ir_reduce_loop->arg(6);
948  const auto serialized_varlen_buffer_arg = ir_reduce_loop->arg(7);
949  For* for_loop =
950  static_cast<For*>(ir_reduce_loop->add<For>(start_index_arg, end_index_arg, ""));
951  generate_loop_body(for_loop,
952  ir_reduce_loop,
953  reduction_code.ir_reduce_one_entry_idx.get(),
954  this_buff_arg,
955  that_buff_arg,
956  start_index_arg,
957  that_entry_count_arg,
958  this_qmd_handle_arg,
959  that_qmd_handle_arg,
960  serialized_varlen_buffer_arg);
961  ir_reduce_loop->add<Ret>(ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int32));
962 }
std::unique_ptr< Function > ir_reduce_loop
void 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::unique_ptr< Function > ir_reduce_one_entry_idx

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneAggregateSlot ( Value this_ptr1,
Value this_ptr2,
Value that_ptr1,
Value that_ptr2,
const TargetInfo target_info,
const size_t  target_logical_idx,
const size_t  target_slot_idx,
const int64_t  init_val,
const int8_t  chosen_bytes,
Function ir_reduce_one_entry 
) const
private

Definition at line 1026 of file ResultSetReductionJIT.cpp.

References TargetInfo::agg_kind, CHECK_EQ, anonymous_namespace{ResultSetReductionJIT.cpp}::emit_aggregate_one_count(), anonymous_namespace{ResultSetReductionJIT.cpp}::emit_aggregate_one_nullable_value(), logger::FATAL, QueryMemoryDescriptor::getPaddedSlotWidthBytes(), is_distinct_target(), kAPPROX_COUNT_DISTINCT, kAVG, kCOUNT, kMAX, kMIN, kSUM, LOG, query_mem_desc_, and reduceOneCountDistinctSlot().

Referenced by reduceOneSlot().

1035  {
1036  switch (target_info.agg_kind) {
1037  case kCOUNT:
1038  case kAPPROX_COUNT_DISTINCT: {
1039  if (is_distinct_target(target_info)) {
1040  CHECK_EQ(static_cast<size_t>(chosen_bytes), sizeof(int64_t));
1042  this_ptr1, that_ptr1, target_logical_idx, ir_reduce_one_entry);
1043  break;
1044  }
1045  CHECK_EQ(int64_t(0), init_val);
1046  emit_aggregate_one_count(this_ptr1, that_ptr1, chosen_bytes, ir_reduce_one_entry);
1047  break;
1048  }
1049  case kAVG: {
1050  // Ignore float argument compaction for count component for fear of its overflow
1051  emit_aggregate_one_count(this_ptr2,
1052  that_ptr2,
1053  query_mem_desc_.getPaddedSlotWidthBytes(target_slot_idx),
1054  ir_reduce_one_entry);
1055  }
1056  // fall thru
1057  case kSUM: {
1059  this_ptr1,
1060  that_ptr1,
1061  init_val,
1062  chosen_bytes,
1063  target_info,
1064  ir_reduce_one_entry);
1065  break;
1066  }
1067  case kMIN: {
1069  this_ptr1,
1070  that_ptr1,
1071  init_val,
1072  chosen_bytes,
1073  target_info,
1074  ir_reduce_one_entry);
1075  break;
1076  }
1077  case kMAX: {
1079  this_ptr1,
1080  that_ptr1,
1081  init_val,
1082  chosen_bytes,
1083  target_info,
1084  ir_reduce_one_entry);
1085  break;
1086  }
1087  default:
1088  LOG(FATAL) << "Invalid aggregate type";
1089  }
1090 }
void 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)
#define CHECK_EQ(x, y)
Definition: Logger.h:198
#define LOG(tag)
Definition: Logger.h:185
const QueryMemoryDescriptor query_mem_desc_
Definition: sqldefs.h:71
void reduceOneCountDistinctSlot(Value *this_ptr1, Value *that_ptr1, const size_t target_logical_idx, Function *ir_reduce_one_entry) const
Definition: sqldefs.h:71
bool is_distinct_target(const TargetInfo &target_info)
Definition: TargetInfo.h:116
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
SQLAgg agg_kind
Definition: TargetInfo.h:41
Definition: sqldefs.h:71
void emit_aggregate_one_count(Value *val_ptr, Value *other_ptr, const size_t chosen_bytes, Function *ir_reduce_one_entry)
Definition: sqldefs.h:71
Definition: sqldefs.h:71

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneCountDistinctSlot ( Value this_ptr1,
Value that_ptr1,
const size_t  target_logical_idx,
Function ir_reduce_one_entry 
) const
private

Definition at line 1092 of file ResultSetReductionJIT.cpp.

References CHECK_LT, anonymous_namespace{ResultSetReductionJIT.cpp}::emit_load_i64(), QueryMemoryDescriptor::getCountDistinctDescriptorsSize(), Int64, query_mem_desc_, and Void.

Referenced by reduceOneAggregateSlot().

1096  {
1098  const auto old_set_handle = emit_load_i64(this_ptr1, ir_reduce_one_entry);
1099  const auto new_set_handle = emit_load_i64(that_ptr1, ir_reduce_one_entry);
1100  const auto this_qmd_arg = ir_reduce_one_entry->arg(2);
1101  const auto that_qmd_arg = ir_reduce_one_entry->arg(3);
1102  ir_reduce_one_entry->add<ExternalCall>(
1103  "count_distinct_set_union_jit_rt",
1104  Type::Void,
1105  std::vector<const Value*>{
1106  new_set_handle,
1107  old_set_handle,
1108  that_qmd_arg,
1109  this_qmd_arg,
1110  ir_reduce_one_entry->addConstant<ConstantInt>(target_logical_idx, Type::Int64)},
1111  "");
1112 }
const QueryMemoryDescriptor query_mem_desc_
size_t getCountDistinctDescriptorsSize() const
#define CHECK_LT(x, y)
Definition: Logger.h:200
Value * emit_load_i64(Value *ptr, Function *function)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneEntryBaseline ( const ReductionCode reduction_code) const
private

Definition at line 736 of file ResultSetReductionJIT.cpp.

References advance_slot(), QueryMemoryDescriptor::getTargetGroupbyIndex(), Int32, ReductionCode::ir_reduce_one_entry, kAVG, kSAMPLE, query_mem_desc_, reduceOneSlot(), QueryMemoryDescriptor::targetGroupbyIndicesSize(), targets_, and to_string().

Referenced by codegen().

737  {
738  auto ir_reduce_one_entry = reduction_code.ir_reduce_one_entry.get();
739  const auto this_targets_ptr_arg = ir_reduce_one_entry->arg(0);
740  const auto that_targets_ptr_arg = ir_reduce_one_entry->arg(1);
741  Value* this_ptr1 = this_targets_ptr_arg;
742  Value* that_ptr1 = that_targets_ptr_arg;
743  size_t j = 0;
744  size_t init_agg_val_idx = 0;
745  for (size_t target_logical_idx = 0; target_logical_idx < targets_.size();
746  ++target_logical_idx) {
747  const auto& target_info = targets_[target_logical_idx];
748  Value* this_ptr2{nullptr};
749  Value* that_ptr2{nullptr};
750  if (target_info.is_agg &&
751  (target_info.agg_kind == kAVG ||
752  (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_varlen()))) {
753  const auto desc = "target_" + std::to_string(target_logical_idx) + "_second_slot";
754  const auto second_slot_rel_off =
755  ir_reduce_one_entry->addConstant<ConstantInt>(sizeof(int64_t), Type::Int32);
756  this_ptr2 = ir_reduce_one_entry->add<GetElementPtr>(
757  this_ptr1, second_slot_rel_off, "this_" + desc);
758  that_ptr2 = ir_reduce_one_entry->add<GetElementPtr>(
759  that_ptr1, second_slot_rel_off, "that_" + desc);
760  }
761  reduceOneSlot(this_ptr1,
762  this_ptr2,
763  that_ptr1,
764  that_ptr2,
765  target_info,
766  target_logical_idx,
767  j,
768  init_agg_val_idx,
769  j,
770  ir_reduce_one_entry);
771  if (target_logical_idx + 1 == targets_.size()) {
772  break;
773  }
775  init_agg_val_idx = advance_slot(init_agg_val_idx, target_info, false);
776  } else {
777  if (query_mem_desc_.getTargetGroupbyIndex(target_logical_idx) < 0) {
778  init_agg_val_idx = advance_slot(init_agg_val_idx, target_info, false);
779  }
780  }
781  j = advance_slot(j, target_info, false);
782  const auto next_desc =
783  "target_" + std::to_string(target_logical_idx + 1) + "_first_slot";
784  auto next_slot_rel_off = ir_reduce_one_entry->addConstant<ConstantInt>(
785  init_agg_val_idx * sizeof(int64_t), Type::Int32);
786  this_ptr1 = ir_reduce_one_entry->add<GetElementPtr>(
787  this_targets_ptr_arg, next_slot_rel_off, next_desc);
788  that_ptr1 = ir_reduce_one_entry->add<GetElementPtr>(
789  that_targets_ptr_arg, next_slot_rel_off, next_desc);
790  }
791  ir_reduce_one_entry->add<Ret>();
792 }
void reduceOneSlot(Value *this_ptr1, Value *this_ptr2, Value *that_ptr1, Value *that_ptr2, const TargetInfo &target_info, const size_t target_logical_idx, const size_t target_slot_idx, const size_t init_agg_val_idx, const size_t first_slot_idx_for_target, Function *ir_reduce_one_entry) const
std::unique_ptr< Function > ir_reduce_one_entry
const QueryMemoryDescriptor query_mem_desc_
std::string to_string(char const *&&v)
size_t advance_slot(const size_t j, const TargetInfo &target_info, const bool separate_varlen_storage)
size_t targetGroupbyIndicesSize() const
ssize_t getTargetGroupbyIndex(const size_t target_idx) const
Definition: sqldefs.h:71
const std::vector< TargetInfo > targets_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneEntryBaselineIdx ( const ReductionCode reduction_code) const
private

Definition at line 826 of file ResultSetReductionJIT.cpp.

References Cast::BitCast, CHECK(), QueryMemoryDescriptor::didOutputColumnar(), get_row_bytes(), get_slot_off_quad(), QueryMemoryDescriptor::getGroupbyColCount(), QueryMemoryDescriptor::getQueryDescriptionType(), GroupByBaselineHash, QueryMemoryDescriptor::hasKeylessHash(), Int1, Int32, Int64Ptr, Int8, Int8Ptr, ReductionCode::ir_is_empty, ReductionCode::ir_reduce_one_entry, ReductionCode::ir_reduce_one_entry_idx, key_qw_count, BinaryOperator::Mul, query_mem_desc_, Cast::Trunc, and Void.

Referenced by codegen().

827  {
828  auto ir_reduce_one_entry_idx = reduction_code.ir_reduce_one_entry_idx.get();
833  const auto this_buff = ir_reduce_one_entry_idx->arg(0);
834  const auto that_buff = ir_reduce_one_entry_idx->arg(1);
835  const auto that_entry_idx = ir_reduce_one_entry_idx->arg(2);
836  const auto that_entry_count = ir_reduce_one_entry_idx->arg(3);
837  const auto this_qmd_handle = ir_reduce_one_entry_idx->arg(4);
838  const auto that_qmd_handle = ir_reduce_one_entry_idx->arg(5);
839  const auto serialized_varlen_buffer_arg = ir_reduce_one_entry_idx->arg(6);
840  const auto row_bytes = ir_reduce_one_entry_idx->addConstant<ConstantInt>(
842  const auto that_row_off_in_bytes = ir_reduce_one_entry_idx->add<BinaryOperator>(
843  BinaryOperator::BinaryOp::Mul, that_entry_idx, row_bytes, "that_row_off_in_bytes");
844  const auto that_row_ptr = ir_reduce_one_entry_idx->add<GetElementPtr>(
845  that_buff, that_row_off_in_bytes, "that_row_ptr");
846  const auto that_is_empty =
847  ir_reduce_one_entry_idx->add<Call>(reduction_code.ir_is_empty.get(),
848  std::vector<const Value*>{that_row_ptr},
849  "that_is_empty");
850  ir_reduce_one_entry_idx->add<ReturnEarly>(that_is_empty, 0, "");
851  const auto key_count = query_mem_desc_.getGroupbyColCount();
852  const auto one_element =
853  ir_reduce_one_entry_idx->addConstant<ConstantInt>(1, Type::Int32);
854  const auto this_targets_ptr_i64_ptr = ir_reduce_one_entry_idx->add<Alloca>(
855  Type::Int64Ptr, one_element, "this_targets_ptr_out");
856  const auto this_is_empty_ptr =
857  ir_reduce_one_entry_idx->add<Alloca>(Type::Int8, one_element, "this_is_empty_out");
858  ir_reduce_one_entry_idx->add<ExternalCall>(
859  "get_group_value_reduction_rt",
860  Type::Void,
861  std::vector<const Value*>{
862  this_buff,
863  that_row_ptr,
864  ir_reduce_one_entry_idx->addConstant<ConstantInt>(key_count, Type::Int32),
865  this_qmd_handle,
866  that_buff,
867  that_entry_idx,
868  that_entry_count,
869  row_bytes,
870  this_targets_ptr_i64_ptr,
871  this_is_empty_ptr},
872  "");
873  const auto this_targets_ptr_i64 = ir_reduce_one_entry_idx->add<Load>(
874  this_targets_ptr_i64_ptr, "this_targets_ptr_i64");
875  auto this_is_empty =
876  ir_reduce_one_entry_idx->add<Load>(this_is_empty_ptr, "this_is_empty");
877  this_is_empty = ir_reduce_one_entry_idx->add<Cast>(
878  Cast::CastOp::Trunc, this_is_empty, Type::Int1, "this_is_empty_bool");
879  ir_reduce_one_entry_idx->add<ReturnEarly>(this_is_empty, 0, "");
881  const auto this_targets_ptr = ir_reduce_one_entry_idx->add<Cast>(
882  Cast::CastOp::BitCast, this_targets_ptr_i64, Type::Int8Ptr, "this_targets_ptr");
883  const auto key_byte_count = key_qw_count * sizeof(int64_t);
884  const auto key_byte_count_lv =
885  ir_reduce_one_entry_idx->addConstant<ConstantInt>(key_byte_count, Type::Int32);
886  const auto that_targets_ptr = ir_reduce_one_entry_idx->add<GetElementPtr>(
887  that_row_ptr, key_byte_count_lv, "that_targets_ptr");
888  ir_reduce_one_entry_idx->add<Call>(
889  reduction_code.ir_reduce_one_entry.get(),
890  std::vector<const Value*>{this_targets_ptr,
891  that_targets_ptr,
892  this_qmd_handle,
893  that_qmd_handle,
894  serialized_varlen_buffer_arg},
895  "");
896  ir_reduce_one_entry_idx->add<Ret>();
897 }
size_t get_slot_off_quad(const QueryMemoryDescriptor &query_mem_desc)
std::unique_ptr< Function > ir_reduce_one_entry
const int64_t const uint32_t const uint32_t key_qw_count
const QueryMemoryDescriptor query_mem_desc_
std::unique_ptr< Function > ir_is_empty
CHECK(cgen_state)
size_t getGroupbyColCount() const
std::unique_ptr< Function > ir_reduce_one_entry_idx
QueryDescriptionType getQueryDescriptionType() const
size_t get_row_bytes(const QueryMemoryDescriptor &query_mem_desc)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneEntryNoCollisions ( const ReductionCode reduction_code) const
private

Definition at line 623 of file ResultSetReductionJIT.cpp.

References align_to_int64(), get_key_bytes_rowwise(), Int32, ReductionCode::ir_is_empty, ReductionCode::ir_reduce_one_entry, query_mem_desc_, and reduceOneEntryTargetsNoCollisions().

Referenced by codegen().

624  {
625  auto ir_reduce_one_entry = reduction_code.ir_reduce_one_entry.get();
626  const auto this_row_ptr = ir_reduce_one_entry->arg(0);
627  const auto that_row_ptr = ir_reduce_one_entry->arg(1);
628  const auto that_is_empty =
629  ir_reduce_one_entry->add<Call>(reduction_code.ir_is_empty.get(),
630  std::vector<const Value*>{that_row_ptr},
631  "that_is_empty");
632  ir_reduce_one_entry->add<ReturnEarly>(that_is_empty, 0, "");
633 
634  const auto key_bytes = get_key_bytes_rowwise(query_mem_desc_);
635  if (key_bytes) { // copy the key from right hand side
636  ir_reduce_one_entry->add<MemCpy>(
637  this_row_ptr,
638  that_row_ptr,
639  ir_reduce_one_entry->addConstant<ConstantInt>(key_bytes, Type::Int32));
640  }
641 
642  const auto key_bytes_with_padding = align_to_int64(key_bytes);
643  const auto key_bytes_lv =
644  ir_reduce_one_entry->addConstant<ConstantInt>(key_bytes_with_padding, Type::Int32);
645  const auto this_targets_start_ptr = ir_reduce_one_entry->add<GetElementPtr>(
646  this_row_ptr, key_bytes_lv, "this_targets_start");
647  const auto that_targets_start_ptr = ir_reduce_one_entry->add<GetElementPtr>(
648  that_row_ptr, key_bytes_lv, "that_targets_start");
649 
651  ir_reduce_one_entry, this_targets_start_ptr, that_targets_start_ptr);
652 }
std::unique_ptr< Function > ir_reduce_one_entry
const QueryMemoryDescriptor query_mem_desc_
std::unique_ptr< Function > ir_is_empty
void reduceOneEntryTargetsNoCollisions(Function *ir_reduce_one_entry, Value *this_targets_start_ptr, Value *that_targets_start_ptr) const
size_t get_key_bytes_rowwise(const QueryMemoryDescriptor &query_mem_desc)
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneEntryNoCollisionsIdx ( const ReductionCode reduction_code) const
private

Definition at line 794 of file ResultSetReductionJIT.cpp.

References CHECK(), get_row_bytes(), QueryMemoryDescriptor::getQueryDescriptionType(), GroupByPerfectHash, Int32, ReductionCode::ir_reduce_one_entry, ReductionCode::ir_reduce_one_entry_idx, BinaryOperator::Mul, NonGroupedAggregate, and query_mem_desc_.

Referenced by codegen().

795  {
796  auto ir_reduce_one_entry_idx = reduction_code.ir_reduce_one_entry_idx.get();
801  const auto this_buff = ir_reduce_one_entry_idx->arg(0);
802  const auto that_buff = ir_reduce_one_entry_idx->arg(1);
803  const auto entry_idx = ir_reduce_one_entry_idx->arg(2);
804  const auto this_qmd_handle = ir_reduce_one_entry_idx->arg(4);
805  const auto that_qmd_handle = ir_reduce_one_entry_idx->arg(5);
806  const auto serialized_varlen_buffer_arg = ir_reduce_one_entry_idx->arg(6);
807  const auto row_bytes = ir_reduce_one_entry_idx->addConstant<ConstantInt>(
809  const auto row_off_in_bytes = ir_reduce_one_entry_idx->add<BinaryOperator>(
810  BinaryOperator::BinaryOp::Mul, entry_idx, row_bytes, "row_off_in_bytes");
811  const auto this_row_ptr = ir_reduce_one_entry_idx->add<GetElementPtr>(
812  this_buff, row_off_in_bytes, "this_row_ptr");
813  const auto that_row_ptr = ir_reduce_one_entry_idx->add<GetElementPtr>(
814  that_buff, row_off_in_bytes, "that_row_ptr");
815  ir_reduce_one_entry_idx->add<Call>(
816  reduction_code.ir_reduce_one_entry.get(),
817  std::vector<const Value*>{this_row_ptr,
818  that_row_ptr,
819  this_qmd_handle,
820  that_qmd_handle,
821  serialized_varlen_buffer_arg},
822  "");
823  ir_reduce_one_entry_idx->add<Ret>();
824 }
std::unique_ptr< Function > ir_reduce_one_entry
const QueryMemoryDescriptor query_mem_desc_
CHECK(cgen_state)
std::unique_ptr< Function > ir_reduce_one_entry_idx
QueryDescriptionType getQueryDescriptionType() const
size_t get_row_bytes(const QueryMemoryDescriptor &query_mem_desc)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneEntryTargetsNoCollisions ( Function ir_reduce_one_entry,
Value this_targets_start_ptr,
Value that_targets_start_ptr 
) const
private

Definition at line 654 of file ResultSetReductionJIT.cpp.

References QueryMemoryDescriptor::getColSlotContext(), QueryMemoryDescriptor::getPaddedSlotWidthBytes(), QueryMemoryDescriptor::getTargetGroupbyIndex(), Int32, kAVG, kSAMPLE, query_mem_desc_, reduceOneSlot(), QueryMemoryDescriptor::targetGroupbyIndicesSize(), targets_, to_string(), and UNLIKELY.

Referenced by reduceOneEntryNoCollisions().

657  {
658  const auto& col_slot_context = query_mem_desc_.getColSlotContext();
659  Value* this_targets_ptr = this_targets_start_ptr;
660  Value* that_targets_ptr = that_targets_start_ptr;
661  size_t init_agg_val_idx = 0;
662  for (size_t target_logical_idx = 0; target_logical_idx < targets_.size();
663  ++target_logical_idx) {
664  const auto& target_info = targets_[target_logical_idx];
665  const auto& slots_for_col = col_slot_context.getSlotsForCol(target_logical_idx);
666  Value* this_ptr2{nullptr};
667  Value* that_ptr2{nullptr};
668 
669  bool two_slot_target{false};
670  if (target_info.is_agg &&
671  (target_info.agg_kind == kAVG ||
672  (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_varlen()))) {
673  // Note that this assumes if one of the slot pairs in a given target is an array,
674  // all slot pairs are arrays. Currently this is true for all geo targets, but we
675  // should better codify and store this information in the future
676  two_slot_target = true;
677  }
678 
679  for (size_t target_slot_idx = slots_for_col.front();
680  target_slot_idx < slots_for_col.back() + 1;
681  target_slot_idx += 2) {
682  const auto slot_off_val = query_mem_desc_.getPaddedSlotWidthBytes(target_slot_idx);
683  const auto slot_off =
684  ir_reduce_one_entry->addConstant<ConstantInt>(slot_off_val, Type::Int32);
685  if (UNLIKELY(two_slot_target)) {
686  const auto desc = "target_" + std::to_string(target_logical_idx) + "_second_slot";
687  this_ptr2 = ir_reduce_one_entry->add<GetElementPtr>(
688  this_targets_ptr, slot_off, "this_" + desc);
689  that_ptr2 = ir_reduce_one_entry->add<GetElementPtr>(
690  that_targets_ptr, slot_off, "that_" + desc);
691  }
692  reduceOneSlot(this_targets_ptr,
693  this_ptr2,
694  that_targets_ptr,
695  that_ptr2,
696  target_info,
697  target_logical_idx,
698  target_slot_idx,
699  init_agg_val_idx,
700  slots_for_col.front(),
701  ir_reduce_one_entry);
702  auto increment_agg_val_idx_maybe =
703  [&init_agg_val_idx, &target_logical_idx, this](const int slot_count) {
705  query_mem_desc_.getTargetGroupbyIndex(target_logical_idx) < 0) {
706  init_agg_val_idx += slot_count;
707  }
708  };
709  if (target_logical_idx + 1 == targets_.size() &&
710  target_slot_idx + 1 >= slots_for_col.back()) {
711  break;
712  }
713  const auto next_desc =
714  "target_" + std::to_string(target_logical_idx + 1) + "_first_slot";
715  if (UNLIKELY(two_slot_target)) {
716  increment_agg_val_idx_maybe(2);
717  const auto two_slot_off = ir_reduce_one_entry->addConstant<ConstantInt>(
718  slot_off_val + query_mem_desc_.getPaddedSlotWidthBytes(target_slot_idx + 1),
719  Type::Int32);
720  this_targets_ptr = ir_reduce_one_entry->add<GetElementPtr>(
721  this_targets_ptr, two_slot_off, "this_" + next_desc);
722  that_targets_ptr = ir_reduce_one_entry->add<GetElementPtr>(
723  that_targets_ptr, two_slot_off, "that_" + next_desc);
724  } else {
725  increment_agg_val_idx_maybe(1);
726  this_targets_ptr = ir_reduce_one_entry->add<GetElementPtr>(
727  this_targets_ptr, slot_off, "this_" + next_desc);
728  that_targets_ptr = ir_reduce_one_entry->add<GetElementPtr>(
729  that_targets_ptr, slot_off, "that_" + next_desc);
730  }
731  }
732  }
733  ir_reduce_one_entry->add<Ret>();
734 }
void reduceOneSlot(Value *this_ptr1, Value *this_ptr2, Value *that_ptr1, Value *that_ptr2, const TargetInfo &target_info, const size_t target_logical_idx, const size_t target_slot_idx, const size_t init_agg_val_idx, const size_t first_slot_idx_for_target, Function *ir_reduce_one_entry) const
const QueryMemoryDescriptor query_mem_desc_
std::string to_string(char const *&&v)
size_t targetGroupbyIndicesSize() const
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
ssize_t getTargetGroupbyIndex(const size_t target_idx) const
#define UNLIKELY(x)
Definition: likely.h:20
const ColSlotContext & getColSlotContext() const
Definition: sqldefs.h:71
const std::vector< TargetInfo > targets_

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ResultSetReductionJIT::reduceOneSlot ( Value this_ptr1,
Value this_ptr2,
Value that_ptr1,
Value that_ptr2,
const TargetInfo target_info,
const size_t  target_logical_idx,
const size_t  target_slot_idx,
const size_t  init_agg_val_idx,
const size_t  first_slot_idx_for_target,
Function ir_reduce_one_entry 
) const
private

Definition at line 964 of file ResultSetReductionJIT.cpp.

References TargetInfo::agg_kind, CHECK(), CHECK_LT, anonymous_namespace{ResultSetReductionJIT.cpp}::emit_write_projection(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_elem_type(), get_width_for_slot(), QueryMemoryDescriptor::getTargetGroupbyIndex(), Int64, TargetInfo::is_agg, SQLTypeInfoCore< TYPE_FACET_PACK >::is_geometry(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_string(), SQLTypeInfoCore< TYPE_FACET_PACK >::is_varlen(), kSAMPLE, query_mem_desc_, reduceOneAggregateSlot(), TargetInfo::sql_type, takes_float_argument(), target_init_vals_, QueryMemoryDescriptor::targetGroupbyIndicesSize(), and Void.

Referenced by reduceOneEntryBaseline(), and reduceOneEntryTargetsNoCollisions().

973  {
975  if (query_mem_desc_.getTargetGroupbyIndex(target_logical_idx) >= 0) {
976  return;
977  }
978  }
979  const bool float_argument_input = takes_float_argument(target_info);
980  const auto chosen_bytes =
981  get_width_for_slot(target_slot_idx, float_argument_input, query_mem_desc_);
982  CHECK_LT(init_agg_val_idx, target_init_vals_.size());
983  auto init_val = target_init_vals_[init_agg_val_idx];
984  if (target_info.is_agg && target_info.agg_kind != kSAMPLE) {
985  reduceOneAggregateSlot(this_ptr1,
986  this_ptr2,
987  that_ptr1,
988  that_ptr2,
989  target_info,
990  target_logical_idx,
991  target_slot_idx,
992  init_val,
993  chosen_bytes,
994  ir_reduce_one_entry);
995  } else {
997  this_ptr1, that_ptr1, init_val, chosen_bytes, ir_reduce_one_entry);
998  if (target_info.agg_kind == kSAMPLE && target_info.sql_type.is_varlen()) {
999  CHECK(this_ptr2 && that_ptr2);
1000  size_t length_to_elems{0};
1001  if (target_info.sql_type.is_geometry()) {
1002  // TODO: Assumes hard-coded sizes for geometry targets
1003  length_to_elems = target_slot_idx == first_slot_idx_for_target ? 1 : 4;
1004  } else {
1005  const auto& elem_ti = target_info.sql_type.get_elem_type();
1006  length_to_elems = target_info.sql_type.is_string() ? 1 : elem_ti.get_size();
1007  }
1008  const auto serialized_varlen_buffer_arg = ir_reduce_one_entry->arg(4);
1009  ir_reduce_one_entry->add<ExternalCall>(
1010  "serialized_varlen_buffer_sample",
1011  Type::Void,
1012  std::vector<const Value*>{
1013  serialized_varlen_buffer_arg,
1014  this_ptr1,
1015  this_ptr2,
1016  that_ptr1,
1017  that_ptr2,
1018  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64),
1019  ir_reduce_one_entry->addConstant<ConstantInt>(length_to_elems,
1020  Type::Int64)},
1021  "");
1022  }
1023  }
1024 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
bool is_varlen() const
Definition: sqltypes.h:491
const std::vector< int64_t > target_init_vals_
void reduceOneAggregateSlot(Value *this_ptr1, Value *this_ptr2, Value *that_ptr1, Value *that_ptr2, const TargetInfo &target_info, const size_t target_logical_idx, const size_t target_slot_idx, const int64_t init_val, const int8_t chosen_bytes, Function *ir_reduce_one_entry) const
bool takes_float_argument(const TargetInfo &target_info)
Definition: TargetInfo.h:120
int8_t get_width_for_slot(const size_t target_slot_idx, const bool float_argument_input, const QueryMemoryDescriptor &query_mem_desc)
const QueryMemoryDescriptor query_mem_desc_
bool is_agg
Definition: TargetInfo.h:40
CHECK(cgen_state)
size_t targetGroupbyIndicesSize() const
void emit_write_projection(Value *slot_pi8, Value *other_pi8, const int64_t init_val, const size_t chosen_bytes, Function *ir_reduce_one_entry)
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool is_geometry() const
Definition: sqltypes.h:489
ssize_t getTargetGroupbyIndex(const size_t target_idx) const
#define CHECK_LT(x, y)
Definition: Logger.h:200
bool is_string() const
Definition: sqltypes.h:477
SQLTypeInfoCore get_elem_type() const
Definition: sqltypes.h:659

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

CodeCache ResultSetReductionJIT::s_code_cache
staticprivate

Definition at line 132 of file ResultSetReductionJIT.h.

Referenced by clearCache(), and codegen().

const std::vector<int64_t> ResultSetReductionJIT::target_init_vals_
private

Definition at line 131 of file ResultSetReductionJIT.h.

Referenced by cacheKey(), isEmpty(), and reduceOneSlot().

const std::vector<TargetInfo> ResultSetReductionJIT::targets_
private

The documentation for this class was generated from the following files: