OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{ResultSetReductionJIT.cpp} Namespace Reference

Functions

Valueemit_load (Value *ptr, Type ptr_type, Function *function)
 
Valueemit_load_i32 (Value *ptr, Function *function)
 
Valueemit_load_i64 (Value *ptr, Function *function)
 
Valueemit_read_int_from_buff (Value *ptr, const int8_t compact_sz, Function *function)
 
void 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 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 emit_aggregate_one_count (Value *val_ptr, Value *other_ptr, const size_t chosen_bytes, Function *ir_reduce_one_entry)
 
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)
 
const Valueemit_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< Functioncreate_function (const std::string name, const std::vector< Function::NamedArg > &arg_types, const Type ret_type, const bool always_inline)
 
std::unique_ptr< Functionsetup_is_empty_entry (ReductionCode *reduction_code)
 
std::unique_ptr< Functionsetup_reduce_one_entry (ReductionCode *reduction_code, const QueryDescriptionType hash_type)
 
std::unique_ptr< Functionsetup_reduce_one_entry_idx (ReductionCode *reduction_code)
 
std::unique_ptr< Functionsetup_reduce_loop (ReductionCode *reduction_code)
 
llvm::Function * create_llvm_function (const Function *function, CgenState *cgen_state)
 
ReductionCode setup_functions_ir (const QueryDescriptionType hash_type)
 
bool is_aggregate_query (const QueryDescriptionType hash_type)
 
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)
 
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::string target_info_key (const TargetInfo &target_info)
 

Variables

const int32_t WATCHDOG_ERROR
 
const int32_t INTERRUPT_ERROR {10}
 
const size_t INTERP_THRESHOLD {25}
 

Function Documentation

std::unique_ptr<Function> anonymous_namespace{ResultSetReductionJIT.cpp}::create_function ( const std::string  name,
const std::vector< Function::NamedArg > &  arg_types,
const Type  ret_type,
const bool  always_inline 
)

Definition at line 273 of file ResultSetReductionJIT.cpp.

References setup::name.

Referenced by setup_is_empty_entry(), setup_reduce_loop(), setup_reduce_one_entry(), and setup_reduce_one_entry_idx().

277  {
278  return std::make_unique<Function>(name, arg_types, ret_type, always_inline);
279 }
string name
Definition: setup.in.py:72

+ Here is the caller graph for this function:

llvm::Function* anonymous_namespace{ResultSetReductionJIT.cpp}::create_llvm_function ( const Function function,
CgenState cgen_state 
)

Definition at line 349 of file ResultSetReductionJIT.cpp.

References AUTOMATIC_IR_METADATA, CHECK, CgenState::context_, llvm_type(), mark_function_always_inline(), CgenState::module_, setup::name, and Void.

Referenced by ResultSetReductionJIT::codegen(), and GpuReductionHelperJIT::codegen().

349  {
350  AUTOMATIC_IR_METADATA(cgen_state);
351  auto& ctx = cgen_state->context_;
352  std::vector<llvm::Type*> parameter_types;
353  const auto& arg_types = function->arg_types();
354  for (const auto& named_arg : arg_types) {
355  CHECK(named_arg.type != Type::Void);
356  parameter_types.push_back(llvm_type(named_arg.type, ctx));
357  }
358  const auto func_type = llvm::FunctionType::get(
359  llvm_type(function->ret_type(), ctx), parameter_types, false);
360  const auto linkage = function->always_inline() ? llvm::Function::PrivateLinkage
361  : llvm::Function::ExternalLinkage;
362  auto func =
363  llvm::Function::Create(func_type, linkage, function->name(), cgen_state->module_);
364  const auto arg_it = func->arg_begin();
365  for (size_t i = 0; i < arg_types.size(); ++i) {
366  const auto arg = &*(arg_it + i);
367  arg->setName(arg_types[i].name);
368  }
369  if (function->always_inline()) {
371  }
372  return func;
373 }
void mark_function_always_inline(llvm::Function *func)
llvm::Module * module_
Definition: CgenState.h:350
llvm::LLVMContext & context_
Definition: CgenState.h:359
#define AUTOMATIC_IR_METADATA(CGENSTATE)
llvm::Type * llvm_type(const Type type, llvm::LLVMContext &ctx)
#define CHECK(condition)
Definition: Logger.h:223
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 183 of file ResultSetReductionJIT.cpp.

References Cast::BitCast, CHECK_EQ, emit_load(), Int32Ptr, and Int64Ptr.

Referenced by ResultSetReductionJIT::reduceOneAggregateSlot().

186  {
187  const auto dest_name = "count_dest";
188  if (chosen_bytes == sizeof(int32_t)) {
189  const auto agg = ir_reduce_one_entry->add<Cast>(
190  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
191  const auto val = emit_load(other_ptr, Type::Int32Ptr, ir_reduce_one_entry);
192  ir_reduce_one_entry->add<Call>(
193  "agg_sum_int32", std::vector<const Value*>{agg, val}, "");
194  } else {
195  CHECK_EQ(chosen_bytes, sizeof(int64_t));
196  const auto agg = ir_reduce_one_entry->add<Cast>(
197  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
198  const auto val = emit_load(other_ptr, Type::Int64Ptr, ir_reduce_one_entry);
199  ir_reduce_one_entry->add<Call>("agg_sum", std::vector<const Value*>{agg, val}, "");
200  }
201 }
#define CHECK_EQ(x, y)
Definition: Logger.h:231
Value * emit_load(Value *ptr, Type ptr_type, Function *function)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 123 of file ResultSetReductionJIT.cpp.

References Cast::BitCast, CHECK_EQ, Double, DoublePtr, emit_aggregate_one_value(), emit_load(), Float, FloatPtr, get_compact_type(), Int32, Int32Ptr, Int64, Int64Ptr, and TargetInfo::skip_null_val.

Referenced by ResultSetReductionJIT::reduceOneAggregateSlot().

129  {
130  const auto dest_name = agg_kind + "_dest";
131  if (agg_info.skip_null_val) {
132  const auto sql_type = get_compact_type(agg_info);
133  if (sql_type.is_fp()) {
134  if (chosen_bytes == sizeof(float)) {
135  const auto agg = ir_reduce_one_entry->add<Cast>(
136  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
137  const auto val = emit_load(other_ptr, Type::FloatPtr, ir_reduce_one_entry);
138  const auto init_val_lv = ir_reduce_one_entry->addConstant<ConstantFP>(
139  *reinterpret_cast<const float*>(may_alias_ptr(&init_val)), Type::Float);
140  ir_reduce_one_entry->add<Call>("agg_" + agg_kind + "_float_skip_val",
141  std::vector<const Value*>{agg, val, init_val_lv},
142  "");
143  } else {
144  CHECK_EQ(chosen_bytes, sizeof(double));
145  const auto agg = ir_reduce_one_entry->add<Cast>(
146  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
147  const auto val = emit_load(other_ptr, Type::DoublePtr, ir_reduce_one_entry);
148  const auto init_val_lv = ir_reduce_one_entry->addConstant<ConstantFP>(
149  *reinterpret_cast<const double*>(may_alias_ptr(&init_val)), Type::Double);
150  ir_reduce_one_entry->add<Call>("agg_" + agg_kind + "_double_skip_val",
151  std::vector<const Value*>{agg, val, init_val_lv},
152  "");
153  }
154  } else {
155  if (chosen_bytes == sizeof(int32_t)) {
156  const auto agg = ir_reduce_one_entry->add<Cast>(
157  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
158  const auto val = emit_load(other_ptr, Type::Int32Ptr, ir_reduce_one_entry);
159  const auto init_val_lv =
160  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int32);
161  ir_reduce_one_entry->add<Call>("agg_" + agg_kind + "_int32_skip_val",
162  std::vector<const Value*>{agg, val, init_val_lv},
163  "");
164  } else {
165  CHECK_EQ(chosen_bytes, sizeof(int64_t));
166  const auto agg = ir_reduce_one_entry->add<Cast>(
167  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
168  const auto val = emit_load(other_ptr, Type::Int64Ptr, ir_reduce_one_entry);
169  const auto init_val_lv =
170  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64);
171  ir_reduce_one_entry->add<Call>("agg_" + agg_kind + "_skip_val",
172  std::vector<const Value*>{agg, val, init_val_lv},
173  "");
174  }
175  }
176  } else {
178  agg_kind, val_ptr, other_ptr, chosen_bytes, agg_info, ir_reduce_one_entry);
179  }
180 }
#define CHECK_EQ(x, y)
Definition: Logger.h:231
bool skip_null_val
Definition: TargetInfo.h:53
void 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)
const SQLTypeInfo get_compact_type(const TargetInfo &target)
Value * emit_load(Value *ptr, Type ptr_type, Function *function)

+ Here is the call graph for this function:

+ Here is the caller graph for this 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 
)

Definition at line 81 of file ResultSetReductionJIT.cpp.

References Cast::BitCast, CHECK_EQ, DoublePtr, emit_load(), FloatPtr, get_compact_type(), Int32Ptr, and Int64Ptr.

Referenced by emit_aggregate_one_nullable_value().

86  {
87  const auto sql_type = get_compact_type(agg_info);
88  const auto dest_name = agg_kind + "_dest";
89  if (sql_type.is_fp()) {
90  if (chosen_bytes == sizeof(float)) {
91  const auto agg = ir_reduce_one_entry->add<Cast>(
92  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
93  const auto val = emit_load(other_ptr, Type::FloatPtr, ir_reduce_one_entry);
94  ir_reduce_one_entry->add<Call>(
95  "agg_" + agg_kind + "_float", std::vector<const Value*>{agg, val}, "");
96  } else {
97  CHECK_EQ(chosen_bytes, sizeof(double));
98  const auto agg = ir_reduce_one_entry->add<Cast>(
99  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
100  const auto val = emit_load(other_ptr, Type::DoublePtr, ir_reduce_one_entry);
101  ir_reduce_one_entry->add<Call>(
102  "agg_" + agg_kind + "_double", std::vector<const Value*>{agg, val}, "");
103  }
104  } else {
105  if (chosen_bytes == sizeof(int32_t)) {
106  const auto agg = ir_reduce_one_entry->add<Cast>(
107  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
108  const auto val = emit_load(other_ptr, Type::Int32Ptr, ir_reduce_one_entry);
109  ir_reduce_one_entry->add<Call>(
110  "agg_" + agg_kind + "_int32", std::vector<const Value*>{agg, val}, "");
111  } else {
112  CHECK_EQ(chosen_bytes, sizeof(int64_t));
113  const auto agg = ir_reduce_one_entry->add<Cast>(
114  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
115  const auto val = emit_load(other_ptr, Type::Int64Ptr, ir_reduce_one_entry);
116  ir_reduce_one_entry->add<Call>(
117  "agg_" + agg_kind, std::vector<const Value*>{agg, val}, "");
118  }
119  }
120 }
#define CHECK_EQ(x, y)
Definition: Logger.h:231
const SQLTypeInfo get_compact_type(const TargetInfo &target)
Value * emit_load(Value *ptr, Type ptr_type, Function *function)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Value* anonymous_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 
)

Definition at line 237 of file ResultSetReductionJIT.cpp.

References Cast::BitCast, CHECK_EQ, emit_load_i32(), emit_load_i64(), Int32, Int32Ptr, Int64, and Int64Ptr.

Referenced by ResultSetReductionJIT::reduceOneSlot().

241  {
242  if (chosen_bytes == sizeof(int32_t)) {
243  const auto func_name = "checked_single_agg_id_int32";
244  const auto proj_val = emit_load_i32(other_pi8, ir_reduce_one_entry);
245  const auto slot_pi32 = ir_reduce_one_entry->add<Cast>(
246  Cast::CastOp::BitCast, slot_pi8, Type::Int32Ptr, "");
247  return ir_reduce_one_entry->add<Call>(
248  func_name,
249  Type::Int32,
250  std::vector<const Value*>{
251  slot_pi32,
252  proj_val,
253  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int32)},
254  "");
255  } else {
256  const auto func_name = "checked_single_agg_id";
257  CHECK_EQ(chosen_bytes, sizeof(int64_t));
258  const auto proj_val = emit_load_i64(other_pi8, ir_reduce_one_entry);
259  const auto slot_pi64 = ir_reduce_one_entry->add<Cast>(
260  Cast::CastOp::BitCast, slot_pi8, Type::Int64Ptr, "");
261 
262  return ir_reduce_one_entry->add<Call>(
263  func_name,
264  Type::Int32,
265  std::vector<const Value*>{
266  slot_pi64,
267  proj_val,
268  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64)},
269  "");
270  }
271 }
#define CHECK_EQ(x, y)
Definition: Logger.h:231
Value * emit_load_i32(Value *ptr, Function *function)
Value * emit_load_i64(Value *ptr, Function *function)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value* anonymous_namespace{ResultSetReductionJIT.cpp}::emit_load ( Value ptr,
Type  ptr_type,
Function function 
)

Definition at line 46 of file ResultSetReductionJIT.cpp.

References Cast::BitCast, and Value::label().

Referenced by emit_aggregate_one_count(), emit_aggregate_one_nullable_value(), emit_aggregate_one_value(), emit_load_i32(), and emit_load_i64().

46  {
47  return function->add<Load>(
48  function->add<Cast>(Cast::CastOp::BitCast, ptr, ptr_type, ""),
49  ptr->label() + "_loaded");
50 }
const std::string & label() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value* anonymous_namespace{ResultSetReductionJIT.cpp}::emit_load_i32 ( Value ptr,
Function function 
)

Definition at line 53 of file ResultSetReductionJIT.cpp.

References emit_load(), and Int32Ptr.

Referenced by emit_checked_write_projection(), emit_read_int_from_buff(), emit_write_projection(), and ResultSetReductionJIT::isEmpty().

53  {
54  return emit_load(ptr, Type::Int32Ptr, function);
55 }
Value * emit_load(Value *ptr, Type ptr_type, Function *function)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value* anonymous_namespace{ResultSetReductionJIT.cpp}::emit_load_i64 ( Value ptr,
Function function 
)

Definition at line 58 of file ResultSetReductionJIT.cpp.

References emit_load(), and Int64Ptr.

Referenced by emit_checked_write_projection(), emit_read_int_from_buff(), emit_write_projection(), ResultSetReductionJIT::isEmpty(), ResultSetReductionJIT::reduceOneApproxQuantileSlot(), and ResultSetReductionJIT::reduceOneCountDistinctSlot().

58  {
59  return emit_load(ptr, Type::Int64Ptr, function);
60 }
Value * emit_load(Value *ptr, Type ptr_type, Function *function)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Value* anonymous_namespace{ResultSetReductionJIT.cpp}::emit_read_int_from_buff ( Value ptr,
const int8_t  compact_sz,
Function function 
)

Definition at line 63 of file ResultSetReductionJIT.cpp.

References emit_load_i32(), emit_load_i64(), logger::FATAL, Int64, LOG, and Cast::SExt.

Referenced by ResultSetReductionJIT::isEmpty().

63  {
64  switch (compact_sz) {
65  case 8: {
66  return emit_load_i64(ptr, function);
67  }
68  case 4: {
69  const auto loaded_val = emit_load_i32(ptr, function);
70  return function->add<Cast>(Cast::CastOp::SExt, loaded_val, Type::Int64, "");
71  }
72  default: {
73  LOG(FATAL) << "Invalid byte width: " << compact_sz;
74  return nullptr;
75  }
76  }
77 }
#define LOG(tag)
Definition: Logger.h:217
Value * emit_load_i32(Value *ptr, Function *function)
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 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 
)

Definition at line 206 of file ResultSetReductionJIT.cpp.

References CHECK_EQ, emit_load_i32(), emit_load_i64(), Int64, and to_string().

Referenced by ResultSetReductionJIT::reduceOneSlot().

210  {
211  const auto func_name = "write_projection_int" + std::to_string(chosen_bytes * 8);
212  if (chosen_bytes == sizeof(int32_t)) {
213  const auto proj_val = emit_load_i32(other_pi8, ir_reduce_one_entry);
214  ir_reduce_one_entry->add<Call>(
215  func_name,
216  std::vector<const Value*>{
217  slot_pi8,
218  proj_val,
219  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64)},
220  "");
221  } else {
222  CHECK_EQ(chosen_bytes, sizeof(int64_t));
223  const auto proj_val = emit_load_i64(other_pi8, ir_reduce_one_entry);
224  ir_reduce_one_entry->add<Call>(
225  func_name,
226  std::vector<const Value*>{
227  slot_pi8,
228  proj_val,
229  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64)},
230  "");
231  }
232 }
#define CHECK_EQ(x, y)
Definition: Logger.h:231
std::string to_string(char const *&&v)
Value * emit_load_i32(Value *ptr, Function *function)
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 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 
)

Definition at line 966 of file ResultSetReductionJIT.cpp.

References BinaryOperator::Add, For::add(), g_enable_dynamic_watchdog, g_enable_non_kernel_time_query_interrupt, Int32, Int64, Int8, INTERRUPT_ERROR, For::iter(), ICmp::NE, Cast::SExt, and WATCHDOG_ERROR.

Referenced by ResultSetReductionJIT::reduceLoop().

975  {
976  const auto that_entry_idx = for_loop->add<BinaryOperator>(
977  BinaryOperator::BinaryOp::Add, for_loop->iter(), start_index, "that_entry_idx");
978  const auto sample_seed =
979  for_loop->add<Cast>(Cast::CastOp::SExt, that_entry_idx, Type::Int64, "");
981  const auto checker_rt_name =
982  g_enable_dynamic_watchdog ? "check_watchdog_rt" : "check_interrupt_rt";
983  const auto error_code = g_enable_dynamic_watchdog ? WATCHDOG_ERROR : INTERRUPT_ERROR;
984  const auto checker_triggered = for_loop->add<ExternalCall>(
985  checker_rt_name, Type::Int8, std::vector<const Value*>{sample_seed}, "");
986  const auto interrupt_triggered_bool =
987  for_loop->add<ICmp>(ICmp::Predicate::NE,
988  checker_triggered,
989  ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int8),
990  "");
991  for_loop->add<ReturnEarly>(
992  interrupt_triggered_bool,
993  ir_reduce_loop->addConstant<ConstantInt>(error_code, Type::Int32),
994  "");
995  }
996  const auto reduce_rc =
997  for_loop->add<Call>(ir_reduce_one_entry_idx,
998  std::vector<const Value*>{this_buff,
999  that_buff,
1000  that_entry_idx,
1001  that_entry_count,
1002  this_qmd_handle,
1003  that_qmd_handle,
1004  serialized_varlen_buffer},
1005  "");
1006 
1007  auto reduce_rc_bool =
1008  for_loop->add<ICmp>(ICmp::Predicate::NE,
1009  reduce_rc,
1010  ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int32),
1011  "");
1012  for_loop->add<ReturnEarly>(reduce_rc_bool, reduce_rc, "");
1013 }
bool g_enable_dynamic_watchdog
Definition: Execute.cpp:80
bool g_enable_non_kernel_time_query_interrupt
Definition: Execute.cpp:126
Value * add(Args &&...args)
const Value * iter() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{ResultSetReductionJIT.cpp}::is_aggregate_query ( const QueryDescriptionType  hash_type)

Definition at line 386 of file ResultSetReductionJIT.cpp.

References GroupByBaselineHash, GroupByPerfectHash, and NonGroupedAggregate.

Referenced by ResultSetReductionJIT::codegen(), and ResultSetReductionJIT::isEmpty().

+ Here is the caller graph for this function:

ReductionCode anonymous_namespace{ResultSetReductionJIT.cpp}::setup_functions_ir ( const QueryDescriptionType  hash_type)

Definition at line 377 of file ResultSetReductionJIT.cpp.

References ReductionCode::ir_is_empty, setup_is_empty_entry(), setup_reduce_loop(), setup_reduce_one_entry(), and setup_reduce_one_entry_idx().

Referenced by ResultSetReductionJIT::codegen(), and GpuReductionHelperJIT::codegen().

377  {
378  ReductionCode reduction_code{};
379  reduction_code.ir_is_empty = setup_is_empty_entry(&reduction_code);
380  reduction_code.ir_reduce_one_entry = setup_reduce_one_entry(&reduction_code, hash_type);
381  reduction_code.ir_reduce_one_entry_idx = setup_reduce_one_entry_idx(&reduction_code);
382  reduction_code.ir_reduce_loop = setup_reduce_loop(&reduction_code);
383  return reduction_code;
384 }
std::unique_ptr< Function > setup_reduce_one_entry_idx(ReductionCode *reduction_code)
std::unique_ptr< Function > ir_is_empty
std::unique_ptr< Function > setup_is_empty_entry(ReductionCode *reduction_code)
std::unique_ptr< Function > setup_reduce_one_entry(ReductionCode *reduction_code, const QueryDescriptionType hash_type)
std::unique_ptr< Function > setup_reduce_loop(ReductionCode *reduction_code)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<Function> anonymous_namespace{ResultSetReductionJIT.cpp}::setup_is_empty_entry ( ReductionCode reduction_code)

Definition at line 283 of file ResultSetReductionJIT.cpp.

References create_function(), Int1, and Int8Ptr.

Referenced by setup_functions_ir().

283  {
284  return create_function(
285  "is_empty_entry", {{"row_ptr", Type::Int8Ptr}}, Type::Int1, /*always_inline=*/true);
286 }
std::unique_ptr< Function > create_function(const std::string name, const std::vector< Function::NamedArg > &arg_types, const Type ret_type, const bool always_inline)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<Function> anonymous_namespace{ResultSetReductionJIT.cpp}::setup_reduce_loop ( ReductionCode reduction_code)

Definition at line 335 of file ResultSetReductionJIT.cpp.

References create_function(), Int32, Int8Ptr, and VoidPtr.

Referenced by setup_functions_ir().

335  {
336  return create_function("reduce_loop",
337  {{"this_buff", Type::Int8Ptr},
338  {"that_buff", Type::Int8Ptr},
339  {"start_index", Type::Int32},
340  {"end_index", Type::Int32},
341  {"that_entry_count", Type::Int32},
342  {"this_qmd_handle", Type::VoidPtr},
343  {"that_qmd_handle", Type::VoidPtr},
344  {"serialized_varlen_buffer", Type::VoidPtr}},
345  Type::Int32,
346  /*always_inline=*/false);
347 }
std::unique_ptr< Function > create_function(const std::string name, const std::vector< Function::NamedArg > &arg_types, const Type ret_type, const bool always_inline)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<Function> anonymous_namespace{ResultSetReductionJIT.cpp}::setup_reduce_one_entry ( ReductionCode reduction_code,
const QueryDescriptionType  hash_type 
)

Definition at line 289 of file ResultSetReductionJIT.cpp.

References create_function(), logger::FATAL, GroupByBaselineHash, GroupByPerfectHash, Int32, Int8Ptr, LOG, NonGroupedAggregate, and VoidPtr.

Referenced by setup_functions_ir().

290  {
291  std::string this_ptr_name;
292  std::string that_ptr_name;
293  switch (hash_type) {
295  this_ptr_name = "this_targets_ptr";
296  that_ptr_name = "that_targets_ptr";
297  break;
298  }
301  this_ptr_name = "this_row_ptr";
302  that_ptr_name = "that_row_ptr";
303  break;
304  }
305  default: {
306  LOG(FATAL) << "Unexpected query description type";
307  }
308  }
309  return create_function("reduce_one_entry",
310  {{this_ptr_name, Type::Int8Ptr},
311  {that_ptr_name, Type::Int8Ptr},
312  {"this_qmd", Type::VoidPtr},
313  {"that_qmd", Type::VoidPtr},
314  {"serialized_varlen_buffer_arg", Type::VoidPtr}},
315  Type::Int32,
316  /*always_inline=*/true);
317 }
#define LOG(tag)
Definition: Logger.h:217
std::unique_ptr< Function > create_function(const std::string name, const std::vector< Function::NamedArg > &arg_types, const Type ret_type, const bool always_inline)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::unique_ptr<Function> anonymous_namespace{ResultSetReductionJIT.cpp}::setup_reduce_one_entry_idx ( ReductionCode reduction_code)

Definition at line 320 of file ResultSetReductionJIT.cpp.

References create_function(), Int32, Int8Ptr, and VoidPtr.

Referenced by setup_functions_ir().

320  {
321  return create_function("reduce_one_entry_idx",
322  {{"this_buff", Type::Int8Ptr},
323  {"that_buff", Type::Int8Ptr},
324  {"that_entry_idx", Type::Int32},
325  {"that_entry_count", Type::Int32},
326  {"this_qmd_handle", Type::VoidPtr},
327  {"that_qmd_handle", Type::VoidPtr},
328  {"serialized_varlen_buffer", Type::VoidPtr}},
329  Type::Int32,
330  /*always_inline=*/true);
331 }
std::unique_ptr< Function > create_function(const std::string name, const std::vector< Function::NamedArg > &arg_types, const Type ret_type, const bool always_inline)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string anonymous_namespace{ResultSetReductionJIT.cpp}::target_info_key ( const TargetInfo target_info)

Definition at line 1263 of file ResultSetReductionJIT.cpp.

References TargetInfo::agg_arg_type, TargetInfo::agg_kind, SQLTypeInfo::get_notnull(), SQLTypeInfo::get_type_name(), TargetInfo::is_agg, TargetInfo::is_distinct, TargetInfo::skip_null_val, TargetInfo::sql_type, and to_string().

Referenced by ResultSetReductionJIT::cacheKey().

1263  {
1264  return std::to_string(target_info.is_agg) + "\n" +
1265  std::to_string(target_info.agg_kind) + "\n" +
1266  target_info.sql_type.get_type_name() + "\n" +
1267  std::to_string(target_info.sql_type.get_notnull()) + "\n" +
1268  target_info.agg_arg_type.get_type_name() + "\n" +
1269  std::to_string(target_info.agg_arg_type.get_notnull()) + "\n" +
1270  std::to_string(target_info.skip_null_val) + "\n" +
1271  std::to_string(target_info.is_distinct);
1272 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:51
bool skip_null_val
Definition: TargetInfo.h:53
std::string to_string(char const *&&v)
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:52
bool is_agg
Definition: TargetInfo.h:49
SQLAgg agg_kind
Definition: TargetInfo.h:50
std::string get_type_name() const
Definition: sqltypes.h:443
bool is_distinct
Definition: TargetInfo.h:54
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:336

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 393 of file ResultSetReductionJIT.cpp.

References CHECK.

Referenced by serialized_varlen_buffer_sample().

397  {
398  const auto rhs_proj_col = *reinterpret_cast<const int64_t*>(that_ptr1);
399  if (rhs_proj_col != init_val) {
400  *reinterpret_cast<int64_t*>(this_ptr1) = rhs_proj_col;
401  }
402  CHECK(this_ptr2 && that_ptr2);
403  *reinterpret_cast<int64_t*>(this_ptr2) = *reinterpret_cast<const int64_t*>(that_ptr2);
404 }
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the caller graph for this function:

Variable Documentation

const size_t anonymous_namespace{ResultSetReductionJIT.cpp}::INTERP_THRESHOLD {25}

Definition at line 43 of file ResultSetReductionJIT.cpp.

Referenced by ResultSetReductionJIT::codegen().

const int32_t anonymous_namespace{ResultSetReductionJIT.cpp}::INTERRUPT_ERROR {10}

Definition at line 41 of file ResultSetReductionJIT.cpp.

Referenced by generate_loop_body().

const int32_t anonymous_namespace{ResultSetReductionJIT.cpp}::WATCHDOG_ERROR

Definition at line 39 of file ResultSetReductionJIT.cpp.

Referenced by generate_loop_body().