OmniSciDB
a5dc49c757
|
#include <CodeGenerator.h>
Classes | |
struct | CompiledExpression |
Public Types | |
using | ColumnMap = std::unordered_map< InputColDescriptor, std::shared_ptr< Analyzer::ColumnVar >> |
Public Member Functions | |
ScalarCodeGenerator (std::unique_ptr< llvm::Module > llvm_module) | |
CompiledExpression | compile (const Analyzer::Expr *expr, const bool fetch_columns, const CompilationOptions &co) |
std::vector< void * > | generateNativeCode (Executor *executor, const CompiledExpression &compiled_expression, const CompilationOptions &co) |
CudaMgr_Namespace::CudaMgr * | getCudaMgr () const |
Public Member Functions inherited from CodeGenerator | |
CodeGenerator (Executor *executor) | |
CodeGenerator (CgenState *cgen_state, PlanState *plan_state) | |
std::vector< llvm::Value * > | codegen (const Analyzer::Expr *, const bool fetch_columns, const CompilationOptions &) |
llvm::Value * | codegenPerRowStringOper (const Analyzer::StringOper *string_oper, const CompilationOptions &co) |
llvm::Value * | codegenPseudoStringOper (const Analyzer::ColumnVar *, const std::vector< StringOps_Namespace::StringOpInfo > &string_op_infos, const CompilationOptions &) |
std::vector< llvm::Value * > | codegenHoistedConstants (const std::vector< const Analyzer::Constant * > &constants, const EncodingType enc_type, const shared::StringDictKey &dict_id) |
llvm::Value * | codegenCastBetweenIntTypes (llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, bool upscale=true) |
void | codegenCastBetweenIntTypesOverflowChecks (llvm::Value *operand_lv, const SQLTypeInfo &operand_ti, const SQLTypeInfo &ti, const int64_t scale) |
llvm::Value * | posArg (const Analyzer::Expr *) const |
llvm::Value * | toBool (llvm::Value *) |
llvm::Value * | castArrayPointer (llvm::Value *ptr, const SQLTypeInfo &elem_ti) |
llvm::Value * | codegenCastBetweenTimestamps (llvm::Value *ts_lv, const SQLTypeInfo &operand_dimen, const SQLTypeInfo &target_dimen, const bool nullable) |
llvm::Value * | codegenWindowPosition (const WindowFunctionContext *window_func_context, llvm::Value *pos_arg) |
Private Member Functions | |
std::vector< llvm::Value * > | codegenColumn (const Analyzer::ColumnVar *, const bool fetch_column, const CompilationOptions &) override |
ColumnMap | prepare (const Analyzer::Expr *) |
std::vector< void * > | generateNativeGPUCode (Executor *executor, llvm::Function *func, llvm::Function *wrapper_func, const CompilationOptions &co) |
Private Attributes | |
std::unique_ptr< llvm::Module > | module_ |
ExecutionEngineWrapper | execution_engine_ |
std::unique_ptr< CgenState > | own_cgen_state_ |
std::unique_ptr< PlanState > | own_plan_state_ |
std::unique_ptr < CudaMgr_Namespace::CudaMgr > | cuda_mgr_ |
std::shared_ptr < GpuCompilationContext > | gpu_compilation_context_ |
std::unique_ptr < llvm::TargetMachine > | nvptx_target_machine_ |
Additional Inherited Members | |
Static Public Member Functions inherited from CodeGenerator | |
static llvm::ConstantInt * | codegenIntConst (const Analyzer::Constant *constant, CgenState *cgen_state) |
static std::unordered_set < llvm::Function * > | markDeadRuntimeFuncs (llvm::Module &module, const std::vector< llvm::Function * > &roots, const std::vector< llvm::Function * > &leaves) |
static ExecutionEngineWrapper | generateNativeCPUCode (llvm::Function *func, const std::unordered_set< llvm::Function * > &live_funcs, const CompilationOptions &co) |
static std::string | generatePTX (const std::string &cuda_llir, llvm::TargetMachine *nvptx_target_machine, llvm::LLVMContext &context) |
static std::unique_ptr < llvm::TargetMachine > | initializeNVPTXBackend (const CudaMgr_Namespace::NvidiaDeviceArch arch) |
static bool | alwaysCloneRuntimeFunction (const llvm::Function *func) |
static void | linkModuleWithLibdevice (Executor *executor, llvm::Module &module, llvm::PassManagerBuilder &pass_manager_builder, const GPUTarget &gpu_target) |
static std::shared_ptr < GpuCompilationContext > | generateNativeGPUCode (Executor *executor, llvm::Function *func, llvm::Function *wrapper_func, const std::unordered_set< llvm::Function * > &live_funcs, const bool is_gpu_smem_used, const CompilationOptions &co, const GPUTarget &gpu_target) |
static void | link_udf_module (const std::unique_ptr< llvm::Module > &udf_module, llvm::Module &module, CgenState *cgen_state, llvm::Linker::Flags flags=llvm::Linker::Flags::None) |
static bool | prioritizeQuals (const RelAlgExecutionUnit &ra_exe_unit, std::vector< Analyzer::Expr * > &primary_quals, std::vector< Analyzer::Expr * > &deferred_quals, const PlanState::HoistedFiltersSet &hoisted_quals) |
static ArrayLoadCodegen | codegenGeoArrayLoadAndNullcheck (llvm::Value *byte_stream, llvm::Value *pos, const SQLTypeInfo &ti, CgenState *cgen_state) |
Protected Member Functions inherited from CodeGenerator | |
Executor * | executor () const |
Protected Attributes inherited from CodeGenerator | |
CgenState * | cgen_state_ |
PlanState * | plan_state_ |
Definition at line 679 of file CodeGenerator.h.
using ScalarCodeGenerator::ColumnMap = std::unordered_map<InputColDescriptor, std::shared_ptr<Analyzer::ColumnVar>> |
Definition at line 712 of file CodeGenerator.h.
|
inline |
Definition at line 682 of file CodeGenerator.h.
|
overrideprivatevirtual |
Reimplemented from CodeGenerator.
Definition at line 170 of file ScalarCodeGenerator.cpp.
References CodeGenerator::cgen_state_, CHECK_LT, PlanState::getLocalColumnId(), CodeGenerator::plan_state_, and CgenState::row_func_.
ScalarCodeGenerator::CompiledExpression ScalarCodeGenerator::compile | ( | const Analyzer::Expr * | expr, |
const bool | fetch_columns, | ||
const CompilationOptions & | co | ||
) |
Definition at line 78 of file ScalarCodeGenerator.cpp.
References AUTOMATIC_IR_METADATA, CodeGenerator::cgen_state_, CHECK_EQ, CHECK_LT, CodeGenerator::codegen(), CompilationOptions::device_type, anonymous_namespace{ScalarCodeGenerator.cpp}::g_table_infos, get_int_type(), Analyzer::Expr::get_type_info(), GPU, CgenState::ir_builder_, anonymous_namespace{ScalarCodeGenerator.cpp}::llvm_type_from_sql(), module_, own_cgen_state_, own_plan_state_, CodeGenerator::plan_state_, prepare(), and CgenState::row_func_.
std::vector< void * > ScalarCodeGenerator::generateNativeCode | ( | Executor * | executor, |
const CompiledExpression & | compiled_expression, | ||
const CompilationOptions & | co | ||
) |
Definition at line 147 of file ScalarCodeGenerator.cpp.
References CHECK, CPU, CompilationOptions::device_type, execution_engine_, logger::FATAL, ScalarCodeGenerator::CompiledExpression::func, CodeGenerator::generateNativeCPUCode(), generateNativeGPUCode(), ExecutionEngineWrapper::get(), GPU, LOG, module_, and ScalarCodeGenerator::CompiledExpression::wrapper_func.
|
private |
Definition at line 180 of file ScalarCodeGenerator.cpp.
References CodeGenerator::GPUTarget::cgen_state, CodeGenerator::cgen_state_, CodeGenerator::GPUTarget::cuda_mgr, cuda_mgr_, CodeGenerator::generateNativeGPUCode(), gpu_compilation_context_, CodeGenerator::initializeNVPTXBackend(), CudaMgr_Namespace::Kepler, CodeGenerator::GPUTarget::nvptx_target_machine, nvptx_target_machine_, and CodeGenerator::GPUTarget::row_func_not_inlined.
Referenced by generateNativeCode().
|
inline |
Definition at line 709 of file CodeGenerator.h.
References cuda_mgr_.
|
private |
Definition at line 62 of file ScalarCodeGenerator.cpp.
References PlanState::allocateLocalColumnIds(), and CodeGenerator::plan_state_.
Referenced by compile().
|
private |
Definition at line 732 of file CodeGenerator.h.
Referenced by generateNativeGPUCode(), and getCudaMgr().
|
private |
Definition at line 729 of file CodeGenerator.h.
Referenced by generateNativeCode().
|
private |
Definition at line 733 of file CodeGenerator.h.
Referenced by generateNativeGPUCode().
|
private |
Definition at line 728 of file CodeGenerator.h.
Referenced by compile(), and generateNativeCode().
|
private |
Definition at line 734 of file CodeGenerator.h.
Referenced by generateNativeGPUCode().
|
private |
Definition at line 730 of file CodeGenerator.h.
Referenced by compile().
|
private |
Definition at line 731 of file CodeGenerator.h.
Referenced by compile().