OmniSciDB  addbbd5075
 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)
 
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, 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 278 of file ResultSetReductionJIT.cpp.

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

282  {
283  return std::make_unique<Function>(name, arg_types, ret_type, always_inline);
284 }

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

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

Referenced by ResultSetReductionJIT::codegen().

355  {
356  auto& ctx = cgen_state->context_;
357  std::vector<llvm::Type*> parameter_types;
358  const auto& arg_types = function->arg_types();
359  for (const auto& named_arg : arg_types) {
360  CHECK(named_arg.type != Type::Void);
361  parameter_types.push_back(llvm_type(named_arg.type, ctx));
362  }
363  const auto func_type = llvm::FunctionType::get(
364  llvm_type(function->ret_type(), ctx), parameter_types, false);
365  const auto linkage = function->always_inline() ? llvm::Function::PrivateLinkage
366  : llvm::Function::ExternalLinkage;
367  auto func =
368  llvm::Function::Create(func_type, linkage, function->name(), cgen_state->module_);
369  const auto arg_it = func->arg_begin();
370  for (size_t i = 0; i < arg_types.size(); ++i) {
371  const auto arg = &*(arg_it + i);
372  arg->setName(arg_types[i].name);
373  }
374  if (function->always_inline()) {
376  }
377  return func;
378 }
void mark_function_always_inline(llvm::Function *func)
llvm::Module * module_
Definition: CgenState.h:266
llvm::LLVMContext & context_
Definition: CgenState.h:269
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:201
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:201
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:201
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 242 of file ResultSetReductionJIT.cpp.

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

Referenced by ResultSetReductionJIT::reduceOneSlot().

246  {
247  if (chosen_bytes == sizeof(int32_t)) {
248  const auto func_name = "checked_single_agg_id_int32";
249  const auto proj_val = emit_load_i32(other_pi8, ir_reduce_one_entry);
250  const auto slot_pi32 = ir_reduce_one_entry->add<Cast>(
251  Cast::CastOp::BitCast, slot_pi8, Type::Int32Ptr, "");
252  return ir_reduce_one_entry->add<Call>(
253  func_name,
254  Type::Int32,
255  std::vector<const Value*>{
256  slot_pi32,
257  proj_val,
258  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int32)},
259  "");
260  } else {
261  const auto func_name = "checked_single_agg_id";
262  CHECK_EQ(chosen_bytes, sizeof(int64_t));
263  const auto proj_val = emit_load_i64(other_pi8, ir_reduce_one_entry);
264  const auto slot_pi64 = ir_reduce_one_entry->add<Cast>(
265  Cast::CastOp::BitCast, slot_pi8, Type::Int64Ptr, "");
266 
267  return ir_reduce_one_entry->add<Call>(
268  func_name,
269  Type::Int32,
270  std::vector<const Value*>{
271  slot_pi64,
272  proj_val,
273  ir_reduce_one_entry->addConstant<ConstantInt>(init_val, Type::Int64)},
274  "");
275  }
276 }
#define CHECK_EQ(x, y)
Definition: Logger.h:201
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 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_checked_write_projection(), 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_checked_write_projection(), 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:188
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:201
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 949 of file ResultSetReductionJIT.cpp.

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

Referenced by ResultSetReductionJIT::reduceLoop().

958  {
959  const auto that_entry_idx = for_loop->add<BinaryOperator>(
960  BinaryOperator::BinaryOp::Add, for_loop->iter(), start_index, "that_entry_idx");
961  const auto watchdog_sample_seed =
962  for_loop->add<Cast>(Cast::CastOp::SExt, that_entry_idx, Type::Int64, "");
963  const auto watchdog_triggered =
964  for_loop->add<ExternalCall>("check_watchdog_rt",
965  Type::Int8,
966  std::vector<const Value*>{watchdog_sample_seed},
967  "");
968  const auto watchdog_triggered_bool =
969  for_loop->add<ICmp>(ICmp::Predicate::NE,
970  watchdog_triggered,
971  ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int8),
972  "");
973  for_loop->add<ReturnEarly>(
974  watchdog_triggered_bool,
975  ir_reduce_loop->addConstant<ConstantInt>(WATCHDOG_ERROR, Type::Int32),
976  "");
977  const auto reduce_rc =
978  for_loop->add<Call>(ir_reduce_one_entry_idx,
979  std::vector<const Value*>{this_buff,
980  that_buff,
981  that_entry_idx,
982  that_entry_count,
983  this_qmd_handle,
984  that_qmd_handle,
985  serialized_varlen_buffer},
986  "");
987 
988  auto reduce_rc_bool =
989  for_loop->add<ICmp>(ICmp::Predicate::NE,
990  reduce_rc,
991  ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int32),
992  "");
993  for_loop->add<ReturnEarly>(reduce_rc_bool, reduce_rc, "");
994 }
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 391 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 382 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().

382  {
383  ReductionCode reduction_code{};
384  reduction_code.ir_is_empty = setup_is_empty_entry(&reduction_code);
385  reduction_code.ir_reduce_one_entry = setup_reduce_one_entry(&reduction_code, hash_type);
386  reduction_code.ir_reduce_one_entry_idx = setup_reduce_one_entry_idx(&reduction_code);
387  reduction_code.ir_reduce_loop = setup_reduce_loop(&reduction_code);
388  return reduction_code;
389 }
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 288 of file ResultSetReductionJIT.cpp.

References create_function(), Int1, and Int8Ptr.

Referenced by setup_functions_ir().

288  {
289  return create_function(
290  "is_empty_entry", {{"row_ptr", Type::Int8Ptr}}, Type::Int1, /*always_inline=*/true);
291 }
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 340 of file ResultSetReductionJIT.cpp.

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

Referenced by setup_functions_ir().

340  {
341  return create_function("reduce_loop",
342  {{"this_buff", Type::Int8Ptr},
343  {"that_buff", Type::Int8Ptr},
344  {"start_index", Type::Int32},
345  {"end_index", Type::Int32},
346  {"that_entry_count", Type::Int32},
347  {"this_qmd_handle", Type::VoidPtr},
348  {"that_qmd_handle", Type::VoidPtr},
349  {"serialized_varlen_buffer", Type::VoidPtr}},
350  Type::Int32,
351  /*always_inline=*/false);
352 }
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 294 of file ResultSetReductionJIT.cpp.

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

Referenced by setup_functions_ir().

295  {
296  std::string this_ptr_name;
297  std::string that_ptr_name;
298  switch (hash_type) {
300  this_ptr_name = "this_targets_ptr";
301  that_ptr_name = "that_targets_ptr";
302  break;
303  }
306  this_ptr_name = "this_row_ptr";
307  that_ptr_name = "that_row_ptr";
308  break;
309  }
310  default: {
311  LOG(FATAL) << "Unexpected query description type";
312  }
313  }
314  return create_function("reduce_one_entry",
315  {{this_ptr_name, Type::Int8Ptr},
316  {that_ptr_name, Type::Int8Ptr},
317  {"this_qmd", Type::VoidPtr},
318  {"that_qmd", Type::VoidPtr},
319  {"serialized_varlen_buffer_arg", Type::VoidPtr}},
320  Type::Int32,
321  /*always_inline=*/true);
322 }
#define LOG(tag)
Definition: Logger.h:188
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 325 of file ResultSetReductionJIT.cpp.

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

Referenced by setup_functions_ir().

325  {
326  return create_function("reduce_one_entry_idx",
327  {{"this_buff", Type::Int8Ptr},
328  {"that_buff", Type::Int8Ptr},
329  {"that_entry_idx", Type::Int32},
330  {"that_entry_count", Type::Int32},
331  {"this_qmd_handle", Type::VoidPtr},
332  {"that_qmd_handle", Type::VoidPtr},
333  {"serialized_varlen_buffer", Type::VoidPtr}},
334  Type::Int32,
335  /*always_inline=*/true);
336 }
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 1212 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().

1212  {
1213  return std::to_string(target_info.is_agg) + "\n" +
1214  std::to_string(target_info.agg_kind) + "\n" +
1215  target_info.sql_type.get_type_name() + "\n" +
1216  std::to_string(target_info.sql_type.get_notnull()) + "\n" +
1217  target_info.agg_arg_type.get_type_name() + "\n" +
1218  std::to_string(target_info.agg_arg_type.get_notnull()) + "\n" +
1219  std::to_string(target_info.skip_null_val) + "\n" +
1220  std::to_string(target_info.is_distinct);
1221 }
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 398 of file ResultSetReductionJIT.cpp.

References CHECK().

Referenced by serialized_varlen_buffer_sample().

402  {
403  const auto rhs_proj_col = *reinterpret_cast<const int64_t*>(that_ptr1);
404  if (rhs_proj_col != init_val) {
405  *reinterpret_cast<int64_t*>(this_ptr1) = rhs_proj_col;
406  }
407  CHECK(this_ptr2 && that_ptr2);
408  *reinterpret_cast<int64_t*>(this_ptr2) = *reinterpret_cast<const int64_t*>(that_ptr2);
409 }
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().