OmniSciDB  f632821e96
QueryCompilationDescriptor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 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 
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 
41  public:
43  : compilation_device_type_(ExecutorDeviceType::CPU)
44  , hoist_literals_(false)
45  , actual_min_byte_width_(MAX_BYTE_WIDTH_SUPPORTED) {}
46 
47  std::unique_ptr<QueryMemoryDescriptor> compile(
48  const size_t max_groups_buffer_entry_guess,
49  const int8_t crt_min_byte_width,
50  const bool has_cardinality_estimation,
51  const RelAlgExecutionUnit& ra_exe_unit,
52  const std::vector<InputTableInfo>& table_infos,
53  const PlanState::DeletedColumnsMap& deleted_cols_map,
54  const ColumnFetcher& column_fetcher,
55  const CompilationOptions& co,
56  const ExecutionOptions& eo,
57  RenderInfo* render_info,
58  Executor* executor);
59 
60  auto getCompilationResult() const { return compilation_result_; }
61 
62  std::string getIR() const {
63  switch (compilation_device_type_) {
65  return std::string{"IR for the CPU:\n===============\n" +
66  compilation_result_.llvm_ir};
67  }
69  return std::string{"IR for the GPU:\n===============\n" +
70  compilation_result_.llvm_ir};
71  }
72  }
73  UNREACHABLE();
74  return "";
75  }
76 
77  ExecutorDeviceType getDeviceType() const { return compilation_device_type_; }
78  bool hoistLiterals() const { return hoist_literals_; }
79  int8_t getMinByteWidth() const { return actual_min_byte_width_; }
80 
81  private:
86 };
ExecutorDeviceType
GpuSharedMemoryContext gpu_smem_context
#define UNREACHABLE()
Definition: Logger.h:241
std::unordered_map< TableId, const ColumnDescriptor * > DeletedColumnsMap
Definition: PlanState.h:44
ExecutorDeviceType getDeviceType() const
std::shared_ptr< CompilationContext > generated_code
std::unordered_map< int, CgenState::LiteralValues > literal_values
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED