OmniSciDB  94e8789169
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Execute.h File Reference
#include "AggregatedColRange.h"
#include "BufferCompaction.h"
#include "CartesianProduct.h"
#include "CgenState.h"
#include "CodeCache.h"
#include "DateTimeUtils.h"
#include "Descriptors/QueryFragmentDescriptor.h"
#include "ExecutionKernel.h"
#include "GpuSharedMemoryContext.h"
#include "GroupByAndAggregate.h"
#include "LoopControlFlow/JoinLoop.h"
#include "NvidiaKernel.h"
#include "PlanState.h"
#include "RelAlgExecutionUnit.h"
#include "RelAlgTranslator.h"
#include "StringDictionaryGenerations.h"
#include "TableGenerations.h"
#include "TargetMetaInfo.h"
#include "WindowContext.h"
#include "QueryEngine/Descriptors/QueryCompilationDescriptor.h"
#include "QueryEngine/JoinHashTable/HashJoin.h"
#include "../Logger/Logger.h"
#include "../Shared/SystemParameters.h"
#include "../Shared/mapd_shared_mutex.h"
#include "../Shared/measure.h"
#include "../Shared/thread_count.h"
#include "../Shared/toString.h"
#include "../StringDictionary/LruCache.hpp"
#include "../StringDictionary/StringDictionary.h"
#include "../StringDictionary/StringDictionaryProxy.h"
#include "DataMgr/Chunk/Chunk.h"
#include "ThriftHandler/CommandLineOptions.h"
#include <llvm/IR/Function.h>
#include <llvm/IR/Value.h>
#include <llvm/Linker/Linker.h>
#include <llvm/Transforms/Utils/ValueMapper.h>
#include <rapidjson/document.h>
#include <algorithm>
#include <atomic>
#include <condition_variable>
#include <cstddef>
#include <cstdlib>
#include <deque>
#include <functional>
#include <limits>
#include <map>
#include <mutex>
#include <stack>
#include <unordered_map>
#include <unordered_set>
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  QuerySessionStatus
 
class  WatchdogException
 
class  CompilationRetryNoLazyFetch
 
class  CompilationRetryNewScanLimit
 
class  TooManyLiterals
 
class  CompilationRetryNoCompaction
 
class  QueryMustRunOnCpu
 
class  ParseIRError
 
class  SringConstInResultSet
 
class  UpdateLogForFragment
 
class  Executor
 
struct  Executor::JoinHashTableOrError
 
struct  Executor::GroupColLLVMValue
 
class  Executor::FetchCacheAnchor
 

Typedefs

using QueryCompilationDescriptorOwned = std::unique_ptr< QueryCompilationDescriptor >
 
using QueryMemoryDescriptorOwned = std::unique_ptr< QueryMemoryDescriptor >
 
using QuerySessionId = std::string
 
using CurrentQueryStatus = std::pair< QuerySessionId, std::string >
 
using InterruptFlagMap = std::map< QuerySessionId, bool >
 
using QuerySessionMap = std::map< const QuerySessionId, std::map< std::string, QuerySessionStatus >>
 
using RowDataProvider = Fragmenter_Namespace::RowDataProvider
 
using LLVMValueVector = std::vector< llvm::Value * >
 

Functions

void read_udf_gpu_module (const std::string &udf_ir_filename)
 
void read_udf_cpu_module (const std::string &udf_ir_filename)
 
bool is_udf_module_present (bool cpu_only=false)
 
void read_rt_udf_gpu_module (const std::string &udf_ir)
 
void read_rt_udf_cpu_module (const std::string &udf_ir)
 
bool is_rt_udf_module_present (bool cpu_only=false)
 
llvm::Value * get_arg_by_name (llvm::Function *func, const std::string &name)
 
uint32_t log2_bytes (const uint32_t bytes)
 
const ColumnDescriptorget_column_descriptor (const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
 
const Analyzer::Exprextract_cast_arg (const Analyzer::Expr *expr)
 
std::string numeric_type_name (const SQLTypeInfo &ti)
 
const ColumnDescriptorget_column_descriptor_maybe (const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
 
const ResultSetPtrget_temporary_table (const TemporaryTables *temporary_tables, const int table_id)
 
const SQLTypeInfo get_column_type (const int col_id, const int table_id, const ColumnDescriptor *cd, const TemporaryTables *temporary_tables)
 
template<typename PtrTy >
const ColumnarResultsrows_to_columnar_results (std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const PtrTy &result, const int number)
 
std::vector< Analyzer::Expr * > get_exprs_not_owned (const std::vector< std::shared_ptr< Analyzer::Expr >> &exprs)
 
const ColumnarResultscolumnarize_result (std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const ResultSetPtr &result, const int frag_id)
 
std::ostream & operator<< (std::ostream &, FetchResult const &)
 
std::string get_null_check_suffix (const SQLTypeInfo &lhs_ti, const SQLTypeInfo &rhs_ti)
 
bool is_unnest (const Analyzer::Expr *expr)
 
bool is_trivial_loop_join (const std::vector< InputTableInfo > &query_infos, const RelAlgExecutionUnit &ra_exe_unit)
 
std::unordered_set< int > get_available_gpus (const Catalog_Namespace::Catalog &cat)
 
size_t get_context_count (const ExecutorDeviceType device_type, const size_t cpu_count, const size_t gpu_count)
 
void register_buffer_with_executor_rsm (int64_t exec, int8_t *buffer)
 
const Analyzer::Exprremove_cast_to_int (const Analyzer::Expr *expr)
 

Typedef Documentation

using CurrentQueryStatus = std::pair<QuerySessionId, std::string>

Definition at line 79 of file Execute.h.

using InterruptFlagMap = std::map<QuerySessionId, bool>

Definition at line 80 of file Execute.h.

using LLVMValueVector = std::vector<llvm::Value*>

Definition at line 361 of file Execute.h.

Definition at line 75 of file Execute.h.

Definition at line 77 of file Execute.h.

using QuerySessionId = std::string

Definition at line 78 of file Execute.h.

using QuerySessionMap = std::map<const QuerySessionId, std::map<std::string, QuerySessionStatus>>

Definition at line 145 of file Execute.h.

Function Documentation

const ColumnarResults* columnarize_result ( std::shared_ptr< RowSetMemoryOwner row_set_mem_owner,
const ResultSetPtr result,
const int  frag_id 
)
inline

Definition at line 268 of file Execute.h.

References CHECK_EQ, INJECT_TIMER, and rows_to_columnar_results().

Referenced by ColumnFetcher::getOneColumnFragment(), and ColumnFetcher::getResultSetColumn().

271  {
273  CHECK_EQ(0, frag_id);
274  return rows_to_columnar_results(row_set_mem_owner, result, result->colCount());
275 }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
const ColumnarResults * rows_to_columnar_results(std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const PtrTy &result, const int number)
Definition: Execute.h:247
#define INJECT_TIMER(DESC)
Definition: measure.h:93
const ColumnarResults * columnarize_result(std::shared_ptr< RowSetMemoryOwner > row_set_mem_owner, const ResultSetPtr &result, const int frag_id)
Definition: Execute.h:268

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Analyzer::Expr* extract_cast_arg ( const Analyzer::Expr expr)
inline

Definition at line 197 of file Execute.h.

References kCAST.

Referenced by CodeGenerator::codegen(), CodeGenerator::createInValuesBitmap(), and anonymous_namespace{ExpressionRewrite.cpp}::OrToInVisitor::visitBinOper().

197  {
198  const auto cast_expr = dynamic_cast<const Analyzer::UOper*>(expr);
199  if (!cast_expr || cast_expr->get_optype() != kCAST) {
200  return expr;
201  }
202  return cast_expr->get_operand();
203 }
Definition: sqldefs.h:49

+ Here is the caller graph for this function:

llvm::Value* get_arg_by_name ( llvm::Function *  func,
const std::string &  name 
)
inline

Definition at line 162 of file Execute.h.

References CHECK, and setup::name.

Referenced by GroupByAndAggregate::codegen(), HashJoin::codegenHashTableLoad(), PerfectJoinHashTable::codegenHashTableLoad(), CodeGenerator::codegenHoistedConstantsLoads(), GroupByAndAggregate::codegenOutputSlot(), CodeGenerator::codegenRowId(), GroupByAndAggregate::getAdditionalLiteral(), and Executor::preloadFragOffsets().

162  {
163  for (auto& arg : func->args()) {
164  if (arg.getName() == name) {
165  return &arg;
166  }
167  }
168  CHECK(false);
169  return nullptr;
170 }
#define CHECK(condition)
Definition: Logger.h:197
string name
Definition: setup.py:44

+ Here is the caller graph for this function:

std::unordered_set<int> get_available_gpus ( const Catalog_Namespace::Catalog cat)

Definition at line 1028 of file Execute.cpp.

References CHECK_GT, Data_Namespace::DataMgr::getCudaMgr(), Catalog_Namespace::Catalog::getDataMgr(), CudaMgr_Namespace::CudaMgr::getDeviceCount(), and Data_Namespace::DataMgr::gpusPresent().

Referenced by Executor::executeWorkUnitImpl().

1028  {
1029  std::unordered_set<int> available_gpus;
1030  if (cat.getDataMgr().gpusPresent()) {
1031  int gpu_count = cat.getDataMgr().getCudaMgr()->getDeviceCount();
1032  CHECK_GT(gpu_count, 0);
1033  for (int gpu_id = 0; gpu_id < gpu_count; ++gpu_id) {
1034  available_gpus.insert(gpu_id);
1035  }
1036  }
1037  return available_gpus;
1038 }
CudaMgr_Namespace::CudaMgr * getCudaMgr() const
Definition: DataMgr.h:206
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:222
#define CHECK_GT(x, y)
Definition: Logger.h:209
int getDeviceCount() const
Definition: CudaMgr.h:86

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const ColumnDescriptor* get_column_descriptor ( const int  col_id,
const int  table_id,
const Catalog_Namespace::Catalog cat 
)
inline

Definition at line 187 of file Execute.h.

References CHECK, CHECK_GT, and Catalog_Namespace::Catalog::getMetadataForColumn().

Referenced by CodeGenerator::codegenColVar(), RelAlgExecutor::executeSimpleInsert(), get_column_descriptor_maybe(), Executor::getColLazyFetchInfo(), ColumnFetcher::getOneTableColumnFragment(), PlanState::isLazyFetchColumn(), RelAlgExecutor::isRowidLookup(), and Executor::skipFragment().

190  {
191  CHECK_GT(table_id, 0);
192  const auto col_desc = cat.getMetadataForColumn(table_id, col_id);
193  CHECK(col_desc);
194  return col_desc;
195 }
#define CHECK_GT(x, y)
Definition: Logger.h:209
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const ColumnDescriptor* get_column_descriptor_maybe ( const int  col_id,
const int  table_id,
const Catalog_Namespace::Catalog cat 
)
inline

Definition at line 216 of file Execute.h.

References CHECK, and get_column_descriptor().

Referenced by anonymous_namespace{GroupByAndAggregate.cpp}::expr_is_rowid(), PerfectJoinHashTable::fetchColumnsForDevice(), OverlapsJoinHashTable::fetchColumnsForDevice(), BaselineJoinHashTable::fetchColumnsForDevice(), Executor::getColumnDescriptor(), ColumnFetcher::getOneColumnFragment(), Executor::getPhysicalColumnDescriptor(), needs_dictionary_translation(), normalize_column_pair(), anonymous_namespace{QueryMemoryDescriptor.cpp}::target_expr_proj_indices(), and anonymous_namespace{Execute.cpp}::try_get_column_descriptor().

219  {
220  CHECK(table_id);
221  return table_id > 0 ? get_column_descriptor(col_id, table_id, cat) : nullptr;
222 }
#define CHECK(condition)
Definition: Logger.h:197
const ColumnDescriptor * get_column_descriptor(const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
Definition: Execute.h:187

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const SQLTypeInfo get_column_type ( const int  col_id,
const int  table_id,
const ColumnDescriptor cd,
const TemporaryTables temporary_tables 
)
inline

Definition at line 232 of file Execute.h.

References CHECK, CHECK_EQ, ColumnDescriptor::columnId, ColumnDescriptor::columnType, get_temporary_table(), and ColumnDescriptor::tableId.

Referenced by ColumnFetcher::getOneTableColumnFragment(), needs_dictionary_translation(), and normalize_column_pair().

235  {
236  CHECK(cd || temporary_tables);
237  if (cd) {
238  CHECK_EQ(col_id, cd->columnId);
239  CHECK_EQ(table_id, cd->tableId);
240  return cd->columnType;
241  }
242  const auto& temp = get_temporary_table(temporary_tables, table_id);
243  return temp->getColType(col_id);
244 }
#define CHECK_EQ(x, y)
Definition: Logger.h:205
const ResultSetPtr & get_temporary_table(const TemporaryTables *temporary_tables, const int table_id)
Definition: Execute.h:224
#define CHECK(condition)
Definition: Logger.h:197
SQLTypeInfo columnType

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t get_context_count ( const ExecutorDeviceType  device_type,
const size_t  cpu_count,
const size_t  gpu_count 
)

Definition at line 1040 of file Execute.cpp.

References GPU.

Referenced by Executor::executeWorkUnitImpl().

1042  {
1043  return device_type == ExecutorDeviceType::GPU ? gpu_count
1044  : static_cast<size_t>(cpu_count);
1045 }

+ Here is the caller graph for this function:

std::vector<Analyzer::Expr*> get_exprs_not_owned ( const std::vector< std::shared_ptr< Analyzer::Expr >> &  exprs)
inline

Definition at line 259 of file Execute.h.

Referenced by RelAlgExecutor::createFilterWorkUnit(), RelAlgExecutor::createProjectWorkUnit(), RelAlgExecutor::createTableFunctionWorkUnit(), RelAlgExecutor::createUnionWorkUnit(), and anonymous_namespace{RelAlgExecutor.cpp}::get_inputs_meta().

260  {
261  std::vector<Analyzer::Expr*> exprs_not_owned;
262  for (const auto& expr : exprs) {
263  exprs_not_owned.push_back(expr.get());
264  }
265  return exprs_not_owned;
266 }

+ Here is the caller graph for this function:

std::string get_null_check_suffix ( const SQLTypeInfo lhs_ti,
const SQLTypeInfo rhs_ti 
)
inline

Definition at line 1117 of file Execute.h.

References CHECK, and SQLTypeInfo::get_notnull().

Referenced by CodeGenerator::codegenCmp(), CodeGenerator::codegenDeciDiv(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenIntArith(), and CodeGenerator::codegenStrCmp().

1118  {
1119  if (lhs_ti.get_notnull() && rhs_ti.get_notnull()) {
1120  return "";
1121  }
1122  std::string null_check_suffix{"_nullable"};
1123  if (lhs_ti.get_notnull()) {
1124  CHECK(!rhs_ti.get_notnull());
1125  null_check_suffix += "_rhs";
1126  } else if (rhs_ti.get_notnull()) {
1127  CHECK(!lhs_ti.get_notnull());
1128  null_check_suffix += "_lhs";
1129  }
1130  return null_check_suffix;
1131 }
#define CHECK(condition)
Definition: Logger.h:197
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:318

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const ResultSetPtr& get_temporary_table ( const TemporaryTables temporary_tables,
const int  table_id 
)
inline

Definition at line 224 of file Execute.h.

References CHECK, and CHECK_LT.

Referenced by anonymous_namespace{ExternalExecutor.cpp}::create_table_schema(), RelAlgExecutor::executeDelete(), RelAlgExecutor::executeProject(), RelAlgExecutor::executeUpdate(), get_column_type(), ColumnFetcher::getOneColumnFragment(), and ColumnFetcher::getResultSetColumn().

225  {
226  CHECK_LT(table_id, 0);
227  const auto it = temporary_tables->find(table_id);
228  CHECK(it != temporary_tables->end());
229  return it->second;
230 }
#define CHECK_LT(x, y)
Definition: Logger.h:207
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the caller graph for this function:

bool is_rt_udf_module_present ( bool  cpu_only = false)

Definition at line 1666 of file NativeCodegen.cpp.

1666  {
1667  return (cpu_only || rt_udf_gpu_module != nullptr) && (rt_udf_cpu_module != nullptr);
1668 }
std::unique_ptr< llvm::Module > rt_udf_cpu_module
std::unique_ptr< llvm::Module > rt_udf_gpu_module
bool is_trivial_loop_join ( const std::vector< InputTableInfo > &  query_infos,
const RelAlgExecutionUnit ra_exe_unit 
)

Definition at line 1148 of file Execute.cpp.

References CHECK, g_trivial_loop_join_threshold, generate_TableFunctionsFactory_init::i, and RelAlgExecutionUnit::input_descs.

Referenced by anonymous_namespace{IRCodegen.cpp}::check_if_loop_join_is_allowed().

1149  {
1150  if (ra_exe_unit.input_descs.size() < 2) {
1151  return false;
1152  }
1153 
1154  // We only support loop join at the end of folded joins
1155  // where ra_exe_unit.input_descs.size() > 2 for now.
1156  const auto inner_table_id = ra_exe_unit.input_descs.back().getTableId();
1157 
1158  std::optional<size_t> inner_table_idx;
1159  for (size_t i = 0; i < query_infos.size(); ++i) {
1160  if (query_infos[i].table_id == inner_table_id) {
1161  inner_table_idx = i;
1162  break;
1163  }
1164  }
1165  CHECK(inner_table_idx);
1166  return query_infos[*inner_table_idx].info.getNumTuples() <=
1168 }
std::vector< InputDescriptor > input_descs
unsigned g_trivial_loop_join_threshold
Definition: Execute.cpp:83
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the caller graph for this function:

bool is_udf_module_present ( bool  cpu_only = false)

Definition at line 1662 of file NativeCodegen.cpp.

1662  {
1663  return (cpu_only || udf_gpu_module != nullptr) && (udf_cpu_module != nullptr);
1664 }
std::unique_ptr< llvm::Module > udf_gpu_module
std::unique_ptr< llvm::Module > udf_cpu_module
bool is_unnest ( const Analyzer::Expr expr)
inline

Definition at line 1133 of file Execute.h.

References Analyzer::UOper::get_optype(), and kUNNEST.

Referenced by CodeGenerator::codegen(), and CodeGenerator::codegenCmp().

1133  {
1134  return dynamic_cast<const Analyzer::UOper*>(expr) &&
1135  static_cast<const Analyzer::UOper*>(expr)->get_optype() == kUNNEST;
1136 }
SQLOps get_optype() const
Definition: Analyzer.h:370

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t log2_bytes ( const uint32_t  bytes)
inline

Definition at line 172 of file Execute.h.

Referenced by CodeGenerator::codegen(), GroupByAndAggregate::codegenAggArg(), CodeGenerator::codegenFunctionOperCastArgs(), CodeGenerator::codegenGeoArgs(), and Executor::groupByColumnCodegen().

172  {
173  switch (bytes) {
174  case 1:
175  return 0;
176  case 2:
177  return 1;
178  case 4:
179  return 2;
180  case 8:
181  return 3;
182  default:
183  abort();
184  }
185 }

+ Here is the caller graph for this function:

std::string numeric_type_name ( const SQLTypeInfo ti)
inline

Definition at line 205 of file Execute.h.

References CHECK, SQLTypeInfo::get_compression(), SQLTypeInfo::get_logical_size(), SQLTypeInfo::get_type(), SQLTypeInfo::is_boolean(), SQLTypeInfo::is_decimal(), SQLTypeInfo::is_fp(), SQLTypeInfo::is_integer(), SQLTypeInfo::is_string(), SQLTypeInfo::is_time(), SQLTypeInfo::is_timeinterval(), kDOUBLE, kENCODING_DICT, and to_string().

Referenced by TargetExprCodegen::codegenAggregate(), CodeGenerator::codegenCastBetweenIntTypes(), CodeGenerator::codegenCastBetweenIntTypesOverflowChecks(), CodeGenerator::codegenCastFromFp(), CodeGenerator::codegenCastToFp(), CodeGenerator::codegenDiv(), CodeGenerator::codegenFpArith(), CodeGenerator::codegenQualifierCmp(), CodeGenerator::codegenUMinus(), CodeGenerator::codgenAdjustFixedEncNull(), Executor::groupByColumnCodegen(), and anonymous_namespace{ArithmeticIR.cpp}::numeric_or_time_interval_type_name().

205  {
206  CHECK(ti.is_integer() || ti.is_decimal() || ti.is_boolean() || ti.is_time() ||
207  ti.is_fp() || (ti.is_string() && ti.get_compression() == kENCODING_DICT) ||
208  ti.is_timeinterval());
209  if (ti.is_integer() || ti.is_decimal() || ti.is_boolean() || ti.is_time() ||
210  ti.is_string() || ti.is_timeinterval()) {
211  return "int" + std::to_string(ti.get_logical_size() * 8) + "_t";
212  }
213  return ti.get_type() == kDOUBLE ? "double" : "float";
214 }
bool is_fp() const
Definition: sqltypes.h:482
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:311
bool is_time() const
Definition: sqltypes.h:484
std::string to_string(char const *&&v)
int get_logical_size() const
Definition: sqltypes.h:322
bool is_integer() const
Definition: sqltypes.h:480
bool is_timeinterval() const
Definition: sqltypes.h:489
bool is_boolean() const
Definition: sqltypes.h:485
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:319
#define CHECK(condition)
Definition: Logger.h:197
bool is_string() const
Definition: sqltypes.h:478
bool is_decimal() const
Definition: sqltypes.h:481

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::ostream& operator<< ( std::ostream &  ,
FetchResult const &   
)

Definition at line 2343 of file Execute.cpp.

References FetchResult::col_buffers, FetchResult::frag_offsets, FetchResult::num_rows, and shared::printContainer().

2343  {
2344  return os << "col_buffers" << shared::printContainer(fetch_result.col_buffers)
2345  << " num_rows" << shared::printContainer(fetch_result.num_rows)
2346  << " frag_offsets" << shared::printContainer(fetch_result.frag_offsets);
2347 }
PrintContainer< CONTAINER > printContainer(CONTAINER &container)
Definition: misc.h:64

+ Here is the call graph for this function:

void read_rt_udf_cpu_module ( const std::string &  udf_ir)

Definition at line 1723 of file NativeCodegen.cpp.

Referenced by DBHandler::register_runtime_extension_functions().

1723  {
1724  llvm::SMDiagnostic parse_error;
1725 
1726  auto buf =
1727  std::make_unique<llvm::MemoryBufferRef>(udf_ir_string, "Runtime UDF for CPU");
1728 
1729  rt_udf_cpu_module = llvm::parseIR(*buf, parse_error, getGlobalLLVMContext());
1730  if (!rt_udf_cpu_module) {
1731  LOG(IR) << "read_rt_udf_cpu_module:LLVM IR:\n" << udf_ir_string << "\nEnd of LLVM IR";
1732  throw_parseIR_error(parse_error);
1733  }
1734 }
std::unique_ptr< llvm::Module > rt_udf_cpu_module
#define LOG(tag)
Definition: Logger.h:188
void throw_parseIR_error(const llvm::SMDiagnostic &parse_error, std::string src="", const bool is_gpu=false)
llvm::LLVMContext & getGlobalLLVMContext()

+ Here is the caller graph for this function:

void read_rt_udf_gpu_module ( const std::string &  udf_ir)

Definition at line 1700 of file NativeCodegen.cpp.

Referenced by DBHandler::register_runtime_extension_functions().

1700  {
1701  llvm::SMDiagnostic parse_error;
1702 
1703  auto buf =
1704  std::make_unique<llvm::MemoryBufferRef>(udf_ir_string, "Runtime UDF for GPU");
1705 
1706  rt_udf_gpu_module = llvm::parseIR(*buf, parse_error, getGlobalLLVMContext());
1707  if (!rt_udf_gpu_module) {
1708  LOG(IR) << "read_rt_udf_gpu_module:NVVM IR:\n" << udf_ir_string << "\nEnd of NNVM IR";
1709  throw_parseIR_error(parse_error, "", /* is_gpu= */ true);
1710  }
1711 
1712  llvm::Triple gpu_triple(rt_udf_gpu_module->getTargetTriple());
1713  if (!gpu_triple.isNVPTX()) {
1714  LOG(IR) << "read_rt_udf_gpu_module:NVVM IR:\n" << udf_ir_string << "\nEnd of NNVM IR";
1715  LOG(WARNING) << "Expected triple nvptx64-nvidia-cuda for NVVM IR but got "
1716  << gpu_triple.str()
1717  << ". Executing runtime UDFs on GPU will be disabled.";
1718  rt_udf_gpu_module = nullptr;
1719  return;
1720  }
1721 }
#define LOG(tag)
Definition: Logger.h:188
std::unique_ptr< llvm::Module > rt_udf_gpu_module
void throw_parseIR_error(const llvm::SMDiagnostic &parse_error, std::string src="", const bool is_gpu=false)
llvm::LLVMContext & getGlobalLLVMContext()

+ Here is the caller graph for this function:

void read_udf_cpu_module ( const std::string &  udf_ir_filename)

Definition at line 1689 of file NativeCodegen.cpp.

Referenced by UdfCompiler::readCpuCompiledModule().

1689  {
1690  llvm::SMDiagnostic parse_error;
1691 
1692  llvm::StringRef file_name_arg(udf_ir_filename);
1693 
1694  udf_cpu_module = llvm::parseIRFile(file_name_arg, parse_error, getGlobalLLVMContext());
1695  if (!udf_cpu_module) {
1696  throw_parseIR_error(parse_error, udf_ir_filename);
1697  }
1698 }
void throw_parseIR_error(const llvm::SMDiagnostic &parse_error, std::string src="", const bool is_gpu=false)
std::unique_ptr< llvm::Module > udf_cpu_module
llvm::LLVMContext & getGlobalLLVMContext()

+ Here is the caller graph for this function:

void read_udf_gpu_module ( const std::string &  udf_ir_filename)

Definition at line 1670 of file NativeCodegen.cpp.

Referenced by UdfCompiler::readGpuCompiledModule().

1670  {
1671  llvm::SMDiagnostic parse_error;
1672 
1673  llvm::StringRef file_name_arg(udf_ir_filename);
1674  udf_gpu_module = llvm::parseIRFile(file_name_arg, parse_error, getGlobalLLVMContext());
1675 
1676  if (!udf_gpu_module) {
1677  throw_parseIR_error(parse_error, udf_ir_filename, /* is_gpu= */ true);
1678  }
1679 
1680  llvm::Triple gpu_triple(udf_gpu_module->getTargetTriple());
1681  if (!gpu_triple.isNVPTX()) {
1682  LOG(WARNING)
1683  << "Expected triple nvptx64-nvidia-cuda for NVVM IR of loadtime UDFs but got "
1684  << gpu_triple.str() << ". Disabling the NVVM IR module.";
1685  udf_gpu_module = nullptr;
1686  }
1687 }
std::unique_ptr< llvm::Module > udf_gpu_module
#define LOG(tag)
Definition: Logger.h:188
void throw_parseIR_error(const llvm::SMDiagnostic &parse_error, std::string src="", const bool is_gpu=false)
llvm::LLVMContext & getGlobalLLVMContext()

+ Here is the caller graph for this function:

void register_buffer_with_executor_rsm ( int64_t  exec,
int8_t *  buffer 
)

Definition at line 217 of file ExtensionsIR.cpp.

217  {
218  Executor* exec_ptr = reinterpret_cast<Executor*>(exec);
219  if (buffer != nullptr) {
220  exec_ptr->getRowSetMemoryOwner()->addVarlenBuffer(buffer);
221  }
222 }
const Analyzer::Expr* remove_cast_to_int ( const Analyzer::Expr expr)

Definition at line 538 of file ColumnIR.cpp.

References Analyzer::Expr::get_type_info(), and kCAST.

Referenced by anonymous_namespace{DateTimePlusRewrite.cpp}::get_dt_field(), and CodeGenerator::hashJoinLhs().

538  {
539  const auto uoper = dynamic_cast<const Analyzer::UOper*>(expr);
540  if (!uoper || uoper->get_optype() != kCAST) {
541  return nullptr;
542  }
543  const auto& target_ti = uoper->get_type_info();
544  if (!target_ti.is_integer()) {
545  return nullptr;
546  }
547  return uoper->get_operand();
548 }
Definition: sqldefs.h:49
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename PtrTy >
const ColumnarResults* rows_to_columnar_results ( std::shared_ptr< RowSetMemoryOwner row_set_mem_owner,
const PtrTy &  result,
const int  number 
)
inline

Definition at line 247 of file Execute.h.

References get_logical_type_info(), and generate_TableFunctionsFactory_init::i.

Referenced by columnarize_result().

250  {
251  std::vector<SQLTypeInfo> col_types;
252  for (size_t i = 0; i < result->colCount(); ++i) {
253  col_types.push_back(get_logical_type_info(result->getColType(i)));
254  }
255  return new ColumnarResults(row_set_mem_owner, *result, number, col_types);
256 }
SQLTypeInfo get_logical_type_info(const SQLTypeInfo &type_info)
Definition: sqltypes.h:893

+ Here is the call graph for this function:

+ Here is the caller graph for this function: