OmniSciDB
85c2d10cdc
|
#include "CodeGenerator.h"
#include "Execute.h"
#include "ExtensionFunctionsWhitelist.h"
#include "GpuSharedMemoryUtils.h"
#include "LLVMFunctionAttributesUtil.h"
#include "OutputBufferInitialization.h"
#include "QueryTemplateGenerator.h"
#include "CudaMgr/CudaMgr.h"
#include "OSDependent/omnisci_path.h"
#include "Shared/InlineNullValues.h"
#include "Shared/MathUtils.h"
#include "StreamingTopN.h"
#include <llvm/Bitcode/BitcodeReader.h>
#include <llvm/Bitcode/BitcodeWriter.h>
#include <llvm/ExecutionEngine/MCJIT.h>
#include <llvm/IR/Attributes.h>
#include <llvm/IR/GlobalValue.h>
#include <llvm/IR/InstIterator.h>
#include <llvm/IR/IntrinsicInst.h>
#include <llvm/IR/Intrinsics.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/IR/Verifier.h>
#include <llvm/IRReader/IRReader.h>
#include <llvm/Linker/Linker.h>
#include <llvm/Support/Casting.h>
#include <llvm/Support/FileSystem.h>
#include <llvm/Support/FormattedStream.h>
#include <llvm/Support/MemoryBuffer.h>
#include <llvm/Support/SourceMgr.h>
#include <llvm/Support/TargetRegistry.h>
#include <llvm/Support/TargetSelect.h>
#include <llvm/Support/raw_os_ostream.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Transforms/IPO.h>
#include <llvm/Transforms/IPO/AlwaysInliner.h>
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
#include <llvm/Transforms/InstCombine/InstCombine.h>
#include <llvm/Transforms/Instrumentation.h>
#include <llvm/Transforms/Scalar.h>
#include <llvm/Transforms/Scalar/InstSimplifyPass.h>
#include <llvm/Transforms/Utils.h>
#include <llvm/Transforms/Utils/BasicBlockUtils.h>
#include <llvm/Transforms/Utils/Cloning.h>
Go to the source code of this file.
Namespaces | |
anonymous_namespace{NativeCodegen.cpp} | |
Macros | |
#define | SHOW_DEFINED(MODULE) |
#define | SHOW_FUNCTIONS(MODULE) |
Functions | |
void | anonymous_namespace{NativeCodegen.cpp}::throw_parseIR_error (const llvm::SMDiagnostic &parse_error, std::string src="", const bool is_gpu=false) |
template<typename T = void> | |
void | anonymous_namespace{NativeCodegen.cpp}::show_defined (llvm::Module &module) |
template<typename T = void> | |
void | anonymous_namespace{NativeCodegen.cpp}::show_defined (llvm::Module *module) |
template<typename T = void> | |
void | anonymous_namespace{NativeCodegen.cpp}::show_defined (std::unique_ptr< llvm::Module > &module) |
template<typename T = void> | |
void | anonymous_namespace{NativeCodegen.cpp}::scan_function_calls (llvm::Function &F, std::unordered_set< std::string > &defined, std::unordered_set< std::string > &undefined, const std::unordered_set< std::string > &ignored) |
template<typename T = void> | |
void | anonymous_namespace{NativeCodegen.cpp}::scan_function_calls (llvm::Module &module, std::unordered_set< std::string > &defined, std::unordered_set< std::string > &undefined, const std::unordered_set< std::string > &ignored) |
template<typename T = void> | |
std::tuple< std::unordered_set < std::string > , std::unordered_set < std::string > > | anonymous_namespace{NativeCodegen.cpp}::scan_function_calls (llvm::Module &module, const std::unordered_set< std::string > &ignored={}) |
void | anonymous_namespace{NativeCodegen.cpp}::eliminate_dead_self_recursive_funcs (llvm::Module &M, const std::unordered_set< llvm::Function * > &live_funcs) |
void | anonymous_namespace{NativeCodegen.cpp}::optimize_ir (llvm::Function *query_func, llvm::Module *module, llvm::legacy::PassManager &pass_manager, const std::unordered_set< llvm::Function * > &live_funcs, const CompilationOptions &co) |
void | verify_function_ir (const llvm::Function *func) |
std::string | anonymous_namespace{NativeCodegen.cpp}::assemblyForCPU (ExecutionEngineWrapper &execution_engine, llvm::Module *module) |
std::string | anonymous_namespace{NativeCodegen.cpp}::cpp_to_llvm_name (const std::string &s) |
std::string | anonymous_namespace{NativeCodegen.cpp}::gen_array_any_all_sigs () |
std::string | anonymous_namespace{NativeCodegen.cpp}::gen_translate_null_key_sigs () |
llvm::StringRef | get_gpu_target_triple_string () |
llvm::StringRef | get_gpu_data_layout () |
std::map< std::string, std::string > | get_device_parameters (bool cpu_only) |
llvm::Module * | read_template_module (llvm::LLVMContext &context) |
void | anonymous_namespace{NativeCodegen.cpp}::bind_pos_placeholders (const std::string &pos_fn_name, const bool use_resume_param, llvm::Function *query_func, llvm::Module *module) |
void | anonymous_namespace{NativeCodegen.cpp}::set_row_func_argnames (llvm::Function *row_func, const size_t in_col_count, const size_t agg_col_count, const bool hoist_literals) |
llvm::Function * | anonymous_namespace{NativeCodegen.cpp}::create_row_function (const size_t in_col_count, const size_t agg_col_count, const bool hoist_literals, llvm::Module *module, llvm::LLVMContext &context) |
void | anonymous_namespace{NativeCodegen.cpp}::bind_query (llvm::Function *query_func, const std::string &query_fname, llvm::Function *multifrag_query_func, llvm::Module *module) |
std::vector< std::string > | anonymous_namespace{NativeCodegen.cpp}::get_agg_fnames (const std::vector< Analyzer::Expr * > &target_exprs, const bool is_group_by) |
std::unique_ptr< llvm::Module > | g_rt_module (read_template_module(getGlobalLLVMContext())) |
bool | is_udf_module_present (bool cpu_only) |
bool | is_rt_udf_module_present (bool cpu_only) |
void | read_udf_gpu_module (const std::string &udf_ir_filename) |
void | read_udf_cpu_module (const std::string &udf_ir_filename) |
void | read_rt_udf_gpu_module (const std::string &udf_ir_string) |
void | read_rt_udf_cpu_module (const std::string &udf_ir_string) |
template<typename InstType > | |
llvm::Value * | anonymous_namespace{NativeCodegen.cpp}::find_variable_in_basic_block (llvm::Function *func, std::string bb_name, std::string variable_name) |
size_t | anonymous_namespace{NativeCodegen.cpp}::get_shared_memory_size (const bool shared_mem_used, const QueryMemoryDescriptor *query_mem_desc_ptr) |
bool | anonymous_namespace{NativeCodegen.cpp}::is_gpu_shared_mem_supported (const QueryMemoryDescriptor *query_mem_desc_ptr, const RelAlgExecutionUnit &ra_exe_unit, const CudaMgr_Namespace::CudaMgr *cuda_mgr, const ExecutorDeviceType device_type, const unsigned gpu_blocksize, const unsigned num_blocks_per_mp) |
std::string | anonymous_namespace{NativeCodegen.cpp}::serialize_llvm_metadata_footnotes (llvm::Function *query_func, CgenState *cgen_state) |
std::unique_ptr< llvm::Module > | runtime_module_shallow_copy (CgenState *cgen_state) |
std::vector< llvm::Value * > | generate_column_heads_load (const int num_columns, llvm::Value *byte_stream_arg, llvm::IRBuilder<> &ir_builder, llvm::LLVMContext &ctx) |
Variables | |
float | g_fraction_code_cache_to_evict = 0.2 |
std::unique_ptr< llvm::Module > | udf_gpu_module |
std::unique_ptr< llvm::Module > | udf_cpu_module |
std::unique_ptr< llvm::Module > | rt_udf_gpu_module |
std::unique_ptr< llvm::Module > | rt_udf_cpu_module |
std::unique_ptr< llvm::Module > | g_rt_module |
const std::string | anonymous_namespace{NativeCodegen.cpp}::cuda_rt_decls |
#define SHOW_DEFINED | ( | MODULE | ) |
Definition at line 145 of file NativeCodegen.cpp.
#define SHOW_FUNCTIONS | ( | MODULE | ) |
Definition at line 151 of file NativeCodegen.cpp.
std::unique_ptr<llvm::Module> g_rt_module | ( | read_template_module(getGlobalLLVMContext()) | ) |
std::vector<llvm::Value*> generate_column_heads_load | ( | const int | num_columns, |
llvm::Value * | byte_stream_arg, | ||
llvm::IRBuilder<> & | ir_builder, | ||
llvm::LLVMContext & | ctx | ||
) |
Loads individual columns from a single, packed pointers buffer (the byte stream arg)
Definition at line 3105 of file NativeCodegen.cpp.
Referenced by TableFunctionCompilationContext::generateEntryPoint().
std::map<std::string, std::string> get_device_parameters | ( | bool | cpu_only | ) |
Definition at line 866 of file NativeCodegen.cpp.
llvm::StringRef get_gpu_data_layout | ( | ) |
Definition at line 858 of file NativeCodegen.cpp.
References f, and udf_gpu_module.
llvm::StringRef get_gpu_target_triple_string | ( | ) |
Definition at line 854 of file NativeCodegen.cpp.
References f.
bool is_rt_udf_module_present | ( | bool | cpu_only | ) |
Definition at line 1699 of file NativeCodegen.cpp.
bool is_udf_module_present | ( | bool | cpu_only | ) |
Definition at line 1695 of file NativeCodegen.cpp.
void read_rt_udf_cpu_module | ( | const std::string & | udf_ir_string | ) |
Definition at line 1756 of file NativeCodegen.cpp.
References CHECK.
Referenced by DBHandler::register_runtime_extension_functions().
void read_rt_udf_gpu_module | ( | const std::string & | udf_ir_string | ) |
Definition at line 1733 of file NativeCodegen.cpp.
Referenced by DBHandler::register_runtime_extension_functions().
llvm::Module* read_template_module | ( | llvm::LLVMContext & | context | ) |
void read_udf_cpu_module | ( | const std::string & | udf_ir_filename | ) |
Definition at line 1722 of file NativeCodegen.cpp.
Referenced by UdfCompiler::readCpuCompiledModule().
void read_udf_gpu_module | ( | const std::string & | udf_ir_filename | ) |
Definition at line 1703 of file NativeCodegen.cpp.
Referenced by UdfCompiler::readGpuCompiledModule().
std::unique_ptr<llvm::Module> runtime_module_shallow_copy | ( | CgenState * | cgen_state | ) |
Makes a shallow copy (just declarations) of the runtime module. Function definitions are cloned only if they're used from the generated code.
Definition at line 3093 of file NativeCodegen.cpp.
Referenced by ResultSetReductionJIT::codegen(), GpuReductionHelperJIT::codegen(), StubGenerator::generateStub(), and TableFunctionCompilationContext::TableFunctionCompilationContext().
void verify_function_ir | ( | const llvm::Function * | func | ) |
Definition at line 362 of file NativeCodegen.cpp.
References logger::FATAL, and LOG.
Referenced by GpuSharedMemCodeBuilder::codegen(), anonymous_namespace{JoinLoopTest.cpp}::create_loop_test_function(), TableFunctionCompilationContext::generateEntryPoint(), StubGenerator::generateStub(), and translate_function().
float g_fraction_code_cache_to_evict = 0.2 |
Definition at line 71 of file NativeCodegen.cpp.
Referenced by CommandLineOptions::fillAdvancedOptions().
std::unique_ptr<llvm::Module> g_rt_module |
std::unique_ptr<llvm::Module> rt_udf_cpu_module |
Definition at line 76 of file NativeCodegen.cpp.
Referenced by anonymous_namespace{NativeCodegen.cpp}::create_row_function(), and TableFunctionCompilationContext::finalize().
std::unique_ptr<llvm::Module> rt_udf_gpu_module |
Definition at line 75 of file NativeCodegen.cpp.
Referenced by anonymous_namespace{NativeCodegen.cpp}::create_row_function(), and TableFunctionCompilationContext::finalize().
std::unique_ptr<llvm::Module> udf_cpu_module |
Definition at line 74 of file NativeCodegen.cpp.
std::unique_ptr<llvm::Module> udf_gpu_module |
Definition at line 73 of file NativeCodegen.cpp.
Referenced by get_gpu_data_layout().