OmniSciDB  a667adc9c8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BaselineHashTable Class Reference

#include <BaselineHashTable.h>

+ Inheritance diagram for BaselineHashTable:
+ Collaboration diagram for BaselineHashTable:

Public Member Functions

 BaselineHashTable (const Catalog_Namespace::Catalog *catalog, HashType layout, const size_t entry_count, const size_t emitted_keys_count, const size_t hash_table_size)
 
 BaselineHashTable (const Catalog_Namespace::Catalog *catalog, HashType layout, const size_t entry_count, const size_t emitted_keys_count, const size_t hash_table_size, const size_t device_id)
 
 ~BaselineHashTable ()
 
int8_t * getGpuBuffer () const override
 
size_t getHashTableBufferSize (const ExecutorDeviceType device_type) const override
 
int8_t * getCpuBuffer () override
 
HashType getLayout () const override
 
size_t getEntryCount () const override
 
size_t getEmittedKeysCount () const override
 
- Public Member Functions inherited from HashTable
virtual ~HashTable ()
 

Private Attributes

std::vector< int8_t > cpu_hash_table_buff_
 
Data_Namespace::AbstractBuffer
*gpu_hash_table_buff_ 
nullptr
 
const size_t device_id_
 
const Catalog_Namespace::Catalogcatalog_
 
HashType layout_
 
size_t entry_count_
 
size_t emitted_keys_count_
 

Additional Inherited Members

- Static Public Member Functions inherited from HashTable
static DecodedJoinHashBufferSet toSet (size_t key_component_count, size_t key_component_width, size_t entry_count, const int8_t *ptr1, const int8_t *ptr2, const int8_t *ptr3, const int8_t *ptr4, size_t buffer_size)
 Decode hash table into a std::set for easy inspection and validation. More...
 
static std::string toString (const std::string &type, const std::string &layout_type, size_t key_component_count, size_t key_component_width, size_t entry_count, const int8_t *ptr1, const int8_t *ptr2, const int8_t *ptr3, const int8_t *ptr4, size_t buffer_size, bool raw=false)
 Decode hash table into a human-readable string. More...
 

Detailed Description

Definition at line 27 of file BaselineHashTable.h.

Constructor & Destructor Documentation

BaselineHashTable::BaselineHashTable ( const Catalog_Namespace::Catalog catalog,
HashType  layout,
const size_t  entry_count,
const size_t  emitted_keys_count,
const size_t  hash_table_size 
)
inline

Definition at line 30 of file BaselineHashTable.h.

References cpu_hash_table_buff_.

35  : device_id_(0)
36  , catalog_(catalog)
37  , layout_(layout)
38  , entry_count_(entry_count)
39  , emitted_keys_count_(emitted_keys_count) {
40  cpu_hash_table_buff_.resize(hash_table_size);
41  }
const Catalog_Namespace::Catalog * catalog_
std::vector< int8_t > cpu_hash_table_buff_
const size_t device_id_
BaselineHashTable::BaselineHashTable ( const Catalog_Namespace::Catalog catalog,
HashType  layout,
const size_t  entry_count,
const size_t  emitted_keys_count,
const size_t  hash_table_size,
const size_t  device_id 
)
inline

Definition at line 44 of file BaselineHashTable.h.

References CudaAllocator::allocGpuAbstractBuffer(), catalog_, CHECK, device_id_, Catalog_Namespace::Catalog::getDataMgr(), and UNREACHABLE.

50  : device_id_(device_id)
51  , catalog_(catalog)
52  , layout_(layout)
53  , entry_count_(entry_count)
54  , emitted_keys_count_(emitted_keys_count) {
55 #ifdef HAVE_CUDA
56  CHECK(catalog_);
57  auto& data_mgr = catalog_->getDataMgr();
58  gpu_hash_table_buff_ =
59  CudaAllocator::allocGpuAbstractBuffer(&data_mgr, hash_table_size, device_id_);
60 #else
61  UNREACHABLE();
62 #endif
63  }
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:222
#define UNREACHABLE()
Definition: Logger.h:241
const Catalog_Namespace::Catalog * catalog_
const size_t device_id_
static Data_Namespace::AbstractBuffer * allocGpuAbstractBuffer(Data_Namespace::DataMgr *data_mgr, const size_t num_bytes, const int device_id)
#define CHECK(condition)
Definition: Logger.h:197

+ Here is the call graph for this function:

BaselineHashTable::~BaselineHashTable ( )
inline

Definition at line 65 of file BaselineHashTable.h.

References catalog_, CHECK, Data_Namespace::DataMgr::free(), and Catalog_Namespace::Catalog::getDataMgr().

65  {
66 #ifdef HAVE_CUDA
67  CHECK(catalog_);
68  auto& data_mgr = catalog_->getDataMgr();
69  if (gpu_hash_table_buff_) {
70  data_mgr.free(gpu_hash_table_buff_);
71  }
72 #endif
73  }
Data_Namespace::DataMgr & getDataMgr() const
Definition: Catalog.h:222
const Catalog_Namespace::Catalog * catalog_
#define CHECK(condition)
Definition: Logger.h:197
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:469

+ Here is the call graph for this function:

Member Function Documentation

int8_t* BaselineHashTable::getCpuBuffer ( )
inlineoverridevirtual

Implements HashTable.

Definition at line 88 of file BaselineHashTable.h.

References cpu_hash_table_buff_.

88  {
89  return reinterpret_cast<int8_t*>(cpu_hash_table_buff_.data());
90  }
std::vector< int8_t > cpu_hash_table_buff_
size_t BaselineHashTable::getEmittedKeysCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 94 of file BaselineHashTable.h.

References emitted_keys_count_.

94 { return emitted_keys_count_; }
size_t BaselineHashTable::getEntryCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 93 of file BaselineHashTable.h.

References entry_count_.

93 { return entry_count_; }
int8_t* BaselineHashTable::getGpuBuffer ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 75 of file BaselineHashTable.h.

75  {
76  return gpu_hash_table_buff_ ? gpu_hash_table_buff_->getMemoryPtr() : nullptr;
77  }
size_t BaselineHashTable::getHashTableBufferSize ( const ExecutorDeviceType  device_type) const
inlineoverridevirtual

Implements HashTable.

Definition at line 79 of file BaselineHashTable.h.

References CPU, and cpu_hash_table_buff_.

79  {
80  if (device_type == ExecutorDeviceType::CPU) {
81  return cpu_hash_table_buff_.size() *
82  sizeof(decltype(cpu_hash_table_buff_)::value_type);
83  } else {
84  return gpu_hash_table_buff_ ? gpu_hash_table_buff_->reservedSize() : 0;
85  }
86  }
std::vector< int8_t > cpu_hash_table_buff_
HashType BaselineHashTable::getLayout ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 92 of file BaselineHashTable.h.

References layout_.

92 { return layout_; }

Member Data Documentation

const Catalog_Namespace::Catalog* BaselineHashTable::catalog_
private

Definition at line 102 of file BaselineHashTable.h.

Referenced by BaselineHashTable(), and ~BaselineHashTable().

std::vector<int8_t> BaselineHashTable::cpu_hash_table_buff_
private

Definition at line 97 of file BaselineHashTable.h.

Referenced by BaselineHashTable(), getCpuBuffer(), and getHashTableBufferSize().

const size_t BaselineHashTable::device_id_
private

Definition at line 99 of file BaselineHashTable.h.

Referenced by BaselineHashTable().

size_t BaselineHashTable::emitted_keys_count_
private

Definition at line 106 of file BaselineHashTable.h.

Referenced by getEmittedKeysCount().

size_t BaselineHashTable::entry_count_
private

Definition at line 105 of file BaselineHashTable.h.

Referenced by getEntryCount().

HashType BaselineHashTable::layout_
private

Definition at line 104 of file BaselineHashTable.h.

Referenced by getLayout().

Data_Namespace::AbstractBuffer* gpu_hash_table_buff_ BaselineHashTable::nullptr
private

Definition at line 98 of file BaselineHashTable.h.


The documentation for this class was generated from the following file: