OmniSciDB  94e8789169
 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 147 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 149 of file ResultSetReductionJIT.h.

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

152  : ResultSetReductionJIT(query_mem_desc, targets, target_init_vals)
153  , query_mem_desc_(query_mem_desc) {
158  }
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 1308 of file ResultSetReductionJIT.cpp.

References AUTOMATIC_IR_METADATA, ReductionCode::cgen_state, CHECK, anonymous_namespace{ResultSetReductionJIT.cpp}::create_llvm_function(), generate_TableFunctionsFactory_init::f, 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().

1308  {
1309  const auto hash_type = query_mem_desc_.getQueryDescriptionType();
1310  auto reduction_code = setup_functions_ir(hash_type);
1312  isEmpty(reduction_code);
1313  reduceOneEntryNoCollisions(reduction_code);
1314  reduceOneEntryNoCollisionsIdx(reduction_code);
1315  reduceLoop(reduction_code);
1316  reduction_code.cgen_state.reset(new CgenState({}, false));
1317  auto cgen_state = reduction_code.cgen_state.get();
1318  std::unique_ptr<llvm::Module> module(runtime_module_shallow_copy(cgen_state));
1319 
1320  cgen_state->module_ = module.get();
1321  AUTOMATIC_IR_METADATA(cgen_state);
1322  auto ir_is_empty = create_llvm_function(reduction_code.ir_is_empty.get(), cgen_state);
1323  auto ir_reduce_one_entry =
1324  create_llvm_function(reduction_code.ir_reduce_one_entry.get(), cgen_state);
1325  auto ir_reduce_one_entry_idx =
1326  create_llvm_function(reduction_code.ir_reduce_one_entry_idx.get(), cgen_state);
1327  auto ir_reduce_loop =
1328  create_llvm_function(reduction_code.ir_reduce_loop.get(), cgen_state);
1329  std::unordered_map<const Function*, llvm::Function*> f;
1330  f.emplace(reduction_code.ir_is_empty.get(), ir_is_empty);
1331  f.emplace(reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry);
1332  f.emplace(reduction_code.ir_reduce_one_entry_idx.get(), ir_reduce_one_entry_idx);
1333  f.emplace(reduction_code.ir_reduce_loop.get(), ir_reduce_loop);
1334  translate_function(reduction_code.ir_is_empty.get(), ir_is_empty, reduction_code, f);
1336  reduction_code.ir_reduce_one_entry.get(), ir_reduce_one_entry, reduction_code, f);
1337  translate_function(reduction_code.ir_reduce_one_entry_idx.get(),
1338  ir_reduce_one_entry_idx,
1339  reduction_code,
1340  f);
1342  reduction_code.ir_reduce_loop.get(), ir_reduce_loop, reduction_code, f);
1343  reduction_code.llvm_reduce_loop = ir_reduce_loop;
1344  reduction_code.module = std::move(module);
1345  return reduction_code;
1346 }
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 168 of file ResultSetReductionJIT.h.

Referenced by GpuReductionHelperJIT().


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