OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QueryCompilationDescriptor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, 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 
18 
19 #include "QueryEngine/Execute.h"
20 
21 std::unique_ptr<QueryMemoryDescriptor> QueryCompilationDescriptor::compile(
22  const size_t max_groups_buffer_entry_guess,
23  const int8_t crt_min_byte_width,
24  const bool has_cardinality_estimation,
25  const RelAlgExecutionUnit& ra_exe_unit,
26  const std::vector<InputTableInfo>& table_infos,
27  const PlanState::DeletedColumnsMap& deleted_cols_map,
28  const ColumnFetcher& column_fetcher,
29  const CompilationOptions& co,
30  const ExecutionOptions& eo,
31  RenderInfo* render_info,
32  Executor* executor) {
35  CHECK(executor);
36  std::unique_ptr<QueryMemoryDescriptor> query_mem_desc;
37  const auto data_mgr = executor->getDataMgr();
38  try {
39  std::tie(compilation_result_, query_mem_desc) = executor->compileWorkUnit(
40  table_infos,
41  deleted_cols_map,
42  ra_exe_unit,
43  co,
44  eo,
45  data_mgr->getCudaMgr(),
47  co.allow_lazy_fetch, // TODO(adb): remove param and just read from CO
48  executor->row_set_mem_owner_,
49  max_groups_buffer_entry_guess,
50  crt_min_byte_width,
51  has_cardinality_estimation,
52  column_fetcher.columnarized_table_cache_,
53  render_info);
54  } catch (const CompilationRetryNoLazyFetch& e) {
55  VLOG(1) << e.what();
56  if (executor->cgen_state_->module_) {
57  delete executor->cgen_state_->module_;
58  }
59  std::tie(compilation_result_, query_mem_desc) =
60  executor->compileWorkUnit(table_infos,
61  deleted_cols_map,
62  ra_exe_unit,
63  co,
64  eo,
65  data_mgr->getCudaMgr(),
66  false,
67  executor->row_set_mem_owner_,
68  max_groups_buffer_entry_guess,
69  crt_min_byte_width,
70  has_cardinality_estimation,
71  column_fetcher.columnarized_table_cache_,
72  render_info);
73  }
75  std::max(query_mem_desc->updateActualMinByteWidth(MAX_BYTE_WIDTH_SUPPORTED),
76  crt_min_byte_width);
77  return query_mem_desc;
78 }
std::unordered_map< shared::TableKey, const ColumnDescriptor * > DeletedColumnsMap
Definition: PlanState.h:44
bool g_enable_lazy_fetch
Definition: Execute.cpp:136
std::unique_ptr< QueryMemoryDescriptor > compile(const size_t max_groups_buffer_entry_guess, const int8_t crt_min_byte_width, const bool has_cardinality_estimation, const RelAlgExecutionUnit &ra_exe_unit, const std::vector< InputTableInfo > &table_infos, const PlanState::DeletedColumnsMap &deleted_cols_map, const ColumnFetcher &column_fetcher, const CompilationOptions &co, const ExecutionOptions &eo, RenderInfo *render_info, Executor *executor)
Container for compilation results and assorted options for a single execution unit.
ExecutorDeviceType device_type
#define CHECK(condition)
Definition: Logger.h:291
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED
ColumnCacheMap & columnarized_table_cache_
#define VLOG(n)
Definition: Logger.h:388