OmniSciDB  c1a53651b2
 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"
30 #include "QueryEngine/PlanState.h"
31 
33  std::shared_ptr<CompilationContext> generated_code;
34  std::unordered_map<int, CgenState::LiteralValues> literal_values;
36  std::string llvm_ir;
38 
39  public:
40  std::string toString() const {
41  auto result = ::typeName(this) + "{";
43  result += ", literal_values=" + ::toString(literal_values);
44  result += ", toString(output_columnar=" + ::toString(output_columnar);
45  result += ", llvm_ir='''\n" + ::toString(llvm_ir) + "\n'''";
47  result += "}";
48  return result;
49  };
50 };
51 
53  public:
58 
59  std::unique_ptr<QueryMemoryDescriptor> compile(
60  const size_t max_groups_buffer_entry_guess,
61  const int8_t crt_min_byte_width,
62  const bool has_cardinality_estimation,
63  const RelAlgExecutionUnit& ra_exe_unit,
64  const std::vector<InputTableInfo>& table_infos,
65  const PlanState::DeletedColumnsMap& deleted_cols_map,
66  const ColumnFetcher& column_fetcher,
67  const CompilationOptions& co,
68  const ExecutionOptions& eo,
69  RenderInfo* render_info,
70  Executor* executor);
71 
72  auto getCompilationResult() const { return compilation_result_; }
73 
74  std::string getIR() const {
75  switch (compilation_device_type_) {
77  return std::string{"IR for the CPU:\n===============\n" +
79  }
81  return std::string{"IR for the GPU:\n===============\n" +
83  }
84  }
85  UNREACHABLE();
86  return "";
87  }
88 
90  bool hoistLiterals() const { return hoist_literals_; }
91  int8_t getMinByteWidth() const { return actual_min_byte_width_; }
92 
93  std::string toString() const {
94  auto result = ::typeName(this) + "{";
99  result += "}";
100  return result;
101  };
102 
103  private:
108 };
ExecutorDeviceType getDeviceType() const
std::unordered_map< shared::TableKey, const ColumnDescriptor * > DeletedColumnsMap
Definition: PlanState.h:43
ExecutorDeviceType
GpuSharedMemoryContext gpu_smem_context
#define UNREACHABLE()
Definition: Logger.h:337
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)
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:103
bool g_enable_watchdog false
Definition: Execute.cpp:79
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED