Class Executor

class Executor

Public Types

enum ExtModuleKinds

Values:

template_module
udf_cpu_module
udf_gpu_module
rt_udf_cpu_module
rt_udf_gpu_module
rt_geos_module
rt_libdevice_module
using ExecutorId = size_t
using CachedCardinality = std::pair<bool, size_t>

Public Functions

Executor(const ExecutorId id, Data_Namespace::DataMgr *data_mgr, const size_t block_size_x, const size_t grid_size_x, const size_t max_gpu_slab_size, const std::string &debug_dir, const std::string &debug_file)
void clearCaches(bool runtime_only = false)
std::string dumpCache() const
void reset(bool discard_runtime_modules_only = false)
const std::unique_ptr<llvm::Module> &get_rt_module() const
const std::unique_ptr<llvm::Module> &get_udf_module(bool is_gpu = false) const
const std::unique_ptr<llvm::Module> &get_rt_udf_module(bool is_gpu = false) const
const std::unique_ptr<llvm::Module> &get_geos_module() const
const std::unique_ptr<llvm::Module> &get_libdevice_module() const
bool has_rt_module() const
bool has_udf_module(bool is_gpu = false) const
bool has_rt_udf_module(bool is_gpu = false) const
bool has_geos_module() const
bool has_libdevice_module() const
const TemporaryTables *getTemporaryTables()

Returns pointer to the intermediate tables vector currently stored by this executor.

StringDictionaryProxy *getStringDictionaryProxy(const int dict_id, const bool with_generation) const

Returns a string dictionary proxy using the currently active row set memory owner.

StringDictionaryProxy *getStringDictionaryProxy(const int dictId, const std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const bool with_generation) const
const StringDictionaryProxy::IdMap *getStringProxyTranslationMap(const int source_dict_id, const int dest_dict_id, const RowSetMemoryOwner::StringTranslationType translation_type, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const bool with_generation) const
const StringDictionaryProxy::IdMap *getIntersectionStringProxyTranslationMap(const StringDictionaryProxy *source_proxy, const StringDictionaryProxy *dest_proxy, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner) const
bool isCPUOnly() const
bool isArchMaxwell(const ExecutorDeviceType dt) const
bool containsLeftDeepOuterJoin() const
const ColumnDescriptor *getColumnDescriptor(const Analyzer::ColumnVar *col_var) const
const ColumnDescriptor *getPhysicalColumnDescriptor(const Analyzer::ColumnVar *col_var, int n) const
const Catalog_Namespace::Catalog *getCatalog() const
void setCatalog(const Catalog_Namespace::Catalog *catalog)
Data_Namespace::DataMgr *getDataMgr() const
const std::shared_ptr<RowSetMemoryOwner> getRowSetMemoryOwner() const
const TemporaryTables *getTemporaryTables() const
Fragmenter_Namespace::TableInfo getTableInfo(const int table_id) const
const TableGeneration &getTableGeneration(const int table_id) const
ExpressionRange getColRange(const PhysicalInput &phys_input) const
size_t getNumBytesForFetchedRow(const std::set<int> &table_ids_to_fetch) const
bool hasLazyFetchColumns(const std::vector<Analyzer::Expr *> &target_exprs) const
std::vector<ColumnLazyFetchInfo> getColLazyFetchInfo(const std::vector<Analyzer::Expr *> &target_exprs) const
void registerActiveModule(void *module, const int device_id) const
void unregisterActiveModule(void *module, const int device_id) const
void interrupt(const QuerySessionId &query_session = "", const QuerySessionId &interrupt_session = "")
void resetInterrupt()
void enableRuntimeQueryInterrupt(const double runtime_query_check_freq, const unsigned pending_query_check_freq) const
int8_t warpSize() const
unsigned gridSize() const
unsigned numBlocksPerMP() const
unsigned blockSize() const
size_t maxGpuSlabSize() const
ResultSetPtr executeWorkUnit(size_t &max_groups_buffer_entry_guess, const bool is_agg, const std::vector<InputTableInfo> &query_infos, const RelAlgExecutionUnit &ra_exe_unit_in, const CompilationOptions &co, const ExecutionOptions &options, const Catalog_Namespace::Catalog &cat, RenderInfo *render_info, const bool has_cardinality_estimation, ColumnCacheMap &column_cache)
TableUpdateMetadata executeUpdate(const RelAlgExecutionUnit &ra_exe_unit, const std::vector<InputTableInfo> &table_infos, const TableDescriptor *updated_table_desc, const CompilationOptions &co, const ExecutionOptions &eo, const Catalog_Namespace::Catalog &cat, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const UpdateLogForFragment::Callback &cb, const bool is_agg)
void addTransientStringLiterals(const RelAlgExecutionUnit &ra_exe_unit, const std::shared_ptr<RowSetMemoryOwner> &row_set_mem_owner)
void setupCaching(const std::unordered_set<PhysicalInput> &phys_inputs, const std::unordered_set<int> &phys_table_ids)
void setColRangeCache(const AggregatedColRange &aggregated_col_range)
ExecutorId getExecutorId() const
QuerySessionId &getCurrentQuerySession(mapd_shared_lock<mapd_shared_mutex> &read_lock)
QuerySessionStatus::QueryStatus getQuerySessionStatus(const QuerySessionId &candidate_query_session, mapd_shared_lock<mapd_shared_mutex> &read_lock)
bool checkCurrentQuerySession(const std::string &candidate_query_session, mapd_shared_lock<mapd_shared_mutex> &read_lock)
void invalidateRunningQuerySession(mapd_unique_lock<mapd_shared_mutex> &write_lock)
bool addToQuerySessionList(const QuerySessionId &query_session, const std::string &query_str, const std::string &submitted, const size_t executor_id, const QuerySessionStatus::QueryStatus query_status, mapd_unique_lock<mapd_shared_mutex> &write_lock)
bool removeFromQuerySessionList(const QuerySessionId &query_session, const std::string &submitted_time_str, mapd_unique_lock<mapd_shared_mutex> &write_lock)
void setQuerySessionAsInterrupted(const QuerySessionId &query_session, mapd_unique_lock<mapd_shared_mutex> &write_lock)
bool checkIsQuerySessionInterrupted(const std::string &query_session, mapd_shared_lock<mapd_shared_mutex> &read_lock)
bool checkIsQuerySessionEnrolled(const QuerySessionId &query_session, mapd_shared_lock<mapd_shared_mutex> &read_lock)
bool updateQuerySessionStatusWithLock(const QuerySessionId &query_session, const std::string &submitted_time_str, const QuerySessionStatus::QueryStatus updated_query_status, mapd_unique_lock<mapd_shared_mutex> &write_lock)
bool updateQuerySessionExecutorAssignment(const QuerySessionId &query_session, const std::string &submitted_time_str, const size_t executor_id, mapd_unique_lock<mapd_shared_mutex> &write_lock)
std::vector<QuerySessionStatus> getQuerySessionInfo(const QuerySessionId &query_session, mapd_shared_lock<mapd_shared_mutex> &read_lock)
mapd_shared_mutex &getSessionLock()
CurrentQueryStatus attachExecutorToQuerySession(const QuerySessionId &query_session_id, const std::string &query_str, const std::string &query_submitted_time)
void checkPendingQueryStatus(const QuerySessionId &query_session)
void clearQuerySessionStatus(const QuerySessionId &query_session, const std::string &submitted_time_str)
void updateQuerySessionStatus(const QuerySessionId &query_session, const std::string &submitted_time_str, const QuerySessionStatus::QueryStatus new_query_status)
void enrollQuerySession(const QuerySessionId &query_session, const std::string &query_str, const std::string &submitted_time_str, const size_t executor_id, const QuerySessionStatus::QueryStatus query_session_status)
size_t getNumCurentSessionsEnrolled() const
const std::vector<size_t> getExecutorIdsRunningQuery(const QuerySessionId &interrupt_session) const
bool checkNonKernelTimeInterrupted() const
void registerExtractedQueryPlanDag(const QueryPlanDAG &query_plan_dag)
const QueryPlanDAG getLatestQueryPlanDagExtracted() const
void addToCardinalityCache(const std::string &cache_key, const size_t cache_value)
Executor::CachedCardinality getCachedCardinality(const std::string &cache_key)
mapd_shared_mutex &getDataRecyclerLock()
QueryPlanDagCache &getQueryPlanDagCache()
ResultSetRecyclerHolder &getRecultSetRecyclerHolder()
CgenState *getCgenStatePtr() const
llvm::LLVMContext &getContext()
void update_extension_modules(bool update_runtime_modules_only = false)

Public Members

std::mutex compilation_mutex_
const logger::ThreadId thread_id_

Public Static Functions

static void clearExternalCaches(bool for_update, const TableDescriptor *td, const int current_db_id)
static void resetAllExecutors(bool discard_runtime_modules_only = false)
std::shared_ptr<Executor> getExecutor(const ExecutorId id, const std::string &debug_dir = "", const std::string &debug_file = "", const SystemParameters &system_parameters = SystemParameters())
static void nukeCacheOfExecutors()
void clearMemory(const Data_Namespace::MemoryLevel memory_level)
size_t getArenaBlockSize()
void addUdfIrToModule(const std::string &udf_ir_filename, const bool is_cuda_ir)
void initialize_extension_module_sources()
std::pair<int64_t, int32_t> reduceResults(const SQLAgg agg, const SQLTypeInfo &ti, const int64_t agg_init_val, const int8_t out_byte_width, const int64_t *out_vec, const size_t out_vec_sz, const bool is_group_by, const bool float_argument_input)
static void update_after_registration(bool update_runtime_modules_only = false)

Public Static Attributes

const ExecutorId UNITARY_EXECUTOR_ID = 0
const ExecutorId INVALID_EXECUTOR_ID = SIZE_MAX
std::map<Executor::ExtModuleKinds, std::string> extension_module_sources
const size_t high_scan_limit
CodeCacheAccessor<CpuCompilationContext> s_stubs_accessor
CodeCacheAccessor<CpuCompilationContext> s_code_accessor
CodeCacheAccessor<CpuCompilationContext> cpu_code_accessor
CodeCacheAccessor<GpuCompilationContext> gpu_code_accessor
const int32_t ERR_DIV_BY_ZERO = {1}
const int32_t ERR_OUT_OF_GPU_MEM = {2}
const int32_t ERR_OUT_OF_SLOTS = {3}
const int32_t ERR_UNSUPPORTED_SELF_JOIN = {4}
const int32_t ERR_OUT_OF_RENDER_MEM = {5}
const int32_t ERR_OUT_OF_CPU_MEM = {6}
const int32_t ERR_OVERFLOW_OR_UNDERFLOW = {7}
const int32_t ERR_OUT_OF_TIME = {9}
const int32_t ERR_INTERRUPTED = {10}
const int32_t ERR_COLUMNAR_CONVERSION_NOT_SUPPORTED = {11}
const int32_t ERR_TOO_MANY_LITERALS = {12}
const int32_t ERR_STRING_CONST_IN_RESULTSET = {13}
const int32_t ERR_STREAMING_TOP_N_NOT_SUPPORTED_IN_RENDER_QUERY = {14}
const int32_t ERR_SINGLE_VALUE_FOUND_MULTIPLE_VALUES = {15}
const int32_t ERR_GEOS = {16}
const int32_t ERR_WIDTH_BUCKET_INVALID_ARGUMENT = {17}
std::shared_mutex register_runtime_extension_functions_mutex_
std::mutex kernel_mutex_

Private Types

using PerFragmentCallBack = std::function<void(ResultSetPtr, const Fragmenter_Namespace::FragmentInfo&)>

Private Functions

void clearMetaInfoCache()
int deviceCount(const ExecutorDeviceType device_type) const
int deviceCountForMemoryLevel(const Data_Namespace::MemoryLevel memory_level) const
llvm::Value *codegenWindowFunction(const size_t target_index, const CompilationOptions &co)
llvm::Value *codegenWindowFunctionAggregate(const CompilationOptions &co)
llvm::BasicBlock *codegenWindowResetStateControlFlow()
void codegenWindowFunctionStateInit(llvm::Value *aggregate_state)
llvm::Value *codegenWindowFunctionAggregateCalls(llvm::Value *aggregate_state, const CompilationOptions &co)
void codegenWindowAvgEpilogue(llvm::Value *crt_val, llvm::Value *window_func_null_val, llvm::Value *multiplicity_lv)
llvm::Value *codegenAggregateWindowState()
llvm::Value *aggregateWindowStatePtr()
CudaMgr_Namespace::CudaMgr *cudaMgr() const
bool isArchPascalOrLater(const ExecutorDeviceType dt) const
bool needFetchAllFragments(const InputColDescriptor &col_desc, const RelAlgExecutionUnit &ra_exe_unit, const FragmentsList &selected_fragments) const
bool needLinearizeAllFragments(const ColumnDescriptor *cd, const InputColDescriptor &inner_col_desc, const RelAlgExecutionUnit &ra_exe_unit, const FragmentsList &selected_fragments, const Data_Namespace::MemoryLevel memory_level) const
void executeWorkUnitPerFragment(const RelAlgExecutionUnit &ra_exe_unit, const InputTableInfo &table_info, const CompilationOptions &co, const ExecutionOptions &eo, const Catalog_Namespace::Catalog &cat, PerFragmentCallBack &cb, const std::set<size_t> &fragment_indexes_param)

Compiles and dispatches a work unit per fragment processing results with the per fragment callback. Currently used for computing metrics over fragments (metadata).

ResultSetPtr executeExplain(const QueryCompilationDescriptor &query_comp_desc)
ResultSetPtr executeTableFunction(const TableFunctionExecutionUnit exe_unit, const std::vector<InputTableInfo> &table_infos, const CompilationOptions &co, const ExecutionOptions &eo, const Catalog_Namespace::Catalog &cat)

Compiles and dispatches a table function; that is, a function that takes as input one or more columns and returns a ResultSet, which can be parsed by subsequent execution steps.

ExecutorDeviceType getDeviceTypeForTargets(const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType requested_device_type)
ResultSetPtr collectAllDeviceResults(SharedKernelContext &shared_context, const RelAlgExecutionUnit &ra_exe_unit, const QueryMemoryDescriptor &query_mem_desc, const ExecutorDeviceType device_type, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner)
ResultSetPtr collectAllDeviceShardedTopResults(SharedKernelContext &shared_context, const RelAlgExecutionUnit &ra_exe_unit) const
std::unordered_map<int, const Analyzer::BinOper *> getInnerTabIdToJoinCond() const
std::vector<std::unique_ptr<ExecutionKernel>> createKernels(SharedKernelContext &shared_context, const RelAlgExecutionUnit &ra_exe_unit, ColumnFetcher &column_fetcher, const std::vector<InputTableInfo> &table_infos, const ExecutionOptions &eo, const bool is_agg, const bool allow_single_frag_table_opt, const size_t context_count, const QueryCompilationDescriptor &query_comp_desc, const QueryMemoryDescriptor &query_mem_desc, RenderInfo *render_info, std::unordered_set<int> &available_gpus, int &available_cpus)

Determines execution dispatch mode and required fragments for a given query step, then creates kernels to execute the query and returns them for launch.

void launchKernels(SharedKernelContext &shared_context, std::vector<std::unique_ptr<ExecutionKernel>> &&kernels, const ExecutorDeviceType device_type)

Launches execution kernels created by createKernels asynchronously using a thread pool.

std::vector<size_t> getTableFragmentIndices(const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType device_type, const size_t table_idx, const size_t outer_frag_idx, std::map<int, const TableFragments *> &selected_tables_fragments, const std::unordered_map<int, const Analyzer::BinOper *> &inner_table_id_to_join_condition)
bool skipFragmentPair(const Fragmenter_Namespace::FragmentInfo &outer_fragment_info, const Fragmenter_Namespace::FragmentInfo &inner_fragment_info, const int inner_table_id, const std::unordered_map<int, const Analyzer::BinOper *> &inner_table_id_to_join_condition, const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType device_type)
FetchResult fetchChunks(const ColumnFetcher &column_fetcher, const RelAlgExecutionUnit &ra_exe_unit, const int device_id, const Data_Namespace::MemoryLevel memory_level, const std::map<int, const TableFragments *> &all_tables_fragments, const FragmentsList &selected_fragments, const Catalog_Namespace::Catalog &cat, std::list<ChunkIter> &chunk_iterators, std::list<std::shared_ptr<Chunk_NS::Chunk>> &chunks, DeviceAllocator *device_allocator, const size_t thread_idx, const bool allow_runtime_interrupt)
FetchResult fetchUnionChunks(const ColumnFetcher &column_fetcher, const RelAlgExecutionUnit &ra_exe_unit, const int device_id, const Data_Namespace::MemoryLevel memory_level, const std::map<int, const TableFragments *> &all_tables_fragments, const FragmentsList &selected_fragments, const Catalog_Namespace::Catalog &cat, std::list<ChunkIter> &chunk_iterators, std::list<std::shared_ptr<Chunk_NS::Chunk>> &chunks, DeviceAllocator *device_allocator, const size_t thread_idx, const bool allow_runtime_interrupt)
std::pair<std::vector<std::vector<int64_t>>, std::vector<std::vector<uint64_t>>> getRowCountAndOffsetForAllFrags(const RelAlgExecutionUnit &ra_exe_unit, const CartesianProduct<std::vector<std::vector<size_t>>> &frag_ids_crossjoin, const std::vector<InputDescriptor> &input_descs, const std::map<int, const TableFragments *> &all_tables_fragments)
void buildSelectedFragsMapping(std::vector<std::vector<size_t>> &selected_fragments_crossjoin, std::vector<size_t> &local_col_to_frag_pos, const std::list<std::shared_ptr<const InputColDescriptor>> &col_global_ids, const FragmentsList &selected_fragments, const RelAlgExecutionUnit &ra_exe_unit)
void buildSelectedFragsMappingForUnion(std::vector<std::vector<size_t>> &selected_fragments_crossjoin, std::vector<size_t> &local_col_to_frag_pos, const std::list<std::shared_ptr<const InputColDescriptor>> &col_global_ids, const FragmentsList &selected_fragments, const RelAlgExecutionUnit &ra_exe_unit)
std::vector<size_t> getFragmentCount(const FragmentsList &selected_fragments, const size_t scan_idx, const RelAlgExecutionUnit &ra_exe_unit)
int32_t executePlanWithGroupBy(const RelAlgExecutionUnit &ra_exe_unit, const CompilationResult &compilation_result, const bool hoist_literals, ResultSetPtr *results, const ExecutorDeviceType device_type, std::vector<std::vector<const int8_t *>> &col_buffers, const std::vector<size_t> outer_tab_frag_ids, QueryExecutionContext *query_exe_context, const std::vector<std::vector<int64_t>> &num_rows, const std::vector<std::vector<uint64_t>> &frag_offsets, Data_Namespace::DataMgr *data_mgr, const int device_id, const int outer_table_id, const int64_t limit, const uint32_t start_rowid, const uint32_t num_tables, const bool allow_runtime_interrupt, RenderInfo *render_info, const int64_t rows_to_process = -1)
int32_t executePlanWithoutGroupBy(const RelAlgExecutionUnit &ra_exe_unit, const CompilationResult &compilation_result, const bool hoist_literals, ResultSetPtr *results, const std::vector<Analyzer::Expr *> &target_exprs, const ExecutorDeviceType device_type, std::vector<std::vector<const int8_t *>> &col_buffers, QueryExecutionContext *query_exe_context, const std::vector<std::vector<int64_t>> &num_rows, const std::vector<std::vector<uint64_t>> &frag_offsets, Data_Namespace::DataMgr *data_mgr, const int device_id, const uint32_t start_rowid, const uint32_t num_tables, const bool allow_runtime_interrupt, RenderInfo *render_info, const int64_t rows_to_process = -1)
ResultSetPtr resultsUnion(SharedKernelContext &shared_context, const RelAlgExecutionUnit &ra_exe_unit)
std::vector<int8_t *> getJoinHashTablePtrs(const ExecutorDeviceType device_type, const int device_id)
ResultSetPtr reduceMultiDeviceResults(const RelAlgExecutionUnit &ra_exe_unit, std::vector<std::pair<ResultSetPtr, std::vector<size_t>>> &all_fragment_results, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const QueryMemoryDescriptor &query_mem_desc) const
ResultSetPtr reduceMultiDeviceResultSets(std::vector<std::pair<ResultSetPtr, std::vector<size_t>>> &all_fragment_results, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const QueryMemoryDescriptor &query_mem_desc) const
ResultSetPtr reduceSpeculativeTopN(const RelAlgExecutionUnit &ra_exe_unit, std::vector<std::pair<ResultSetPtr, std::vector<size_t>>> &all_fragment_results, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const QueryMemoryDescriptor &query_mem_desc) const
ResultSetPtr executeWorkUnitImpl(size_t &max_groups_buffer_entry_guess, const bool is_agg, const bool allow_single_frag_table_opt, const std::vector<InputTableInfo> &query_infos, const RelAlgExecutionUnit &ra_exe_unit_in, const CompilationOptions &co, const ExecutionOptions &options, const Catalog_Namespace::Catalog &cat, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, RenderInfo *render_info, const bool has_cardinality_estimation, ColumnCacheMap &column_cache)
std::vector<llvm::Value *> inlineHoistedLiterals()
std::tuple<CompilationResult, std::unique_ptr<QueryMemoryDescriptor>> compileWorkUnit(const std::vector<InputTableInfo> &query_infos, const PlanState::DeletedColumnsMap &deleted_cols_map, const RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co, const ExecutionOptions &eo, const CudaMgr_Namespace::CudaMgr *cuda_mgr, const bool allow_lazy_fetch, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner, const size_t max_groups_buffer_entry_count, const int8_t crt_min_byte_width, const bool has_cardinality_estimation, ColumnCacheMap &column_cache, RenderInfo *render_info = nullptr)
llvm::BasicBlock *codegenSkipDeletedOuterTableRow(const RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co)
std::vector<JoinLoop> buildJoinLoops(RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co, const ExecutionOptions &eo, const std::vector<InputTableInfo> &query_infos, ColumnCacheMap &column_cache)
JoinLoop::HoistedFiltersCallback buildHoistLeftHandSideFiltersCb(const RelAlgExecutionUnit &ra_exe_unit, const size_t level_idx, const int inner_table_id, const CompilationOptions &co)
std::function<llvm::Value *(const std::vector<llvm::Value *>&, llvm::Value *)> buildIsDeletedCb(const RelAlgExecutionUnit &ra_exe_unit, const size_t level_idx, const CompilationOptions &co)
std::shared_ptr<HashJoin> buildCurrentLevelHashTable(const JoinCondition &current_level_join_conditions, size_t level_idx, RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co, const std::vector<InputTableInfo> &query_infos, ColumnCacheMap &column_cache, std::vector<std::string> &fail_reasons)
void redeclareFilterFunction()
llvm::Value *addJoinLoopIterator(const std::vector<llvm::Value *> &prev_iters, const size_t level_idx)
void codegenJoinLoops(const std::vector<JoinLoop> &join_loops, const RelAlgExecutionUnit &ra_exe_unit, GroupByAndAggregate &group_by_and_aggregate, llvm::Function *query_func, llvm::BasicBlock *entry_bb, QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, const ExecutionOptions &eo)
bool compileBody(const RelAlgExecutionUnit &ra_exe_unit, GroupByAndAggregate &group_by_and_aggregate, QueryMemoryDescriptor &query_mem_desc, const CompilationOptions &co, const GpuSharedMemoryContext &gpu_smem_context = {})
void createErrorCheckControlFlow(llvm::Function *query_func, bool run_with_dynamic_watchdog, bool run_with_allowing_runtime_interrupt, ExecutorDeviceType device_type, const std::vector<InputTableInfo> &input_table_infos)
void insertErrorCodeChecker(llvm::Function *query_func, bool hoist_literals, bool allow_runtime_query_interrupt)
void preloadFragOffsets(const std::vector<InputDescriptor> &input_descs, const std::vector<InputTableInfo> &query_infos)
Executor::JoinHashTableOrError buildHashTableForQualifier(const std::shared_ptr<Analyzer::BinOper> &qual_bin_oper, const std::vector<InputTableInfo> &query_infos, const MemoryLevel memory_level, const JoinType join_type, const HashType preferred_hash_type, ColumnCacheMap &column_cache, const HashTableBuildDagMap &hashtable_build_dag_map, const RegisteredQueryHint &query_hint, const TableIdToNodeMap &table_id_to_node_map)
void nukeOldState(const bool allow_lazy_fetch, const std::vector<InputTableInfo> &query_infos, const PlanState::DeletedColumnsMap &deleted_cols_map, const RelAlgExecutionUnit *ra_exe_unit)
std::shared_ptr<CompilationContext> optimizeAndCodegenCPU(llvm::Function *query_func, llvm::Function *multifrag_query_func, const std::unordered_set<llvm::Function *> &live_funcs, const CompilationOptions &co)
std::shared_ptr<CompilationContext> optimizeAndCodegenGPU(llvm::Function *query_func, llvm::Function *multifrag_query_func, std::unordered_set<llvm::Function *> &live_funcs, const bool no_inline, const CudaMgr_Namespace::CudaMgr *cuda_mgr, const bool is_gpu_smem_used, const CompilationOptions &co)
std::string generatePTX(const std::string &cuda_llir) const
void initializeNVPTXBackend() const
int64_t deviceCycles(int milliseconds) const
Executor::GroupColLLVMValue groupByColumnCodegen(Analyzer::Expr *group_by_col, const size_t col_width, const CompilationOptions &co, const bool translate_null_val, const int64_t translated_null_val, DiamondCodegen &diamond_codegen, std::stack<llvm::BasicBlock *> &array_loops, const bool thread_mem_shared)
llvm::Value *castToFP(llvm::Value *value, SQLTypeInfo const &from_ti, SQLTypeInfo const &to_ti)
llvm::Value *castToIntPtrTyIn(llvm::Value *val, const size_t bit_width)
std::tuple<RelAlgExecutionUnit, PlanState::DeletedColumnsMap> addDeletedColumn(const RelAlgExecutionUnit &ra_exe_unit, const CompilationOptions &co)
bool isFragmentFullyDeleted(const int table_id, const Fragmenter_Namespace::FragmentInfo &fragment)
FragmentSkipStatus canSkipFragmentForFpQual(const Analyzer::BinOper *comp_expr, const Analyzer::ColumnVar *lhs_col, const Fragmenter_Namespace::FragmentInfo &fragment, const Analyzer::Constant *rhs_const) const
std::pair<bool, int64_t> skipFragment(const InputDescriptor &table_desc, const Fragmenter_Namespace::FragmentInfo &frag_info, const std::list<std::shared_ptr<Analyzer::Expr>> &simple_quals, const std::vector<uint64_t> &frag_offsets, const size_t frag_idx)
std::pair<bool, int64_t> skipFragmentInnerJoins(const InputDescriptor &table_desc, const RelAlgExecutionUnit &ra_exe_unit, const Fragmenter_Namespace::FragmentInfo &fragment, const std::vector<uint64_t> &frag_offsets, const size_t frag_idx)
AggregatedColRange computeColRangesCache(const std::unordered_set<PhysicalInput> &phys_inputs)
StringDictionaryGenerations computeStringDictionaryGenerations(const std::unordered_set<PhysicalInput> &phys_inputs)
TableGenerations computeTableGenerations(std::unordered_set<int> phys_table_ids)
std::vector<int8_t> serializeLiterals(const std::unordered_map<int, CgenState::LiteralValues> &literals, const int device_id)
const std::unique_ptr<llvm::Module> &get_extension_module(ExtModuleKinds kind) const
bool has_extension_module(ExtModuleKinds kind) const
llvm::Value *spillDoubleElement(llvm::Value *elem_val, llvm::Type *elem_ty)
ExecutorMutexHolder acquireExecuteMutex()

Private Members

const ExecutorId executor_id_
std::unique_ptr<llvm::LLVMContext> context_
std::unique_ptr<CgenState> cgen_state_
std::map<ExtModuleKinds, std::unique_ptr<llvm::Module>> extension_modules_
std::unique_ptr<PlanState> plan_state_
std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner_
std::mutex gpu_exec_mutex_[max_gpu_count]
std::atomic<bool> interrupted_
std::mutex str_dict_mutex_
std::unique_ptr<llvm::TargetMachine> nvptx_target_machine_
const unsigned block_size_x_
const unsigned grid_size_x_
const size_t max_gpu_slab_size_
const std::string debug_dir_
const std::string debug_file_
const Catalog_Namespace::Catalog *catalog_
Data_Namespace::DataMgr *data_mgr_
const TemporaryTables *temporary_tables_
TableIdToNodeMap table_id_to_node_map_
int64_t kernel_queue_time_ms_ = 0
int64_t compilation_queue_time_ms_ = 0
std::unique_ptr<WindowProjectNodeContext> window_project_node_context_owned_
WindowFunctionContext *active_window_function_ = {nullptr}
InputTableInfoCache input_table_info_cache_
AggregatedColRange agg_col_range_cache_
TableGenerations table_generations_
QuerySessionId current_query_session_

Private Static Functions

static size_t align(const size_t off_in, const size_t alignment)

Private Static Attributes

int const max_gpu_count = {16}
std::mutex gpu_active_modules_mutex_
uint32_t gpu_active_modules_device_mask_ = {0x0}
void *gpu_active_modules_
const size_t baseline_threshold{1000000}
const size_t code_cache_size = {1000}
mapd_shared_mutex executor_session_mutex_
InterruptFlagMap queries_interrupt_flag_
QuerySessionMap queries_session_map_
std::map<int, std::shared_ptr<Executor>> executors_
mapd_shared_mutex execute_mutex_
mapd_shared_mutex executors_cache_mutex_
QueryPlanDagCache query_plan_dag_cache_
mapd_shared_mutex recycler_mutex_
std::unordered_map<std::string, size_t> cardinality_cache_
ResultSetRecyclerHolder resultset_recycler_holder_
QueryPlanDAG latest_query_plan_extracted_ = {EMPTY_QUERY_PLAN}

Friends

friend Executor::BaselineJoinHashTable
friend Executor::CodeGenerator
friend Executor::ColumnFetcher
friend Executor::DiamondCodegen
friend Executor::ExecutionKernel
friend Executor::KernelSubtask
friend Executor::HashJoin
friend Executor::OverlapsJoinHashTable
friend Executor::RangeJoinHashTable
friend Executor::GroupByAndAggregate
friend Executor::QueryCompilationDescriptor
friend Executor::QueryMemoryDescriptor
friend Executor::QueryMemoryInitializer
friend Executor::QueryFragmentDescriptor
friend Executor::QueryExecutionContext
friend Executor::ResultSet
friend Executor::InValuesBitmap
friend Executor::StringDictionaryTranslationMgr
friend Executor::LeafAggregator
friend Executor::PerfectJoinHashTable
friend Executor::QueryRewriter
friend Executor::PendingExecutionClosure
friend Executor::RelAlgExecutor
friend Executor::TableOptimizer
friend Executor::TableFunctionCompilationContext
friend Executor::TableFunctionExecutionContext
friend Executor::TargetExprCodegenBuilder
friend Executor::TargetExprCodegen
friend Executor::WindowProjectNodeContext
class CgenStateManager

Public Functions

CgenStateManager(Executor &executor)
CgenStateManager(Executor &executor, const bool allow_lazy_fetch, const std::vector<InputTableInfo> &query_infos, const PlanState::DeletedColumnsMap &deleted_cols_map, const RelAlgExecutionUnit *ra_exe_unit)
~CgenStateManager()

Private Members

Executor &executor_
std::chrono::steady_clock::time_point lock_queue_clock_
std::lock_guard<std::mutex> lock_
std::unique_ptr<CgenState> cgen_state_
struct ExecutorMutexHolder

Public Members

mapd_shared_lock<mapd_shared_mutex> shared_lock
mapd_unique_lock<mapd_shared_mutex> unique_lock
class FetchCacheAnchor

Public Functions

FetchCacheAnchor(CgenState *cgen_state)
~FetchCacheAnchor()

Private Members

CgenState *cgen_state_
std::unordered_map<int, std::vector<llvm::Value *>> saved_fetch_cache
struct GroupColLLVMValue

Public Members

llvm::Value *translated_value
llvm::Value *original_value
struct JoinHashTableOrError

Public Members

std::shared_ptr<HashJoin> hash_table
std::string fail_reason