OmniSciDB  16c4e035a1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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:
31  TableFunctionCompilationContext(Executor* executor) : executor_(executor) {}
32 
33  // non-copyable
36  delete;
37 
38  std::shared_ptr<CompilationContext> compile(const TableFunctionExecutionUnit& exe_unit,
39  const CompilationOptions& co,
40  bool emit_only_preflight_fn);
41 
42  private:
44  bool is_gpu,
45  bool emit_only_preflight_fn);
47  const std::vector<llvm::Value*>& func_args,
48  llvm::BasicBlock* bb_exit,
49  llvm::Value* output_row_count_ptr,
50  bool emit_only_preflight_fn);
51  void generateGpuKernel();
52  bool passColumnsByValue(const TableFunctionExecutionUnit& exe_unit, bool is_gpu);
53 
54  std::shared_ptr<CompilationContext> finalize(const CompilationOptions& co,
55  bool emit_only_preflight_fn);
56 
57  llvm::Function* entry_point_func_;
58  llvm::Function* kernel_func_;
59  Executor* executor_;
60 };
void generateEntryPoint(const TableFunctionExecutionUnit &exe_unit, bool is_gpu, bool emit_only_preflight_fn)
std::shared_ptr< CompilationContext > finalize(const CompilationOptions &co, bool emit_only_preflight_fn)
void generateTableFunctionCall(const TableFunctionExecutionUnit &exe_unit, const std::vector< llvm::Value * > &func_args, llvm::BasicBlock *bb_exit, llvm::Value *output_row_count_ptr, bool emit_only_preflight_fn)
Executor(const ExecutorId id, Data_Namespace::DataMgr *data_mgr, const size_t block_size_x, const size_t grid_size_x, const size_t max_gpu_slab_size, const std::string &debug_dir, const std::string &debug_file)
Definition: Execute.cpp:158
TableFunctionCompilationContext & operator=(const TableFunctionCompilationContext &)=delete
bool passColumnsByValue(const TableFunctionExecutionUnit &exe_unit, bool is_gpu)
std::shared_ptr< CompilationContext > compile(const TableFunctionExecutionUnit &exe_unit, const CompilationOptions &co, bool emit_only_preflight_fn)
Execution unit for relational algebra. It&#39;s a low-level description of any relational algebra operati...