OmniSciDB  1dac507f6e
 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_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 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 239 of file ResultSetReductionJIT.cpp.

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

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

+ 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:264
llvm::LLVMContext & context_
Definition: CgenState.h:267
CHECK(cgen_state)
llvm::Type * llvm_type(const Type type, llvm::LLVMContext &ctx)

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

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

Referenced by ResultSetReductionJIT::reduceOneAggregateSlot().

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

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

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

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

References emit_load(), and Int32Ptr.

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

58  {
59  return emit_load(ptr, Type::Int32Ptr, 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_load_i64 ( Value ptr,
Function function 
)

Definition at line 63 of file ResultSetReductionJIT.cpp.

References emit_load(), and Int64Ptr.

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

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

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

Referenced by ResultSetReductionJIT::isEmpty().

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

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

Referenced by ResultSetReductionJIT::reduceOneSlot().

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

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

Referenced by ResultSetReductionJIT::reduceLoop().

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

References create_function(), Int1, and Int8Ptr.

Referenced by setup_functions_ir().

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

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

Referenced by setup_functions_ir().

256  {
257  std::string this_ptr_name;
258  std::string that_ptr_name;
259  switch (hash_type) {
261  this_ptr_name = "this_targets_ptr";
262  that_ptr_name = "that_targets_ptr";
263  break;
264  }
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:185
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 1140 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().

1140  {
1141  return std::to_string(target_info.is_agg) + "\n" +
1142  std::to_string(target_info.agg_kind) + "\n" +
1143  target_info.sql_type.get_type_name() + "\n" +
1144  std::to_string(target_info.sql_type.get_notnull()) + "\n" +
1145  target_info.agg_arg_type.get_type_name() + "\n" +
1146  std::to_string(target_info.agg_arg_type.get_notnull()) + "\n" +
1147  std::to_string(target_info.skip_null_val) + "\n" +
1148  std::to_string(target_info.is_distinct);
1149 }
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:429
bool is_agg
Definition: TargetInfo.h:40
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:333
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 359 of file ResultSetReductionJIT.cpp.

References CHECK().

Referenced by serialized_varlen_buffer_sample().

363  {
364  const auto rhs_proj_col = *reinterpret_cast<const int64_t*>(that_ptr1);
365  if (rhs_proj_col != init_val) {
366  *reinterpret_cast<int64_t*>(this_ptr1) = rhs_proj_col;
367  }
368  CHECK(this_ptr2 && that_ptr2);
369  *reinterpret_cast<int64_t*>(this_ptr2) = *reinterpret_cast<const int64_t*>(that_ptr2);
370 }
CHECK(cgen_state)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

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

Definition at line 48 of file ResultSetReductionJIT.cpp.

Referenced by ResultSetReductionJIT::codegen().

const int32_t anonymous_namespace{ResultSetReductionJIT.cpp}::WATCHDOG_ERROR

Definition at line 46 of file ResultSetReductionJIT.cpp.

Referenced by generate_loop_body().