OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QueryCompilationDescriptor.h
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 
24 #pragma once
25 
26 #include "QueryEngine/CgenState.h"
29 #include "QueryEngine/PlanState.h"
30 
31 class CompilationContext;
32 
34  std::shared_ptr<CompilationContext> generated_code;
35  std::unordered_map<int, CgenState::LiteralValues> literal_values;
37  std::string llvm_ir;
39 
40  public:
41  std::string toString() const {
42  auto result = ::typeName(this) + "{";
44  result += ", literal_values=" + ::toString(literal_values);
45  result += ", toString(output_columnar=" + ::toString(output_columnar);
46  result += ", llvm_ir='''\n" + ::toString(llvm_ir) + "\n'''";
48  result += "}";
49  return result;
50  };
51 };
52 
54  public:
59 
60  std::unique_ptr<QueryMemoryDescriptor> compile(
61  const size_t max_groups_buffer_entry_guess,
62  const int8_t crt_min_byte_width,
63  const bool has_cardinality_estimation,
64  const RelAlgExecutionUnit& ra_exe_unit,
65  const std::vector<InputTableInfo>& table_infos,
66  const PlanState::DeletedColumnsMap& deleted_cols_map,
67  const ColumnFetcher& column_fetcher,
68  const CompilationOptions& co,
69  const ExecutionOptions& eo,
70  RenderInfo* render_info,
71  Executor* executor);
72 
73  auto getCompilationResult() const { return compilation_result_; }
74 
75  std::string getIR() const {
76  switch (compilation_device_type_) {
78  return std::string{"IR for the CPU:\n===============\n" +
80  }
82  return std::string{"IR for the GPU:\n===============\n" +
84  }
85  }
86  UNREACHABLE();
87  return "";
88  }
89 
91  bool hoistLiterals() const { return hoist_literals_; }
92  int8_t getMinByteWidth() const { return actual_min_byte_width_; }
93 
94  std::string toString() const {
95  auto result = ::typeName(this) + "{";
100  result += "}";
101  return result;
102  };
103 
104  private:
109 };
ExecutorDeviceType getDeviceType() const
std::unordered_map< shared::TableKey, const ColumnDescriptor * > DeletedColumnsMap
Definition: PlanState.h:44
GpuSharedMemoryContext gpu_smem_context
#define UNREACHABLE()
Definition: Logger.h:338
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)
ExecutorDeviceType
std::string toString() const
std::shared_ptr< CompilationContext > generated_code
std::unordered_map< int, CgenState::LiteralValues > literal_values
std::string typeName(const T *v)
Definition: toString.h:106
bool g_enable_watchdog false
Definition: Execute.cpp:80
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED