OmniSciDB  343343d194
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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)
 
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, const CgenState *cgen_state)
 
ReductionCode setup_functions_ir (const QueryDescriptionType hash_type)
 
bool is_group_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 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 240 of file ResultSetReductionJIT.cpp.

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

244  {
245  return std::make_unique<Function>(name, arg_types, ret_type, always_inline);
246 }

+ Here is the caller graph for this function:

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

Definition at line 315 of file ResultSetReductionJIT.cpp.

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

Referenced by ResultSetReductionJIT::codegen().

316  {
317  auto& ctx = cgen_state->context_;
318  std::vector<llvm::Type*> parameter_types;
319  const auto& arg_types = function->arg_types();
320  for (const auto& named_arg : arg_types) {
321  CHECK(named_arg.type != Type::Void);
322  parameter_types.push_back(llvm_type(named_arg.type, ctx));
323  }
324  const auto func_type = llvm::FunctionType::get(
325  llvm_type(function->ret_type(), ctx), parameter_types, false);
326  const auto linkage = function->always_inline() ? llvm::Function::PrivateLinkage
327  : llvm::Function::ExternalLinkage;
328  auto func =
329  llvm::Function::Create(func_type, linkage, function->name(), cgen_state->module_);
330  const auto arg_it = func->arg_begin();
331  for (size_t i = 0; i < arg_types.size(); ++i) {
332  const auto arg = &*(arg_it + i);
333  arg->setName(arg_types[i].name);
334  }
335  if (function->always_inline()) {
337  }
338  return func;
339 }
void mark_function_always_inline(llvm::Function *func)
llvm::Module * module_
Definition: CgenState.h:261
llvm::LLVMContext & context_
Definition: CgenState.h:264
llvm::Type * llvm_type(const Type type, llvm::LLVMContext &ctx)
#define CHECK(condition)
Definition: Logger.h:187

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

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

Referenced by ResultSetReductionJIT::reduceOneAggregateSlot().

192  {
193  const auto dest_name = "count_dest";
194  if (chosen_bytes == sizeof(int32_t)) {
195  const auto agg = ir_reduce_one_entry->add<Cast>(
196  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
197  const auto val = emit_load(other_ptr, Type::Int32Ptr, ir_reduce_one_entry);
198  ir_reduce_one_entry->add<Call>(
199  "agg_sum_int32", std::vector<const Value*>{agg, val}, "");
200  } else {
201  CHECK_EQ(chosen_bytes, sizeof(int64_t));
202  const auto agg = ir_reduce_one_entry->add<Cast>(
203  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
204  const auto val = emit_load(other_ptr, Type::Int64Ptr, ir_reduce_one_entry);
205  ir_reduce_one_entry->add<Call>("agg_sum", std::vector<const Value*>{agg, val}, "");
206  }
207 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
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 129 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().

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

92  {
93  const auto sql_type = get_compact_type(agg_info);
94  const auto dest_name = agg_kind + "_dest";
95  if (sql_type.is_fp()) {
96  if (chosen_bytes == sizeof(float)) {
97  const auto agg = ir_reduce_one_entry->add<Cast>(
98  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
99  const auto val = emit_load(other_ptr, Type::FloatPtr, ir_reduce_one_entry);
100  ir_reduce_one_entry->add<Call>(
101  "agg_" + agg_kind + "_float", std::vector<const Value*>{agg, val}, "");
102  } else {
103  CHECK_EQ(chosen_bytes, sizeof(double));
104  const auto agg = ir_reduce_one_entry->add<Cast>(
105  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
106  const auto val = emit_load(other_ptr, Type::DoublePtr, ir_reduce_one_entry);
107  ir_reduce_one_entry->add<Call>(
108  "agg_" + agg_kind + "_double", std::vector<const Value*>{agg, val}, "");
109  }
110  } else {
111  if (chosen_bytes == sizeof(int32_t)) {
112  const auto agg = ir_reduce_one_entry->add<Cast>(
113  Cast::CastOp::BitCast, val_ptr, Type::Int32Ptr, dest_name);
114  const auto val = emit_load(other_ptr, Type::Int32Ptr, ir_reduce_one_entry);
115  ir_reduce_one_entry->add<Call>(
116  "agg_" + agg_kind + "_int32", std::vector<const Value*>{agg, val}, "");
117  } else {
118  CHECK_EQ(chosen_bytes, sizeof(int64_t));
119  const auto agg = ir_reduce_one_entry->add<Cast>(
120  Cast::CastOp::BitCast, val_ptr, Type::Int64Ptr, dest_name);
121  const auto val = emit_load(other_ptr, Type::Int64Ptr, ir_reduce_one_entry);
122  ir_reduce_one_entry->add<Call>(
123  "agg_" + agg_kind, std::vector<const Value*>{agg, val}, "");
124  }
125  }
126 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
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:

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

Definition at line 52 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().

52  {
53  return function->add<Load>(
54  function->add<Cast>(Cast::CastOp::BitCast, ptr, ptr_type, ""),
55  ptr->label() + "_loaded");
56 }
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 59 of file ResultSetReductionJIT.cpp.

References emit_load(), and Int32Ptr.

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

59  {
60  return emit_load(ptr, Type::Int32Ptr, function);
61 }
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 64 of file ResultSetReductionJIT.cpp.

References emit_load(), and Int64Ptr.

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

64  {
65  return emit_load(ptr, Type::Int64Ptr, function);
66 }
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 69 of file ResultSetReductionJIT.cpp.

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

Referenced by ResultSetReductionJIT::isEmpty().

69  {
70  switch (compact_sz) {
71  case 8: {
72  return emit_load_i64(ptr, function);
73  }
74  case 4: {
75  const auto loaded_val = emit_load_i32(ptr, function);
76  return function->add<Cast>(Cast::CastOp::SExt, loaded_val, Type::Int64, "");
77  }
78  default: {
79  LOG(FATAL) << "Invalid byte width: " << compact_sz;
80  return nullptr;
81  }
82  }
83 }
#define LOG(tag)
Definition: Logger.h:182
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 212 of file ResultSetReductionJIT.cpp.

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

Referenced by ResultSetReductionJIT::reduceOneSlot().

216  {
217  const auto func_name = "write_projection_int" + std::to_string(chosen_bytes * 8);
218  if (chosen_bytes == sizeof(int32_t)) {
219  const auto proj_val = emit_load_i32(other_pi8, ir_reduce_one_entry);
220  ir_reduce_one_entry->add<Call>(
221  func_name,
222  std::vector<const Value*>{
223  slot_pi8,
224  proj_val,
225  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64)},
226  "");
227  } else {
228  CHECK_EQ(chosen_bytes, sizeof(int64_t));
229  const auto proj_val = emit_load_i64(other_pi8, ir_reduce_one_entry);
230  ir_reduce_one_entry->add<Call>(
231  func_name,
232  std::vector<const Value*>{
233  slot_pi8,
234  proj_val,
235  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64)},
236  "");
237  }
238 }
#define CHECK_EQ(x, y)
Definition: Logger.h:195
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 897 of file ResultSetReductionJIT.cpp.

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

Referenced by ResultSetReductionJIT::reduceLoop().

906  {
907  const auto that_entry_idx = for_loop->add<BinaryOperator>(
908  BinaryOperator::BinaryOp::Add, for_loop->iter(), start_index, "that_entry_idx");
909  const auto watchdog_sample_seed =
910  for_loop->add<Cast>(Cast::CastOp::SExt, that_entry_idx, Type::Int64, "");
911  const auto watchdog_triggered =
912  for_loop->add<ExternalCall>("check_watchdog_rt",
913  Type::Int8,
914  std::vector<const Value*>{watchdog_sample_seed},
915  "");
916  const auto watchdog_triggered_bool =
917  for_loop->add<ICmp>(ICmp::Predicate::NE,
918  watchdog_triggered,
919  ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int8),
920  "");
921  for_loop->add<ReturnEarly>(watchdog_triggered_bool, WATCHDOG_ERROR, "");
922  for_loop->add<Call>(ir_reduce_one_entry_idx,
923  std::vector<const Value*>{this_buff,
924  that_buff,
925  that_entry_idx,
926  that_entry_count,
927  this_qmd_handle,
928  that_qmd_handle,
929  serialized_varlen_buffer},
930  "");
931 }
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_group_query ( const QueryDescriptionType  hash_type)

Definition at line 352 of file ResultSetReductionJIT.cpp.

References GroupByBaselineHash, and GroupByPerfectHash.

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 343 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().

343  {
344  ReductionCode reduction_code{};
345  reduction_code.ir_is_empty = setup_is_empty_entry(&reduction_code);
346  reduction_code.ir_reduce_one_entry = setup_reduce_one_entry(&reduction_code, hash_type);
347  reduction_code.ir_reduce_one_entry_idx = setup_reduce_one_entry_idx(&reduction_code);
348  reduction_code.ir_reduce_loop = setup_reduce_loop(&reduction_code);
349  return reduction_code;
350 }
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 250 of file ResultSetReductionJIT.cpp.

References create_function(), Int1, and Int8Ptr.

Referenced by setup_functions_ir().

250  {
251  return create_function(
252  "is_empty_entry", {{"row_ptr", Type::Int8Ptr}}, Type::Int1, /*always_inline=*/true);
253 }
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 301 of file ResultSetReductionJIT.cpp.

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

Referenced by setup_functions_ir().

301  {
302  return create_function("reduce_loop",
303  {{"this_buff", Type::Int8Ptr},
304  {"that_buff", Type::Int8Ptr},
305  {"start_index", Type::Int32},
306  {"end_index", Type::Int32},
307  {"that_entry_count", Type::Int32},
308  {"this_qmd_handle", Type::VoidPtr},
309  {"that_qmd_handle", Type::VoidPtr},
310  {"serialized_varlen_buffer", Type::VoidPtr}},
311  Type::Int32,
312  /*always_inline=*/false);
313 }
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 256 of file ResultSetReductionJIT.cpp.

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

Referenced by setup_functions_ir().

257  {
258  std::string this_ptr_name;
259  std::string that_ptr_name;
260  switch (hash_type) {
262  this_ptr_name = "this_targets_ptr";
263  that_ptr_name = "that_targets_ptr";
264  break;
265  }
267  this_ptr_name = "this_row_ptr";
268  that_ptr_name = "that_row_ptr";
269  break;
270  }
271  default: {
272  LOG(FATAL) << "Unexpected query description type";
273  }
274  }
275  return create_function("reduce_one_entry",
276  {{this_ptr_name, Type::Int8Ptr},
277  {that_ptr_name, Type::Int8Ptr},
278  {"this_qmd", Type::VoidPtr},
279  {"that_qmd", Type::VoidPtr},
280  {"serialized_varlen_buffer_arg", Type::VoidPtr}},
281  Type::Void,
282  /*always_inline=*/true);
283 }
#define LOG(tag)
Definition: Logger.h:182
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 286 of file ResultSetReductionJIT.cpp.

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

Referenced by setup_functions_ir().

286  {
287  return create_function("reduce_one_entry_idx",
288  {{"this_buff", Type::Int8Ptr},
289  {"that_buff", Type::Int8Ptr},
290  {"that_entry_idx", Type::Int32},
291  {"that_entry_count", Type::Int32},
292  {"this_qmd_handle", Type::VoidPtr},
293  {"that_qmd_handle", Type::VoidPtr},
294  {"serialized_varlen_buffer", Type::VoidPtr}},
295  Type::Void,
296  /*always_inline=*/true);
297 }
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 1136 of file ResultSetReductionJIT.cpp.

References TargetInfo::agg_arg_type, TargetInfo::agg_kind, SQLTypeInfoCore< TYPE_FACET_PACK >::get_notnull(), SQLTypeInfoCore< TYPE_FACET_PACK >::get_type_name(), TargetInfo::is_agg, TargetInfo::is_distinct, TargetInfo::skip_null_val, TargetInfo::sql_type, and to_string().

Referenced by ResultSetReductionJIT::cacheKey().

1136  {
1137  return std::to_string(target_info.is_agg) + "\n" +
1138  std::to_string(target_info.agg_kind) + "\n" +
1139  target_info.sql_type.get_type_name() + "\n" +
1140  std::to_string(target_info.sql_type.get_notnull()) + "\n" +
1141  target_info.agg_arg_type.get_type_name() + "\n" +
1142  std::to_string(target_info.agg_arg_type.get_notnull()) + "\n" +
1143  std::to_string(target_info.skip_null_val) + "\n" +
1144  std::to_string(target_info.is_distinct);
1145 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:42
bool skip_null_val
Definition: TargetInfo.h:44
std::string to_string(char const *&&v)
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:43
std::string get_type_name() const
Definition: sqltypes.h:427
bool is_agg
Definition: TargetInfo.h:40
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:331
SQLAgg agg_kind
Definition: TargetInfo.h:41
bool is_distinct
Definition: TargetInfo.h:45

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

References CHECK.

Referenced by serialized_varlen_buffer_sample().

362  {
363  const auto rhs_proj_col = *reinterpret_cast<const int64_t*>(that_ptr1);
364  if (rhs_proj_col != init_val) {
365  *reinterpret_cast<int64_t*>(this_ptr1) = rhs_proj_col;
366  }
367  CHECK(this_ptr2 && that_ptr2);
368  *reinterpret_cast<int64_t*>(this_ptr2) = *reinterpret_cast<const int64_t*>(that_ptr2);
369 }
#define CHECK(condition)
Definition: Logger.h:187

+ Here is the caller graph for this function:

Variable Documentation

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

Definition at line 49 of file ResultSetReductionJIT.cpp.

Referenced by ResultSetReductionJIT::codegen().

const int32_t anonymous_namespace{ResultSetReductionJIT.cpp}::WATCHDOG_ERROR

Definition at line 47 of file ResultSetReductionJIT.cpp.

Referenced by generate_loop_body().