OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ExecutionKernel.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "Logger/Logger.h"
22 
24  public:
25  SharedKernelContext(const std::vector<InputTableInfo>& query_infos)
26  : query_infos_(query_infos) {}
27 
28  const std::vector<uint64_t>& getFragOffsets();
29 
30  void addDeviceResults(ResultSetPtr&& device_results,
31  std::vector<size_t> outer_table_fragment_ids);
32 
33  std::vector<std::pair<ResultSetPtr, std::vector<size_t>>>& getFragmentResults();
34 
35  const std::vector<InputTableInfo>& getQueryInfos() const { return query_infos_; }
36 
37  std::atomic_flag dynamic_watchdog_set = ATOMIC_FLAG_INIT;
38 
39  private:
40  std::mutex reduce_mutex_;
41  std::vector<std::pair<ResultSetPtr, std::vector<size_t>>> all_fragment_results_;
42 
43  std::vector<uint64_t> all_frag_row_offsets_;
45  const std::vector<InputTableInfo>& query_infos_;
46 };
47 
49  public:
52  int chosen_device_id,
53  const ExecutionOptions& eo,
57  const FragmentsList& frag_list,
59  RenderInfo* render_info,
60  const int64_t rowid_lookup_key)
61  : ra_exe_unit_(ra_exe_unit)
62  , chosen_device_type(chosen_device_type)
63  , chosen_device_id(chosen_device_id)
64  , eo(eo)
65  , column_fetcher(column_fetcher)
66  , query_comp_desc(query_comp_desc)
67  , query_mem_desc(query_mem_desc)
68  , frag_list(frag_list)
69  , kernel_dispatch_mode(kernel_dispatch_mode)
70  , render_info_(render_info)
71  , rowid_lookup_key(rowid_lookup_key) {}
72 
73  void run(Executor* executor, SharedKernelContext& shared_context);
74 
75  private:
86  const int64_t rowid_lookup_key;
87 
89 
90  void runImpl(Executor* executor, SharedKernelContext& shared_context);
91 };
std::atomic_flag dynamic_watchdog_set
const ExecutionOptions & eo
const std::vector< uint64_t > & getFragOffsets()
ExecutorDeviceType
const ExecutorDispatchMode kernel_dispatch_mode
const RelAlgExecutionUnit & ra_exe_unit_
std::vector< uint64_t > all_frag_row_offsets_
const int64_t rowid_lookup_key
std::mutex all_frag_row_offsets_mutex_
void addDeviceResults(ResultSetPtr &&device_results, std::vector< size_t > outer_table_fragment_ids)
const ExecutorDeviceType chosen_device_type
void runImpl(Executor *executor, SharedKernelContext &shared_context)
std::shared_ptr< ResultSet > ResultSetPtr
RenderInfo * render_info_
Container for compilation results and assorted options for a single execution unit.
std::vector< FragmentsPerTable > FragmentsList
ExecutorDispatchMode
void run(Executor *executor, SharedKernelContext &shared_context)
const QueryMemoryDescriptor & query_mem_desc
const QueryCompilationDescriptor & query_comp_desc
std::vector< std::pair< ResultSetPtr, std::vector< size_t > > > all_fragment_results_
const FragmentsList frag_list
ExecutionKernel(const RelAlgExecutionUnit &ra_exe_unit, const ExecutorDeviceType chosen_device_type, int chosen_device_id, const ExecutionOptions &eo, const ColumnFetcher &column_fetcher, const QueryCompilationDescriptor &query_comp_desc, const QueryMemoryDescriptor &query_mem_desc, const FragmentsList &frag_list, const ExecutorDispatchMode kernel_dispatch_mode, RenderInfo *render_info, const int64_t rowid_lookup_key)
const std::vector< InputTableInfo > & getQueryInfos() const
ResultSetPtr device_results_
std::vector< std::pair< ResultSetPtr, std::vector< size_t > > > & getFragmentResults()
std::mutex reduce_mutex_
const std::vector< InputTableInfo > & query_infos_
SharedKernelContext(const std::vector< InputTableInfo > &query_infos)
const ColumnFetcher & column_fetcher