OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Execute.h File Reference
#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>
#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 "QueryEngine/AggregatedColRange.h"
#include "QueryEngine/BufferCompaction.h"
#include "QueryEngine/CartesianProduct.h"
#include "QueryEngine/CgenState.h"
#include "QueryEngine/CodeCache.h"
#include "QueryEngine/CompilationOptions.h"
#include "QueryEngine/DateTimeUtils.h"
#include "QueryEngine/Descriptors/QueryCompilationDescriptor.h"
#include "QueryEngine/Descriptors/QueryFragmentDescriptor.h"
#include "QueryEngine/ExecutionKernel.h"
#include "QueryEngine/GpuSharedMemoryContext.h"
#include "QueryEngine/GroupByAndAggregate.h"
#include "QueryEngine/JoinHashTable/HashJoin.h"
#include "QueryEngine/LoopControlFlow/JoinLoop.h"
#include "QueryEngine/NvidiaKernel.h"
#include "QueryEngine/PlanState.h"
#include "QueryEngine/RelAlgExecutionUnit.h"
#include "QueryEngine/RelAlgTranslator.h"
#include "QueryEngine/StringDictionaryGenerations.h"
#include "QueryEngine/TableGenerations.h"
#include "QueryEngine/TargetMetaInfo.h"
#include "QueryEngine/WindowContext.h"
#include "DataMgr/Chunk/Chunk.h"
#include "Logger/Logger.h"
#include "Shared/SystemParameters.h"
#include "Shared/funcannotations.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 "ThriftHandler/CommandLineOptions.h"
+ 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  StringConstInResultSet
 
struct  TableUpdateMetadata
 
class  UpdateLogForFragment
 
class  Executor
 
struct  Executor::JoinHashTableOrError
 
struct  Executor::GroupColLLVMValue
 
class  Executor::FetchCacheAnchor
 
struct  Executor::ExecutorMutexHolder
 

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 ColumnToFragmentsMap = std::map< const ColumnDescriptor *, std::set< int32_t >>
 
using TableToFragmentIds = std::map< int32_t, std::set< int32_t >>
 
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)
 
std::vector< Analyzer::Expr * > get_exprs_not_owned (const std::vector< std::shared_ptr< Analyzer::Expr >> &exprs)
 
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_constructed_point (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)
 
RUNTIME_EXPORT 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 ColumnToFragmentsMap = std::map<const ColumnDescriptor*, std::set<int32_t>>

Definition at line 307 of file Execute.h.

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

Definition at line 80 of file Execute.h.

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

Definition at line 81 of file Execute.h.

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

Definition at line 352 of file Execute.h.

Definition at line 76 of file Execute.h.

Definition at line 78 of file Execute.h.

using QuerySessionId = std::string

Definition at line 79 of file Execute.h.

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

Definition at line 150 of file Execute.h.

using TableToFragmentIds = std::map<int32_t, std::set<int32_t>>

Definition at line 308 of file Execute.h.

Function Documentation

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

Definition at line 202 of file Execute.h.

References kCAST.

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

202  {
203  const auto cast_expr = dynamic_cast<const Analyzer::UOper*>(expr);
204  if (!cast_expr || cast_expr->get_optype() != kCAST) {
205  return expr;
206  }
207  return cast_expr->get_operand();
208 }
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 167 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().

167  {
168  for (auto& arg : func->args()) {
169  if (arg.getName() == name) {
170  return &arg;
171  }
172  }
173  CHECK(false);
174  return nullptr;
175 }
string name
Definition: setup.in.py:72
#define CHECK(condition)
Definition: Logger.h:203

+ Here is the caller graph for this function:

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

Definition at line 1034 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().

1034  {
1035  std::unordered_set<int> available_gpus;
1036  if (cat.getDataMgr().gpusPresent()) {
1037  int gpu_count = cat.getDataMgr().getCudaMgr()->getDeviceCount();
1038  CHECK_GT(gpu_count, 0);
1039  for (int gpu_id = 0; gpu_id < gpu_count; ++gpu_id) {
1040  available_gpus.insert(gpu_id);
1041  }
1042  }
1043  return available_gpus;
1044 }
CudaMgr_Namespace::CudaMgr * getCudaMgr() const
Definition: DataMgr.h:207
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:223
#define CHECK_GT(x, y)
Definition: Logger.h:215
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 192 of file Execute.h.

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

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

195  {
196  CHECK_GT(table_id, 0);
197  const auto col_desc = cat.getMetadataForColumn(table_id, col_id);
198  CHECK(col_desc);
199  return col_desc;
200 }
#define CHECK_GT(x, y)
Definition: Logger.h:215
const ColumnDescriptor * getMetadataForColumn(int tableId, const std::string &colName) const
#define CHECK(condition)
Definition: Logger.h:203

+ 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 221 of file Execute.h.

References CHECK, and get_column_descriptor().

Referenced by anonymous_namespace{GroupByAndAggregate.cpp}::expr_is_rowid(), PerfectJoinHashTable::fetchColumnsForDevice(), BaselineJoinHashTable::fetchColumnsForDevice(), OverlapsJoinHashTable::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().

224  {
225  CHECK(table_id);
226  return table_id > 0 ? get_column_descriptor(col_id, table_id, cat) : nullptr;
227 }
#define CHECK(condition)
Definition: Logger.h:203
const ColumnDescriptor * get_column_descriptor(const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)
Definition: Execute.h:192

+ 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 237 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().

240  {
241  CHECK(cd || temporary_tables);
242  if (cd) {
243  CHECK_EQ(col_id, cd->columnId);
244  CHECK_EQ(table_id, cd->tableId);
245  return cd->columnType;
246  }
247  const auto& temp = get_temporary_table(temporary_tables, table_id);
248  return temp->getColType(col_id);
249 }
#define CHECK_EQ(x, y)
Definition: Logger.h:211
const ResultSetPtr & get_temporary_table(const TemporaryTables *temporary_tables, const int table_id)
Definition: Execute.h:229
#define CHECK(condition)
Definition: Logger.h:203
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 1046 of file Execute.cpp.

References GPU.

Referenced by Executor::executeWorkUnitImpl().

1048  {
1049  return device_type == ExecutorDeviceType::GPU ? gpu_count
1050  : static_cast<size_t>(cpu_count);
1051 }

+ 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 252 of file Execute.h.

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

253  {
254  std::vector<Analyzer::Expr*> exprs_not_owned;
255  for (const auto& expr : exprs) {
256  exprs_not_owned.push_back(expr.get());
257  }
258  return exprs_not_owned;
259 }

+ 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 1159 of file Execute.h.

References CHECK, and SQLTypeInfo::get_notnull().

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

1160  {
1161  if (lhs_ti.get_notnull() && rhs_ti.get_notnull()) {
1162  return "";
1163  }
1164  std::string null_check_suffix{"_nullable"};
1165  if (lhs_ti.get_notnull()) {
1166  CHECK(!rhs_ti.get_notnull());
1167  null_check_suffix += "_rhs";
1168  } else if (rhs_ti.get_notnull()) {
1169  CHECK(!lhs_ti.get_notnull());
1170  null_check_suffix += "_lhs";
1171  }
1172  return null_check_suffix;
1173 }
#define CHECK(condition)
Definition: Logger.h:203
HOST DEVICE bool get_notnull() const
Definition: sqltypes.h:321

+ 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 229 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().

230  {
231  CHECK_LT(table_id, 0);
232  const auto it = temporary_tables->find(table_id);
233  CHECK(it != temporary_tables->end());
234  return it->second;
235 }
#define CHECK_LT(x, y)
Definition: Logger.h:213
#define CHECK(condition)
Definition: Logger.h:203

+ Here is the caller graph for this function:

bool is_constructed_point ( const Analyzer::Expr expr)
inline

Definition at line 1180 of file Execute.h.

References Analyzer::UOper::get_operand(), and kCAST.

Referenced by anonymous_namespace{FromTableReordering.cpp}::get_join_qual_cost(), CodeGenerator::hashJoinLhs(), normalize_column_pair(), and rewrite_overlaps_conjunction().

1180  {
1181  auto uoper = dynamic_cast<const Analyzer::UOper*>(expr);
1182  auto oper = (uoper && uoper->get_optype() == kCAST) ? uoper->get_operand() : expr;
1183  auto arr = dynamic_cast<const Analyzer::ArrayExpr*>(oper);
1184  return (arr && arr->isLocalAlloc() && arr->get_type_info().is_fixlen_array());
1185 }
Definition: sqldefs.h:49
const Expr * get_operand() const
Definition: Analyzer.h:371

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool is_rt_udf_module_present ( bool  cpu_only = false)

Definition at line 1701 of file NativeCodegen.cpp.

1701  {
1702  return (cpu_only || rt_udf_gpu_module != nullptr) && (rt_udf_cpu_module != nullptr);
1703 }
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 1154 of file Execute.cpp.

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

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

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

+ Here is the caller graph for this function:

bool is_udf_module_present ( bool  cpu_only = false)

Definition at line 1697 of file NativeCodegen.cpp.

1697  {
1698  return (cpu_only || udf_gpu_module != nullptr) && (udf_cpu_module != nullptr);
1699 }
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 1175 of file Execute.h.

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

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

1175  {
1176  return dynamic_cast<const Analyzer::UOper*>(expr) &&
1177  static_cast<const Analyzer::UOper*>(expr)->get_optype() == kUNNEST;
1178 }
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 177 of file Execute.h.

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

177  {
178  switch (bytes) {
179  case 1:
180  return 0;
181  case 2:
182  return 1;
183  case 4:
184  return 2;
185  case 8:
186  return 3;
187  default:
188  abort();
189  }
190 }

+ Here is the caller graph for this function:

std::string numeric_type_name ( const SQLTypeInfo ti)
inline

Definition at line 210 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().

210  {
211  CHECK(ti.is_integer() || ti.is_decimal() || ti.is_boolean() || ti.is_time() ||
212  ti.is_fp() || (ti.is_string() && ti.get_compression() == kENCODING_DICT) ||
213  ti.is_timeinterval());
214  if (ti.is_integer() || ti.is_decimal() || ti.is_boolean() || ti.is_time() ||
215  ti.is_string() || ti.is_timeinterval()) {
216  return "int" + std::to_string(ti.get_logical_size() * 8) + "_t";
217  }
218  return ti.get_type() == kDOUBLE ? "double" : "float";
219 }
bool is_fp() const
Definition: sqltypes.h:493
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:314
bool is_time() const
Definition: sqltypes.h:495
std::string to_string(char const *&&v)
int get_logical_size() const
Definition: sqltypes.h:325
bool is_integer() const
Definition: sqltypes.h:491
bool is_timeinterval() const
Definition: sqltypes.h:500
bool is_boolean() const
Definition: sqltypes.h:496
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:322
#define CHECK(condition)
Definition: Logger.h:203
bool is_string() const
Definition: sqltypes.h:489
bool is_decimal() const
Definition: sqltypes.h:492

+ 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 2512 of file Execute.cpp.

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

2512  {
2513  return os << "col_buffers" << shared::printContainer(fetch_result.col_buffers)
2514  << " num_rows" << shared::printContainer(fetch_result.num_rows)
2515  << " frag_offsets" << shared::printContainer(fetch_result.frag_offsets);
2516 }
PrintContainer< CONTAINER > printContainer(CONTAINER &container)
Definition: misc.h:80

+ Here is the call graph for this function:

void read_rt_udf_cpu_module ( const std::string &  udf_ir)

Definition at line 1758 of file NativeCodegen.cpp.

Referenced by DBHandler::register_runtime_extension_functions().

1758  {
1759  llvm::SMDiagnostic parse_error;
1760 
1761  auto buf =
1762  std::make_unique<llvm::MemoryBufferRef>(udf_ir_string, "Runtime UDF for CPU");
1763 
1764  rt_udf_cpu_module = llvm::parseIR(*buf, parse_error, getGlobalLLVMContext());
1765  if (!rt_udf_cpu_module) {
1766  LOG(IR) << "read_rt_udf_cpu_module:LLVM IR:\n" << udf_ir_string << "\nEnd of LLVM IR";
1767  throw_parseIR_error(parse_error);
1768  }
1769 }
std::unique_ptr< llvm::Module > rt_udf_cpu_module
#define LOG(tag)
Definition: Logger.h:194
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 1735 of file NativeCodegen.cpp.

Referenced by DBHandler::register_runtime_extension_functions().

1735  {
1736  llvm::SMDiagnostic parse_error;
1737 
1738  auto buf =
1739  std::make_unique<llvm::MemoryBufferRef>(udf_ir_string, "Runtime UDF for GPU");
1740 
1741  rt_udf_gpu_module = llvm::parseIR(*buf, parse_error, getGlobalLLVMContext());
1742  if (!rt_udf_gpu_module) {
1743  LOG(IR) << "read_rt_udf_gpu_module:NVVM IR:\n" << udf_ir_string << "\nEnd of NNVM IR";
1744  throw_parseIR_error(parse_error, "", /* is_gpu= */ true);
1745  }
1746 
1747  llvm::Triple gpu_triple(rt_udf_gpu_module->getTargetTriple());
1748  if (!gpu_triple.isNVPTX()) {
1749  LOG(IR) << "read_rt_udf_gpu_module:NVVM IR:\n" << udf_ir_string << "\nEnd of NNVM IR";
1750  LOG(WARNING) << "Expected triple nvptx64-nvidia-cuda for NVVM IR but got "
1751  << gpu_triple.str()
1752  << ". Executing runtime UDFs on GPU will be disabled.";
1753  rt_udf_gpu_module = nullptr;
1754  return;
1755  }
1756 }
#define LOG(tag)
Definition: Logger.h:194
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 1724 of file NativeCodegen.cpp.

Referenced by UdfCompiler::readCpuCompiledModule().

1724  {
1725  llvm::SMDiagnostic parse_error;
1726 
1727  llvm::StringRef file_name_arg(udf_ir_filename);
1728 
1729  udf_cpu_module = llvm::parseIRFile(file_name_arg, parse_error, getGlobalLLVMContext());
1730  if (!udf_cpu_module) {
1731  throw_parseIR_error(parse_error, udf_ir_filename);
1732  }
1733 }
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 1705 of file NativeCodegen.cpp.

Referenced by UdfCompiler::readGpuCompiledModule().

1705  {
1706  llvm::SMDiagnostic parse_error;
1707 
1708  llvm::StringRef file_name_arg(udf_ir_filename);
1709  udf_gpu_module = llvm::parseIRFile(file_name_arg, parse_error, getGlobalLLVMContext());
1710 
1711  if (!udf_gpu_module) {
1712  throw_parseIR_error(parse_error, udf_ir_filename, /* is_gpu= */ true);
1713  }
1714 
1715  llvm::Triple gpu_triple(udf_gpu_module->getTargetTriple());
1716  if (!gpu_triple.isNVPTX()) {
1717  LOG(WARNING)
1718  << "Expected triple nvptx64-nvidia-cuda for NVVM IR of loadtime UDFs but got "
1719  << gpu_triple.str() << ". Disabling the NVVM IR module.";
1720  udf_gpu_module = nullptr;
1721  }
1722 }
std::unique_ptr< llvm::Module > udf_gpu_module
#define LOG(tag)
Definition: Logger.h:194
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:

RUNTIME_EXPORT void register_buffer_with_executor_rsm ( int64_t  exec,
int8_t *  buffer 
)

Definition at line 224 of file ExtensionsIR.cpp.

225  {
226  Executor* exec_ptr = reinterpret_cast<Executor*>(exec);
227  if (buffer != nullptr) {
228  exec_ptr->getRowSetMemoryOwner()->addVarlenBuffer(buffer);
229  }
230 }
const Analyzer::Expr* remove_cast_to_int ( const Analyzer::Expr expr)

Definition at line 537 of file ColumnIR.cpp.

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

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

537  {
538  const auto uoper = dynamic_cast<const Analyzer::UOper*>(expr);
539  if (!uoper || uoper->get_optype() != kCAST) {
540  return nullptr;
541  }
542  const auto& target_ti = uoper->get_type_info();
543  if (!target_ti.is_integer()) {
544  return nullptr;
545  }
546  return uoper->get_operand();
547 }
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: