OmniSciDB  cde582ebc3
 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 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 
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, const CompilationOptions& co)
32  : executor_(executor), co_(co) {}
33 
34  // non-copyable
37  delete;
38 
39  std::shared_ptr<CompilationContext> compile(const TableFunctionExecutionUnit& exe_unit,
40  bool emit_only_preflight_fn);
41 
42  private:
44  bool emit_only_preflight_fn);
46  const std::vector<llvm::Value*>& func_args,
47  llvm::BasicBlock* bb_exit,
48  llvm::Value* output_row_count_ptr,
49  bool emit_only_preflight_fn);
51  const TableFunctionExecutionUnit& exe_unit,
52  const std::vector<std::pair<llvm::Value*, const SQLTypeInfo>>& columns_to_cast,
53  llvm::Value* mgr_ptr);
54  void generateGpuKernel();
55  bool passColumnsByValue(const TableFunctionExecutionUnit& exe_unit);
56 
57  std::shared_ptr<CompilationContext> finalize(bool emit_only_preflight_fn);
58 
59  llvm::Function* entry_point_func_;
60  llvm::Function* kernel_func_;
61  Executor* executor_;
63 };
void generateEntryPoint(const TableFunctionExecutionUnit &exe_unit, bool emit_only_preflight_fn)
bool passColumnsByValue(const TableFunctionExecutionUnit &exe_unit)
std::shared_ptr< CompilationContext > finalize(bool emit_only_preflight_fn)
void generateCastsForInputTypes(const TableFunctionExecutionUnit &exe_unit, const std::vector< std::pair< llvm::Value *, const SQLTypeInfo >> &columns_to_cast, llvm::Value *mgr_ptr)
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:244
TableFunctionCompilationContext(Executor *executor, const CompilationOptions &co)
TableFunctionCompilationContext & operator=(const TableFunctionCompilationContext &)=delete
std::shared_ptr< CompilationContext > compile(const TableFunctionExecutionUnit &exe_unit, bool emit_only_preflight_fn)
Execution unit for relational algebra. It&#39;s a low-level description of any relational algebra operati...