OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QueryMemoryInitializer.cpp File Reference
+ Include dependency graph for QueryMemoryInitializer.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{QueryMemoryInitializer.cpp}
 

Functions

void anonymous_namespace{QueryMemoryInitializer.cpp}::check_total_bitmap_memory (const QueryMemoryDescriptor &query_mem_desc)
 
int64_t * anonymous_namespace{QueryMemoryInitializer.cpp}::alloc_group_by_buffer (const size_t numBytes, RenderAllocatorMap *render_allocator_map, const size_t thread_idx, RowSetMemoryOwner *mem_owner)
 
int64_t anonymous_namespace{QueryMemoryInitializer.cpp}::get_consistent_frag_size (const std::vector< uint64_t > &frag_offsets)
 
std::vector< int64_t > anonymous_namespace{QueryMemoryInitializer.cpp}::get_consistent_frags_sizes (const std::vector< std::vector< uint64_t >> &frag_offsets)
 
std::vector< int64_t > anonymous_namespace{QueryMemoryInitializer.cpp}::get_consistent_frags_sizes (const std::vector< Analyzer::Expr * > &target_exprs, const std::vector< int64_t > &table_frag_sizes)
 
std::vector< std::vector
< int64_t > > 
anonymous_namespace{QueryMemoryInitializer.cpp}::get_col_frag_offsets (const std::vector< Analyzer::Expr * > &target_exprs, const std::vector< std::vector< uint64_t >> &table_frag_offsets)
 
int anonymous_namespace{QueryMemoryInitializer.cpp}::get_input_idx (RelAlgExecutionUnit const &ra_exe_unit, const shared::TableKey &outer_table_key)
 
 num_buffers_ (1)
 
 varlen_output_buffer_ (0)
 
 varlen_output_buffer_host_ptr_ (nullptr)
 
 count_distinct_bitmap_mem_ (0)
 
 count_distinct_bitmap_mem_bytes_ (0)
 
 count_distinct_bitmap_crt_ptr_ (nullptr)
 
 count_distinct_bitmap_host_mem_ (nullptr)
 
 device_allocator_ (device_allocator)
 
 thread_idx_ (0)
 
template<typename T >
int8_t * anonymous_namespace{QueryMemoryInitializer.cpp}::initColumnarBuffer (T *buffer_ptr, const T init_val, const uint32_t entry_count)
 
void anonymous_namespace{QueryMemoryInitializer.cpp}::eachAggregateTargetIdxOfType (std::vector< Analyzer::Expr * > const &target_exprs, SQLAgg const agg_type, std::function< void(Analyzer::AggExpr const *, size_t)> lambda)
 
void anonymous_namespace{QueryMemoryInitializer.cpp}::compact_projection_buffer_for_cpu_columnar (const QueryMemoryDescriptor &query_mem_desc, int8_t *projection_buffer, const size_t projection_count)
 

Variables

int64_t g_bitmap_memory_limit {8LL * 1000 * 1000 * 1000}
 
 query_mem_desc
 

Function Documentation

count_distinct_bitmap_crt_ptr_ ( nullptr  )
count_distinct_bitmap_host_mem_ ( nullptr  )
count_distinct_bitmap_mem_ ( )
count_distinct_bitmap_mem_bytes_ ( )
device_allocator_ ( device_allocator  )
num_buffers_ ( )

Referenced by thread_idx_().

+ Here is the caller graph for this function:

thread_idx_ ( )

Definition at line 356 of file QueryMemoryInitializer.cpp.

References align_to_int64(), anonymous_namespace{QueryMemoryInitializer.cpp}::alloc_group_by_buffer(), CHECK_EQ, anonymous_namespace{QueryMemoryInitializer.cpp}::get_col_frag_offsets(), anonymous_namespace{QueryMemoryInitializer.cpp}::get_consistent_frags_sizes(), num_buffers_(), query_mem_desc, and target_exprs_to_infos().

356  {
357  // Table functions output columnar, basically treat this as a projection
358  const auto& consistent_frag_sizes = get_consistent_frags_sizes(frag_offsets);
359  if (consistent_frag_sizes.empty()) {
360  // No fragments in the input, no underlying buffers will be needed.
361  return;
362  }
363 
364  const size_t num_columns =
365  query_mem_desc.getBufferColSlotCount(); // shouldn't we use getColCount() ???
366  size_t total_group_by_buffer_size{0};
367  for (size_t i = 0; i < num_columns; ++i) {
368  auto ti = exe_unit.target_exprs[i]->get_type_info();
369  if (ti.is_array()) {
370  // See TableFunctionManager.h for info regarding flatbuffer
371  // memory managment.
372  auto slot_idx = query_mem_desc.getSlotIndexForSingleSlotCol(i);
373  int64_t flatbuffer_size = query_mem_desc.getFlatBufferSize(slot_idx);
374  total_group_by_buffer_size =
375  align_to_int64(total_group_by_buffer_size + flatbuffer_size);
376  } else {
377  const size_t col_width = ti.get_size();
378  const size_t group_buffer_size = num_rows_ * col_width;
379  total_group_by_buffer_size =
380  align_to_int64(total_group_by_buffer_size + group_buffer_size);
381  }
382  }
383 
384  CHECK_EQ(num_buffers_, size_t(1));
385  auto group_by_buffer = alloc_group_by_buffer(
386  total_group_by_buffer_size, nullptr, thread_idx_, row_set_mem_owner.get());
387  group_by_buffers_.push_back(group_by_buffer);
388 
389  const auto column_frag_offsets =
390  get_col_frag_offsets(exe_unit.target_exprs, frag_offsets);
391  const auto column_frag_sizes =
392  get_consistent_frags_sizes(exe_unit.target_exprs, consistent_frag_sizes);
393  result_sets_.emplace_back(
394  new ResultSet(target_exprs_to_infos(exe_unit.target_exprs, query_mem_desc),
395  /*col_lazy_fetch_info=*/{},
396  col_buffers,
397  column_frag_offsets,
398  column_frag_sizes,
399  device_type,
400  device_id,
402  row_set_mem_owner_,
403  executor->blockSize(),
404  executor->gridSize()));
405  result_sets_.back()->allocateStorage(reinterpret_cast<int8_t*>(group_by_buffer),
406  init_agg_vals_);
407 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
num_buffers_(1)
std::vector< int64_t > get_consistent_frags_sizes(const std::vector< std::vector< uint64_t >> &frag_offsets)
static QueryMemoryDescriptor fixupQueryMemoryDescriptor(const QueryMemoryDescriptor &)
Definition: ResultSet.cpp:756
std::vector< TargetInfo > target_exprs_to_infos(const std::vector< Analyzer::Expr * > &targets, const QueryMemoryDescriptor &query_mem_desc)
int64_t * alloc_group_by_buffer(const size_t numBytes, RenderAllocatorMap *render_allocator_map, const size_t thread_idx, RowSetMemoryOwner *mem_owner)
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)
std::vector< std::vector< int64_t > > get_col_frag_offsets(const std::vector< Analyzer::Expr * > &target_exprs, const std::vector< std::vector< uint64_t >> &table_frag_offsets)

+ Here is the call graph for this function:

varlen_output_buffer_ ( )
varlen_output_buffer_host_ptr_ ( nullptr  )

Variable Documentation