OmniSciDB  b24e664e58
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TableFunctionCompilationContext.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 
17 #pragma once
18 
19 #include <llvm/ExecutionEngine/ExecutionEngine.h>
20 
21 #include <QueryEngine/CgenState.h>
22 #include <QueryEngine/CodeCache.h>
26 
27 class Executor;
28 
30  public:
32 
33  // non-copyable
36  delete;
37 
38  void compile(const TableFunctionExecutionUnit& exe_unit,
39  const CompilationOptions& co,
40  Executor* executor);
41 
42  using FuncPtr = int32_t (*)(const int8_t** input_cols,
43  const int64_t* input_row_count,
44  int64_t** out,
45  int64_t* output_row_count);
47 
48  CodeGenerator::GPUCode* getGpuCode() const { return gpu_code_.get(); }
49 
50  private:
51  void generateEntryPoint(const TableFunctionExecutionUnit& exe_unit);
52  void generateGpuKernel();
53  void finalize(const CompilationOptions& co, Executor* executor);
54 
55  std::unique_ptr<CgenState> cgen_state_;
56  std::unique_ptr<llvm::Module> module_;
57  ExecutionEngineWrapper own_execution_engine_; // TODO: remove and replace with cache
58  std::unique_ptr<CodeGenerator::GPUCode> gpu_code_;
59  llvm::Function* entry_point_func_;
60  llvm::Function* kernel_func_;
62 };
Executor(const int db_id, const size_t block_size_x, const size_t grid_size_x, const std::string &debug_dir, const std::string &debug_file,::QueryRenderer::QueryRenderManager *render_manager)
Definition: Execute.cpp:106
void generateEntryPoint(const TableFunctionExecutionUnit &exe_unit)
int32_t(*)(const int8_t **input_cols, const int64_t *input_row_count, int64_t **out, int64_t *output_row_count) FuncPtr
std::unique_ptr< llvm::Module > module_
CodeGenerator::GPUCode * getGpuCode() const
std::unique_ptr< CodeGenerator::GPUCode > gpu_code_
TableFunctionCompilationContext::FuncPtr getFuncPtr() const
void finalize(const CompilationOptions &co, Executor *executor)
TableFunctionCompilationContext & operator=(const TableFunctionCompilationContext &)=delete
Execution unit for relational algebra. It&#39;s a low-level description of any relational algebra operati...
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t ** out
void compile(const TableFunctionExecutionUnit &exe_unit, const CompilationOptions &co, Executor *executor)