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

Enumerations

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

Functions

template<typename T >
const int8_t * create_literal_buffer (const T literal, const ExecutorDeviceType device_type, std::vector< std::unique_ptr< char[]>> &literals_owner, CudaAllocator *gpu_allocator)
 
template<>
const int8_t * create_literal_buffer (std::string *const 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 ( const literal,
const ExecutorDeviceType  device_type,
std::vector< std::unique_ptr< char[]>> &  literals_owner,
CudaAllocator gpu_allocator 
)

Definition at line 31 of file TableFunctionExecutionContext.cpp.

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

Referenced by TableFunctionExecutionContext::execute().

34  {
35  CHECK_LE(sizeof(T), sizeof(int64_t)); // pad to 8 bytes
36  switch (device_type) {
38  literals_owner.emplace_back(std::make_unique<char[]>(sizeof(int64_t)));
39  std::memcpy(literals_owner.back().get(), &literal, sizeof(T));
40  return reinterpret_cast<const int8_t*>(literals_owner.back().get());
41  }
43  CHECK(gpu_allocator);
44  const auto gpu_literal_buf_ptr = gpu_allocator->alloc(sizeof(int64_t));
45  gpu_allocator->copyToDevice(
46  gpu_literal_buf_ptr, reinterpret_cast<const int8_t*>(&literal), sizeof(T));
47  return gpu_literal_buf_ptr;
48  }
49  }
50  UNREACHABLE();
51  return nullptr;
52 }
void copyToDevice(int8_t *device_dst, const int8_t *host_src, const size_t num_bytes) const override
#define UNREACHABLE()
Definition: Logger.h:253
int8_t * alloc(const size_t num_bytes) override
#define CHECK_LE(x, y)
Definition: Logger.h:220
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 58 of file TableFunctionExecutionContext.cpp.

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

61  {
62  const int64_t string_size = literal->size();
63  const int64_t padded_string_size =
64  (string_size + 7) / 8 * 8; // round up to the next multiple of 8
65  switch (device_type) {
67  literals_owner.emplace_back(
68  std::make_unique<char[]>(sizeof(int64_t) + padded_string_size));
69  std::memcpy(literals_owner.back().get(), &string_size, sizeof(int64_t));
70  std::memcpy(
71  literals_owner.back().get() + sizeof(int64_t), literal->data(), string_size);
72  return reinterpret_cast<const int8_t*>(literals_owner.back().get());
73  }
75  CHECK(gpu_allocator);
76  const auto gpu_literal_buf_ptr =
77  gpu_allocator->alloc(sizeof(int64_t) + padded_string_size);
78  gpu_allocator->copyToDevice(gpu_literal_buf_ptr,
79  reinterpret_cast<const int8_t*>(&string_size),
80  sizeof(int64_t));
81  gpu_allocator->copyToDevice(gpu_literal_buf_ptr + sizeof(int64_t),
82  reinterpret_cast<const int8_t*>(literal->data()),
83  string_size);
84  return gpu_literal_buf_ptr;
85  }
86  }
87  UNREACHABLE();
88  return nullptr;
89 }
void copyToDevice(int8_t *device_dst, const int8_t *host_src, const size_t num_bytes) const override
#define UNREACHABLE()
Definition: Logger.h:253
int8_t * alloc(const size_t num_bytes) override
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call 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 91 of file TableFunctionExecutionContext.cpp.

References table_functions::TableFunction::getOutputRowSizeType(), table_functions::kConstant, table_functions::kTableFunctionSpecifiedParameter, table_functions::kUserSpecifiedConstantParameter, table_functions::kUserSpecifiedRowMultiplier, TableFunctionExecutionUnit::output_buffer_size_param, TableFunctionExecutionUnit::table_func, and UNREACHABLE.

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

92  {
93  size_t allocated_output_row_count = 0;
94  switch (exe_unit.table_func.getOutputRowSizeType()) {
97  allocated_output_row_count = exe_unit.output_buffer_size_param;
98  break;
99  }
101  allocated_output_row_count =
102  exe_unit.output_buffer_size_param * input_element_count;
103  break;
104  }
106  allocated_output_row_count = input_element_count;
107  break;
108  }
109  default: {
110  UNREACHABLE();
111  }
112  }
113  return allocated_output_row_count;
114 }
const table_functions::TableFunction table_func
#define UNREACHABLE()
Definition: Logger.h:253
OutputBufferSizeType getOutputRowSizeType() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function: