OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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)
 
virtual ReductionCode codegen () const
 
- 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)
 
virtual ~ResultSetReductionJIT ()=default
 

Private Attributes

const QueryMemoryDescriptorquery_mem_desc_
 

Additional Inherited Members

- Static Public Member Functions inherited from ResultSetReductionJIT
static void clearCache ()
 
- 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
 

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 142 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 
)
inline

Definition at line 144 of file ResultSetReductionJIT.h.

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

147  : ResultSetReductionJIT(query_mem_desc, targets, target_init_vals)
148  , query_mem_desc_(query_mem_desc) {
153  }
const QueryMemoryDescriptor & query_mem_desc_
ResultSetReductionJIT(const QueryMemoryDescriptor &query_mem_desc, const std::vector< TargetInfo > &targets, const std::vector< int64_t > &target_init_vals)
QueryDescriptionType getQueryDescriptionType() const
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

Member Function Documentation

ReductionCode GpuReductionHelperJIT::codegen ( ) const
virtual

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

References AUTOMATIC_IR_METADATA, ReductionCode::cgen_state, CHECK, anonymous_namespace{ResultSetReductionJIT.cpp}::create_llvm_function(), QueryMemoryDescriptor::getQueryDescriptionType(), GroupByPerfectHash, ReductionCode::ir_is_empty, ReductionCode::ir_reduce_loop, ReductionCode::ir_reduce_one_entry, ReductionCode::ir_reduce_one_entry_idx, ResultSetReductionJIT::isEmpty(), ResultSetReductionJIT::query_mem_desc_, ResultSetReductionJIT::reduceLoop(), ResultSetReductionJIT::reduceOneEntryNoCollisions(), ResultSetReductionJIT::reduceOneEntryNoCollisionsIdx(), runtime_module_shallow_copy(), anonymous_namespace{ResultSetReductionJIT.cpp}::setup_functions_ir(), and translate_function().

1267  {
1268  const auto hash_type = query_mem_desc_.getQueryDescriptionType();
1269  auto reduction_code = setup_functions_ir(hash_type);
1271  isEmpty(reduction_code);
1272  reduceOneEntryNoCollisions(reduction_code);
1273  reduceOneEntryNoCollisionsIdx(reduction_code);
1274  reduceLoop(reduction_code);
1275  reduction_code.cgen_state.reset(new CgenState({}, false));
1276  auto cgen_state = reduction_code.cgen_state.get();
1277  std::unique_ptr<llvm::Module> module(runtime_module_shallow_copy(cgen_state));
1278 
1279  cgen_state->module_ = module.get();
1280  AUTOMATIC_IR_METADATA(cgen_state);
1281  auto ir_is_empty = create_llvm_function(reduction_code.ir_is_empty.get(), cgen_state);
1282  auto ir_reduce_one_entry =
1283  create_llvm_function(reduction_code.ir_reduce_one_entry.get(), cgen_state);
1284  auto ir_reduce_one_entry_idx =
1285  create_llvm_function(reduction_code.ir_reduce_one_entry_idx.get(), cgen_state);
1286  auto ir_reduce_loop =
1287  create_llvm_function(reduction_code.ir_reduce_loop.get(), cgen_state);
1288  std::unordered_map<const Function*, llvm::Function*> f;
1289  f.emplace(reduction_code.ir_is_empty.get(), ir_is_empty);
1290  f.emplace(reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry);
1291  f.emplace(reduction_code.ir_reduce_one_entry_idx.get(), ir_reduce_one_entry_idx);
1292  f.emplace(reduction_code.ir_reduce_loop.get(), ir_reduce_loop);
1293  translate_function(reduction_code.ir_is_empty.get(), ir_is_empty, reduction_code, f);
1295  reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry, reduction_code, f);
1296  translate_function(reduction_code.ir_reduce_one_entry_idx.get(),
1297  ir_reduce_one_entry_idx,
1298  reduction_code,
1299  f);
1301  reduction_code.ir_reduce_loop.get(), ir_reduce_loop, reduction_code, f);
1302  reduction_code.llvm_reduce_loop = ir_reduce_loop;
1303  reduction_code.module = std::move(module);
1304  return reduction_code;
1305 }
std::unique_ptr< llvm::Module > runtime_module_shallow_copy(CgenState *cgen_state)
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_
void translate_function(const Function *function, llvm::Function *llvm_function, const ReductionCode &reduction_code, const std::unordered_map< const Function *, llvm::Function * > &f)
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:197
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 163 of file ResultSetReductionJIT.h.

Referenced by GpuReductionHelperJIT().


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