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

#include <BaselineHashTable.h>

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

Public Member Functions

 BaselineHashTable (MemoryLevel memory_level, BaselineHashTableEntryInfo hash_table_entry_info, Data_Namespace::DataMgr *data_mgr=nullptr, const int device_id=-1)
 
 ~BaselineHashTable () override
 
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
 
size_t getRowIdSize () const override
 
BaselineHashTableEntryInfo getHashTableEntryInfo () const
 
- Public Member Functions inherited from HashTable
virtual ~HashTable ()
 

Private Attributes

std::unique_ptr< int8_t[]> cpu_hash_table_buff_
 
Data_Namespace::AbstractBuffergpu_hash_table_buff_ {nullptr}
 
MemoryLevel memory_level_
 
BaselineHashTableEntryInfo hash_table_entry_info_
 
Data_Namespace::DataMgrdata_mgr_
 
const int device_id_
 

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 70 of file BaselineHashTable.h.

Constructor & Destructor Documentation

BaselineHashTable::BaselineHashTable ( MemoryLevel  memory_level,
BaselineHashTableEntryInfo  hash_table_entry_info,
Data_Namespace::DataMgr data_mgr = nullptr,
const int  device_id = -1 
)
inline

Definition at line 73 of file BaselineHashTable.h.

References CudaAllocator::allocGpuAbstractBuffer(), CHECK, CHECK_GE, BaselineHashTableEntryInfo::computeHashTableSize(), cpu_hash_table_buff_, data_mgr_, device_id_, HashTableEntryInfo::getHashTableLayout(), HashTableEntryInfo::getNumHashEntries(), HashTableEntryInfo::getNumKeys(), HashTableEntryInfo::getRowIdSizeInBytes(), gpu_hash_table_buff_, Data_Namespace::GPU_LEVEL, hash_table_entry_info_, memory_level_, OneToOne, UNREACHABLE, and VLOG.

77  : memory_level_(memory_level)
78  , hash_table_entry_info_(hash_table_entry_info)
79  , data_mgr_(data_mgr)
80  , device_id_(device_id) {
81  auto const hash_table_size = hash_table_entry_info.computeHashTableSize();
83 #ifdef HAVE_CUDA
87 #else
88  UNREACHABLE();
89 #endif
90  } else {
91  CHECK(!data_mgr_); // we do not need `data_mgr` for CPU hash table
92  cpu_hash_table_buff_.reset(new int8_t[hash_table_size]);
93  }
94  std::string device_str = memory_level_ == MemoryLevel::GPU_LEVEL ? "GPU" : "CPU";
95  std::string layout_str =
97  : "OneToMany";
98  std::ostringstream oss;
99  oss << "Initialize a " << device_str << " baseline hash table";
101  CHECK_GE(device_id, 0);
102  oss << " for device " << device_id_;
103  }
104  oss << " with join type " << layout_str << ", hash table size: " << hash_table_size
105  << " Bytes"
106  << ", # hash entries: " << hash_table_entry_info_.getNumHashEntries()
107  << ", # entries stored in the payload buffer: "
109  << ", rowid size: " << hash_table_entry_info_.getRowIdSizeInBytes() << " Bytes";
110  VLOG(1) << oss.str();
111  }
#define UNREACHABLE()
Definition: Logger.h:338
#define CHECK_GE(x, y)
Definition: Logger.h:306
Data_Namespace::DataMgr * data_mgr_
size_t computeHashTableSize() const override
HashType getHashTableLayout() const
Definition: HashTable.h:53
size_t getNumHashEntries() const
Definition: HashTable.h:50
std::unique_ptr< int8_t[]> cpu_hash_table_buff_
size_t getNumKeys() const
Definition: HashTable.h:51
BaselineHashTableEntryInfo hash_table_entry_info_
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
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:291
size_t getRowIdSizeInBytes() const
Definition: HashTable.h:52
#define VLOG(n)
Definition: Logger.h:388
MemoryLevel memory_level_

+ Here is the call graph for this function:

BaselineHashTable::~BaselineHashTable ( )
inlineoverride

Definition at line 113 of file BaselineHashTable.h.

References CHECK, data_mgr_, Data_Namespace::DataMgr::free(), and gpu_hash_table_buff_.

113  {
114 #ifdef HAVE_CUDA
115  if (gpu_hash_table_buff_) {
116  CHECK(data_mgr_);
118  }
119 #endif
120  }
Data_Namespace::DataMgr * data_mgr_
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_
#define CHECK(condition)
Definition: Logger.h:291
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:564

+ Here is the call graph for this function:

Member Function Documentation

int8_t* BaselineHashTable::getCpuBuffer ( )
inlineoverridevirtual

Implements HashTable.

Definition at line 130 of file BaselineHashTable.h.

References cpu_hash_table_buff_.

130  {
131  return cpu_hash_table_buff_.get();
132  }
std::unique_ptr< int8_t[]> cpu_hash_table_buff_
size_t BaselineHashTable::getEmittedKeysCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 140 of file BaselineHashTable.h.

References HashTableEntryInfo::getNumKeys(), and hash_table_entry_info_.

140  {
142  }
size_t getNumKeys() const
Definition: HashTable.h:51
BaselineHashTableEntryInfo hash_table_entry_info_

+ Here is the call graph for this function:

size_t BaselineHashTable::getEntryCount ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 137 of file BaselineHashTable.h.

References HashTableEntryInfo::getNumHashEntries(), and hash_table_entry_info_.

137  {
139  }
size_t getNumHashEntries() const
Definition: HashTable.h:50
BaselineHashTableEntryInfo hash_table_entry_info_

+ Here is the call graph for this function:

int8_t* BaselineHashTable::getGpuBuffer ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 122 of file BaselineHashTable.h.

References Data_Namespace::AbstractBuffer::getMemoryPtr(), and gpu_hash_table_buff_.

122  {
124  }
virtual int8_t * getMemoryPtr()=0
Data_Namespace::AbstractBuffer * gpu_hash_table_buff_

+ Here is the call graph for this function:

size_t BaselineHashTable::getHashTableBufferSize ( const ExecutorDeviceType  device_type) const
inlineoverridevirtual

Implements HashTable.

Definition at line 126 of file BaselineHashTable.h.

References BaselineHashTableEntryInfo::computeHashTableSize(), and hash_table_entry_info_.

126  {
128  }
size_t computeHashTableSize() const override
BaselineHashTableEntryInfo hash_table_entry_info_

+ Here is the call graph for this function:

BaselineHashTableEntryInfo BaselineHashTable::getHashTableEntryInfo ( ) const
inline

Definition at line 146 of file BaselineHashTable.h.

References hash_table_entry_info_.

146  {
147  return hash_table_entry_info_;
148  }
BaselineHashTableEntryInfo hash_table_entry_info_
HashType BaselineHashTable::getLayout ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 134 of file BaselineHashTable.h.

References HashTableEntryInfo::getHashTableLayout(), and hash_table_entry_info_.

134  {
136  }
HashType getHashTableLayout() const
Definition: HashTable.h:53
BaselineHashTableEntryInfo hash_table_entry_info_

+ Here is the call graph for this function:

size_t BaselineHashTable::getRowIdSize ( ) const
inlineoverridevirtual

Implements HashTable.

Definition at line 143 of file BaselineHashTable.h.

References HashTableEntryInfo::getRowIdSizeInBytes(), and hash_table_entry_info_.

143  {
145  }
BaselineHashTableEntryInfo hash_table_entry_info_
size_t getRowIdSizeInBytes() const
Definition: HashTable.h:52

+ Here is the call graph for this function:

Member Data Documentation

std::unique_ptr<int8_t[]> BaselineHashTable::cpu_hash_table_buff_
private

Definition at line 151 of file BaselineHashTable.h.

Referenced by BaselineHashTable(), and getCpuBuffer().

Data_Namespace::DataMgr* BaselineHashTable::data_mgr_
private

Definition at line 156 of file BaselineHashTable.h.

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

const int BaselineHashTable::device_id_
private

Definition at line 157 of file BaselineHashTable.h.

Referenced by BaselineHashTable().

Data_Namespace::AbstractBuffer* BaselineHashTable::gpu_hash_table_buff_ {nullptr}
private

Definition at line 152 of file BaselineHashTable.h.

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

MemoryLevel BaselineHashTable::memory_level_
private

Definition at line 154 of file BaselineHashTable.h.

Referenced by BaselineHashTable().


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