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

Enumerations

enum  {
  MANAGER, ERROR_BUFFER, COL_BUFFERS, COL_SIZES,
  INPUT_STR_DICT_PROXIES, OUTPUT_BUFFERS, OUTPUT_STR_DICT_PROXIES, 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

anonymous enum
Enumerator
MANAGER 
ERROR_BUFFER 
COL_BUFFERS 
COL_SIZES 
INPUT_STR_DICT_PROXIES 
OUTPUT_BUFFERS 
OUTPUT_STR_DICT_PROXIES 
OUTPUT_ROW_COUNT 
KERNEL_PARAM_COUNT 

Definition at line 647 of file TableFunctionExecutionContext.cpp.

Function Documentation

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

Definition at line 32 of file TableFunctionExecutionContext.cpp.

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

Referenced by TableFunctionExecutionContext::execute().

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

+ 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 59 of file TableFunctionExecutionContext.cpp.

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

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

+ 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 92 of file TableFunctionExecutionContext.cpp.

References table_functions::TableFunction::getOutputRowSizeType(), table_functions::kConstant, table_functions::kPreFlightParameter, 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().

93  {
94  size_t allocated_output_row_count = 0;
95  switch (exe_unit.table_func.getOutputRowSizeType()) {
99  allocated_output_row_count = exe_unit.output_buffer_size_param;
100  break;
101  }
103  allocated_output_row_count =
104  exe_unit.output_buffer_size_param * input_element_count;
105  break;
106  }
108  allocated_output_row_count = input_element_count;
109  break;
110  }
111  default: {
112  UNREACHABLE();
113  }
114  }
115  return allocated_output_row_count;
116 }
const table_functions::TableFunction table_func
#define UNREACHABLE()
Definition: Logger.h:338
OutputBufferSizeType getOutputRowSizeType() const

+ Here is the call graph for this function:

+ Here is the caller graph for this function: