OmniSciDB  4201147b46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GpuReductionHelperJIT Class Reference

#include <ResultSetReductionJIT.h>

+ Inheritance diagram for GpuReductionHelperJIT:
+ Collaboration diagram for GpuReductionHelperJIT:

Public Member Functions

 GpuReductionHelperJIT (const QueryMemoryDescriptor &query_mem_desc, const std::vector< TargetInfo > &targets, const std::vector< int64_t > &target_init_vals, const size_t executor_id)
 
ReductionCode codegen () const override
 
- Public Member Functions inherited from ResultSetReductionJIT
 ResultSetReductionJIT (const QueryMemoryDescriptor &query_mem_desc, const std::vector< TargetInfo > &targets, const std::vector< int64_t > &target_init_vals, const size_t executor_id)
 
virtual ~ResultSetReductionJIT ()=default
 

Private Attributes

const QueryMemoryDescriptorquery_mem_desc_
 

Additional Inherited Members

- Protected Member Functions inherited from ResultSetReductionJIT
void isEmpty (const ReductionCode &reduction_code) const
 
void reduceOneEntryNoCollisions (const ReductionCode &reduction_code) const
 
void reduceOneEntryNoCollisionsIdx (const ReductionCode &reduction_code) const
 
void reduceLoop (const ReductionCode &reduction_code) const
 
- Protected Attributes inherited from ResultSetReductionJIT
size_t executor_id_
 

Detailed Description

This is a helper class for performing GPU reduction code. It uses the same functions that ResultSetReductionJIT generates so that it can be reused and help the reduction procedure within GPU.

Definition at line 145 of file ResultSetReductionJIT.h.

Constructor & Destructor Documentation

GpuReductionHelperJIT::GpuReductionHelperJIT ( const QueryMemoryDescriptor query_mem_desc,
const std::vector< TargetInfo > &  targets,
const std::vector< int64_t > &  target_init_vals,
const size_t  executor_id 
)
inline

Definition at line 147 of file ResultSetReductionJIT.h.

References CHECK, QueryMemoryDescriptor::didOutputColumnar(), QueryMemoryDescriptor::getQueryDescriptionType(), GroupByPerfectHash, QueryMemoryDescriptor::hasKeylessHash(), and query_mem_desc_.

151  : ResultSetReductionJIT(query_mem_desc, targets, target_init_vals, executor_id)
152  , query_mem_desc_(query_mem_desc) {
157  }
const QueryMemoryDescriptor & query_mem_desc_
QueryDescriptionType getQueryDescriptionType() const
#define CHECK(condition)
Definition: Logger.h:222
ResultSetReductionJIT(const QueryMemoryDescriptor &query_mem_desc, const std::vector< TargetInfo > &targets, const std::vector< int64_t > &target_init_vals, const size_t executor_id)

+ Here is the call graph for this function:

Member Function Documentation

ReductionCode GpuReductionHelperJIT::codegen ( ) const
overridevirtual

generates code for perfect hash group by reduction: the following functions are internally created: isEmpty, reduceOneEntryNoCollision (reduce for perfect hash), reduceOneEntryNoCollissionsIdx(reduce one slot for perfect hash), and reduceLoop (the outer loop).

Reimplemented from ResultSetReductionJIT.

Definition at line 1295 of file ResultSetReductionJIT.cpp.

References AUTOMATIC_IR_METADATA, ReductionCode::cgen_state, CHECK, anonymous_namespace{ResultSetReductionJIT.cpp}::create_llvm_function(), ResultSetReductionJIT::executor_id_, anonymous_namespace{Utm.h}::f, Executor::getExecutor(), QueryMemoryDescriptor::getQueryDescriptionType(), GroupByPerfectHash, ReductionCode::ir_is_empty, ReductionCode::ir_reduce_loop, ReductionCode::ir_reduce_one_entry, ReductionCode::ir_reduce_one_entry_idx, ResultSetReductionJIT::isEmpty(), ReductionCode::module, ResultSetReductionJIT::query_mem_desc_, ResultSetReductionJIT::reduceLoop(), ResultSetReductionJIT::reduceOneEntryNoCollisions(), ResultSetReductionJIT::reduceOneEntryNoCollisionsIdx(), CgenState::set_module_shallow_copy(), anonymous_namespace{ResultSetReductionJIT.cpp}::setup_functions_ir(), and translate_function().

1295  {
1296  const auto hash_type = query_mem_desc_.getQueryDescriptionType();
1297  auto reduction_code = setup_functions_ir(hash_type);
1299  isEmpty(reduction_code);
1300  reduceOneEntryNoCollisions(reduction_code);
1301  reduceOneEntryNoCollisionsIdx(reduction_code);
1302  reduceLoop(reduction_code);
1303  auto executor = Executor::getExecutor(executor_id_);
1304  auto cgen_state_ = std::unique_ptr<CgenState>(new CgenState({}, false, executor.get()));
1305  auto cgen_state = reduction_code.cgen_state = cgen_state_.get();
1306  // CHECK(executor->thread_id_ == logger::thread_id()); // do we need compilation mutex?
1307  cgen_state->set_module_shallow_copy(executor->get_rt_module());
1308  reduction_code.module = cgen_state->module_;
1309 
1310  AUTOMATIC_IR_METADATA(cgen_state);
1311  auto ir_is_empty = create_llvm_function(reduction_code.ir_is_empty.get(), cgen_state);
1312  auto ir_reduce_one_entry =
1313  create_llvm_function(reduction_code.ir_reduce_one_entry.get(), cgen_state);
1314  auto ir_reduce_one_entry_idx =
1315  create_llvm_function(reduction_code.ir_reduce_one_entry_idx.get(), cgen_state);
1316  auto ir_reduce_loop =
1317  create_llvm_function(reduction_code.ir_reduce_loop.get(), cgen_state);
1318  std::unordered_map<const Function*, llvm::Function*> f;
1319  f.emplace(reduction_code.ir_is_empty.get(), ir_is_empty);
1320  f.emplace(reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry);
1321  f.emplace(reduction_code.ir_reduce_one_entry_idx.get(), ir_reduce_one_entry_idx);
1322  f.emplace(reduction_code.ir_reduce_loop.get(), ir_reduce_loop);
1323  translate_function(reduction_code.ir_is_empty.get(), ir_is_empty, reduction_code, f);
1325  reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry, reduction_code, f);
1326  translate_function(reduction_code.ir_reduce_one_entry_idx.get(),
1327  ir_reduce_one_entry_idx,
1328  reduction_code,
1329  f);
1331  reduction_code.ir_reduce_loop.get(), ir_reduce_loop, reduction_code, f);
1332  reduction_code.llvm_reduce_loop = ir_reduce_loop;
1333  reduction_code.cgen_state = nullptr;
1334  return reduction_code;
1335 }
void reduceOneEntryNoCollisions(const ReductionCode &reduction_code) const
void reduceLoop(const ReductionCode &reduction_code) const
void reduceOneEntryNoCollisionsIdx(const ReductionCode &reduction_code) const
const QueryMemoryDescriptor & query_mem_desc_
constexpr double f
Definition: Utm.h:31
void translate_function(const Function *function, llvm::Function *llvm_function, const ReductionCode &reduction_code, const std::unordered_map< const Function *, llvm::Function * > &f)
static std::shared_ptr< Executor > getExecutor(const ExecutorId id, const std::string &debug_dir="", const std::string &debug_file="", const SystemParameters &system_parameters=SystemParameters())
Definition: Execute.cpp:483
ReductionCode setup_functions_ir(const QueryDescriptionType hash_type)
#define AUTOMATIC_IR_METADATA(CGENSTATE)
QueryDescriptionType getQueryDescriptionType() const
void isEmpty(const ReductionCode &reduction_code) const
#define CHECK(condition)
Definition: Logger.h:222
llvm::Function * create_llvm_function(const Function *function, CgenState *cgen_state)

+ Here is the call graph for this function:

Member Data Documentation

const QueryMemoryDescriptor& GpuReductionHelperJIT::query_mem_desc_
private

Definition at line 167 of file ResultSetReductionJIT.h.

Referenced by GpuReductionHelperJIT().


The documentation for this class was generated from the following files: