OmniSciDB  a47db9e897
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{TableFunctionExecutionContext.cpp} Namespace Reference

Enumerations

enum  {
  ERROR_BUFFER, COL_BUFFERS, INPUT_ROW_COUNT, OUTPUT_BUFFERS,
  OUTPUT_ROW_COUNT, KERNEL_PARAM_COUNT
}
 

Functions

template<typename T >
const int8_t * create_literal_buffer (T literal, const ExecutorDeviceType device_type, std::vector< std::unique_ptr< char[]>> &literals_owner, CudaAllocator *gpu_allocator)
 
size_t get_output_row_count (const TableFunctionExecutionUnit &exe_unit, size_t input_element_count)
 

Enumeration Type Documentation

Function Documentation

template<typename T >
const int8_t* anonymous_namespace{TableFunctionExecutionContext.cpp}::create_literal_buffer ( literal,
const ExecutorDeviceType  device_type,
std::vector< std::unique_ptr< char[]>> &  literals_owner,
CudaAllocator gpu_allocator 
)

Definition at line 28 of file TableFunctionExecutionContext.cpp.

References CudaAllocator::alloc(), CHECK(), CHECK_LE, CudaAllocator::copyToDevice(), CPU, GPU, and UNREACHABLE.

Referenced by TableFunctionExecutionContext::execute().

31  {
32  CHECK_LE(sizeof(T), sizeof(int64_t)); // pad to 8 bytes
33  switch (device_type) {
35  literals_owner.emplace_back(std::make_unique<char[]>(sizeof(int64_t)));
36  std::memcpy(literals_owner.back().get(), &literal, sizeof(T));
37  return reinterpret_cast<const int8_t*>(literals_owner.back().get());
38  }
40  CHECK(gpu_allocator);
41  const auto gpu_literal_buf_ptr = gpu_allocator->alloc(sizeof(int64_t));
42  gpu_allocator->copyToDevice(
43  gpu_literal_buf_ptr, reinterpret_cast<int8_t*>(&literal), sizeof(T));
44  return gpu_literal_buf_ptr;
45  }
46  }
47  UNREACHABLE();
48  return nullptr;
49 }
void copyToDevice(int8_t *device_dst, const int8_t *host_src, const size_t num_bytes) const override
#define UNREACHABLE()
Definition: Logger.h:234
static int8_t * alloc(Data_Namespace::DataMgr *data_mgr, const size_t num_bytes, const int device_id)
CHECK(cgen_state)
#define CHECK_LE(x, y)
Definition: Logger.h:201

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

size_t anonymous_namespace{TableFunctionExecutionContext.cpp}::get_output_row_count ( const TableFunctionExecutionUnit exe_unit,
size_t  input_element_count 
)

Definition at line 51 of file TableFunctionExecutionContext.cpp.

References TableFunctionExecutionUnit::output_buffer_multiplier.

Referenced by TableFunctionExecutionContext::launchCpuCode(), and TableFunctionExecutionContext::launchGpuCode().

52  {
53  size_t allocated_output_row_count = 0;
54  if (*exe_unit.output_buffer_multiplier) {
55  allocated_output_row_count = *exe_unit.output_buffer_multiplier * input_element_count;
56  } else {
57  throw std::runtime_error(
58  "Only row multiplier output buffer configuration is supported for table "
59  "functions.");
60  }
61  return allocated_output_row_count;
62 }
const std::optional< size_t > output_buffer_multiplier

+ Here is the caller graph for this function: