OmniSciDB  72c90bc290
 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 (SQLAgg const sql_agg, 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 275 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().

279  {
280  return std::make_unique<Function>(name, arg_types, ret_type, always_inline);
281 }
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 351 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().

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

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

Referenced by ResultSetReductionJIT::reduceOneAggregateSlot().

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

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

Referenced by ResultSetReductionJIT::reduceOneAggregateSlot().

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

+ 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 83 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().

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

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

Referenced by ResultSetReductionJIT::reduceOneSlot().

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

48  {
49  return function->add<Load>(
50  function->add<Cast>(Cast::CastOp::BitCast, ptr, ptr_type, ""),
51  ptr->label() + "_loaded");
52 }
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 55 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().

55  {
56  return emit_load(ptr, Type::Int32Ptr, function);
57 }
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 60 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(), ResultSetReductionJIT::reduceOneCountDistinctSlot(), and ResultSetReductionJIT::reduceOneModeSlot().

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

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

Referenced by ResultSetReductionJIT::isEmpty().

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

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

Referenced by ResultSetReductionJIT::reduceOneSlot().

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

References BinaryOperator::Add, For::add(), report::error_code(), 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().

988  {
989  const auto that_entry_idx = for_loop->add<BinaryOperator>(
990  BinaryOperator::BinaryOp::Add, for_loop->iter(), start_index, "that_entry_idx");
991  const auto sample_seed =
992  for_loop->add<Cast>(Cast::CastOp::SExt, that_entry_idx, Type::Int64, "");
994  const auto checker_rt_name =
995  g_enable_dynamic_watchdog ? "check_watchdog_rt" : "check_interrupt_rt";
997  const auto checker_triggered = for_loop->add<ExternalCall>(
998  checker_rt_name, Type::Int8, std::vector<const Value*>{sample_seed}, "");
999  const auto interrupt_triggered_bool =
1000  for_loop->add<ICmp>(ICmp::Predicate::NE,
1001  checker_triggered,
1002  ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int8),
1003  "");
1004  for_loop->add<ReturnEarly>(
1005  interrupt_triggered_bool,
1006  ir_reduce_loop->addConstant<ConstantInt>(error_code, Type::Int32),
1007  "");
1008  }
1009  const auto reduce_rc =
1010  for_loop->add<Call>(ir_reduce_one_entry_idx,
1011  std::vector<const Value*>{this_buff,
1012  that_buff,
1013  that_entry_idx,
1014  that_entry_count,
1015  this_qmd_handle,
1016  that_qmd_handle,
1017  serialized_varlen_buffer},
1018  "");
1019 
1020  auto reduce_rc_bool =
1021  for_loop->add<ICmp>(ICmp::Predicate::NE,
1022  reduce_rc,
1023  ir_reduce_loop->addConstant<ConstantInt>(0, Type::Int32),
1024  "");
1025  for_loop->add<ReturnEarly>(reduce_rc_bool, reduce_rc, "");
1026 }
bool g_enable_dynamic_watchdog
Definition: Execute.cpp:81
bool g_enable_non_kernel_time_query_interrupt
Definition: Execute.cpp:134
Value * add(Args &&...args)
const Value * iter() const
def error_code
Definition: report.py:244

+ 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 388 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 379 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().

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

References create_function(), Int1, and Int8Ptr.

Referenced by setup_functions_ir().

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

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

Referenced by setup_functions_ir().

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

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

Referenced by setup_functions_ir().

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

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

Referenced by setup_functions_ir().

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

1292  {
1293  return std::to_string(target_info.is_agg) + "\n" +
1294  std::to_string(target_info.agg_kind) + "\n" +
1295  target_info.sql_type.get_type_name() + "\n" +
1296  std::to_string(target_info.sql_type.get_notnull()) + "\n" +
1297  target_info.agg_arg_type.get_type_name() + "\n" +
1298  std::to_string(target_info.agg_arg_type.get_notnull()) + "\n" +
1299  std::to_string(target_info.skip_null_val) + "\n" +
1300  std::to_string(target_info.is_distinct);
1301 }
SQLTypeInfo sql_type
Definition: TargetInfo.h:52
bool skip_null_val
Definition: TargetInfo.h:54
std::string to_string(char const *&&v)
SQLTypeInfo agg_arg_type
Definition: TargetInfo.h:53
bool is_agg
Definition: TargetInfo.h:50
SQLAgg agg_kind
Definition: TargetInfo.h:51
std::string get_type_name() const
Definition: sqltypes.h:482
bool is_distinct
Definition: TargetInfo.h:55
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:398

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

References CHECK.

Referenced by serialized_varlen_buffer_sample().

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

+ Here is the caller graph for this function:

Variable Documentation

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

Definition at line 45 of file ResultSetReductionJIT.cpp.

Referenced by ResultSetReductionJIT::codegen().

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

Definition at line 43 of file ResultSetReductionJIT.cpp.

Referenced by generate_loop_body().

const int32_t anonymous_namespace{ResultSetReductionJIT.cpp}::WATCHDOG_ERROR

Definition at line 41 of file ResultSetReductionJIT.cpp.

Referenced by generate_loop_body().