ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::core::SlabHashBackend< Key, Hash, Eq > Class Template Reference

#include <SlabHashBackend.h>

Inheritance diagram for cloudViewer::core::SlabHashBackend< Key, Hash, Eq >:
Collaboration diagram for cloudViewer::core::SlabHashBackend< Key, Hash, Eq >:

Public Member Functions

 SlabHashBackend (int64_t init_capacity, int64_t key_dsize, const std::vector< int64_t > &value_dsizes, const Device &device)
 
 ~SlabHashBackend ()
 
void Reserve (int64_t capacity) override
 
void Insert (const void *input_keys, const std::vector< const void * > &input_values_soa, buf_index_t *output_buf_indices, bool *output_masks, int64_t count) override
 Parallel insert contiguous arrays of keys and values. More...
 
void Find (const void *input_keys, buf_index_t *output_buf_indices, bool *output_masks, int64_t count) override
 Parallel find a contiguous array of keys. More...
 
void Erase (const void *input_keys, bool *output_masks, int64_t count) override
 Parallel erase a contiguous array of keys. More...
 
int64_t GetActiveIndices (buf_index_t *output_indices) override
 Parallel collect all iterators in the hash table. More...
 
void Clear () override
 Clear stored map without reallocating memory. More...
 
int64_t Size () const override
 Get the size (number of valid entries) of the hash map. More...
 
int64_t GetBucketCount () const override
 Get the number of buckets of the hash map. More...
 
std::vector< int64_t > BucketSizes () const override
 Get the number of entries per bucket. More...
 
float LoadFactor () const override
 Get the current load factor, defined as size / bucket count. More...
 
SlabHashBackendImpl< Key, Hash, Eq > GetImpl ()
 
void Allocate (int64_t capacity) override
 
void Free () override
 
- Public Member Functions inherited from cloudViewer::core::DeviceHashBackend
 DeviceHashBackend (int64_t init_capacity, int64_t key_dsize, const std::vector< int64_t > &value_dsizes, const Device &device)
 
virtual ~DeviceHashBackend ()
 
int64_t GetCapacity () const
 Get the maximum capacity of the hash map. More...
 
Device GetDevice () const
 Get the current device. More...
 
Tensor GetKeyBuffer ()
 Get the key buffer that stores actual keys. More...
 
std::vector< TensorGetValueBuffers ()
 Get the value buffers that store actual array of values. More...
 
Tensor GetValueBuffer (size_t i=0)
 Get the i-th value buffer that store an actual value array. More...
 

Protected Attributes

SlabHashBackendImpl< Key, Hash, Eq > impl_
 
CUDAHashBackendBufferAccessor buffer_accessor_
 
std::shared_ptr< SlabNodeManagernode_mgr_
 
int64_t bucket_count_
 

Additional Inherited Members

- Public Attributes inherited from cloudViewer::core::DeviceHashBackend
int64_t capacity_
 
int64_t key_dsize_
 
std::vector< int64_t > value_dsizes_
 
Device device_
 
std::shared_ptr< HashBackendBufferbuffer_
 

Detailed Description

template<typename Key, typename Hash, typename Eq>
class cloudViewer::core::SlabHashBackend< Key, Hash, Eq >

Definition at line 20 of file SlabHashBackend.h.

Constructor & Destructor Documentation

◆ SlabHashBackend()

template<typename Key , typename Hash , typename Eq >
cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::SlabHashBackend ( int64_t  init_capacity,
int64_t  key_dsize,
const std::vector< int64_t > &  value_dsizes,
const Device device 
)

◆ ~SlabHashBackend()

template<typename Key , typename Hash , typename Eq >
cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::~SlabHashBackend

Definition at line 82 of file SlabHashBackend.h.

References cloudViewer::core::Free().

Member Function Documentation

◆ Allocate()

template<typename Key , typename Hash , typename Eq >
void cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Allocate ( int64_t  capacity)
overridevirtual

◆ BucketSizes()

template<typename Key , typename Hash , typename Eq >
std::vector< int64_t > cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::BucketSizes ( ) const
overridevirtual

◆ Clear()

template<typename Key , typename Hash , typename Eq >
void cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Clear ( )
overridevirtual

Clear stored map without reallocating memory.

Implements cloudViewer::core::DeviceHashBackend.

Definition at line 167 of file SlabHashBackend.h.

References CLOUDVIEWER_CUDA_CHECK, and cloudViewer::core::cuda::Synchronize().

◆ Erase()

template<typename Key , typename Hash , typename Eq >
void cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Erase ( const void *  input_keys,
bool *  output_masks,
int64_t  count 
)
overridevirtual

◆ Find()

template<typename Key , typename Hash , typename Eq >
void cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Find ( const void *  input_keys,
buf_index_t output_buf_indices,
bool *  output_masks,
int64_t  count 
)
overridevirtual

◆ Free()

template<typename Key , typename Hash , typename Eq >
void cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Free
overridevirtual

◆ GetActiveIndices()

◆ GetBucketCount()

template<typename Key , typename Hash , typename Eq >
int64_t cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::GetBucketCount ( ) const
overridevirtual

Get the number of buckets of the hash map.

Implements cloudViewer::core::DeviceHashBackend.

Definition at line 189 of file SlabHashBackend.h.

◆ GetImpl()

template<typename Key , typename Hash , typename Eq >
SlabHashBackendImpl<Key, Hash, Eq> cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::GetImpl ( )
inline

◆ Insert()

template<typename Key , typename Hash , typename Eq >
void cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Insert ( const void *  input_keys,
const std::vector< const void * > &  input_values,
buf_index_t output_buf_indices,
bool *  output_masks,
int64_t  count 
)
overridevirtual

Parallel insert contiguous arrays of keys and values.

Increase heap_top to pre-allocate potential memory increment and avoid atomicAdd in kernel.

Implements cloudViewer::core::DeviceHashBackend.

Definition at line 222 of file SlabHashBackend.h.

References CLOUDVIEWER_CUDA_CHECK, count, cloudViewer::core::InsertKernelPass0(), cloudViewer::core::InsertKernelPass1(), cloudViewer::core::kThreadsPerBlock, and cloudViewer::core::cuda::Synchronize().

◆ LoadFactor()

template<typename Key , typename Hash , typename Eq >
float cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::LoadFactor ( ) const
overridevirtual

Get the current load factor, defined as size / bucket count.

Implements cloudViewer::core::DeviceHashBackend.

Definition at line 216 of file SlabHashBackend.h.

◆ Reserve()

template<typename Key , typename Hash , typename Eq >
void cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Reserve ( int64_t  capacity)
overridevirtual

Reserve expects a lot of extra memory space at runtime, since it consists of 1) dumping all key value pairs to a buffer 2) creating a new hash table 3) parallel inserting dumped key value pairs 4) deallocating old hash table

Implements cloudViewer::core::DeviceHashBackend.

Definition at line 88 of file SlabHashBackend.h.

◆ Size()

template<typename Key , typename Hash , typename Eq >
int64_t cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::Size ( ) const
overridevirtual

Get the size (number of valid entries) of the hash map.

Implements cloudViewer::core::DeviceHashBackend.

Definition at line 183 of file SlabHashBackend.h.

Member Data Documentation

◆ bucket_count_

template<typename Key , typename Hash , typename Eq >
int64_t cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::bucket_count_
protected

Definition at line 67 of file SlabHashBackend.h.

◆ buffer_accessor_

template<typename Key , typename Hash , typename Eq >
CUDAHashBackendBufferAccessor cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::buffer_accessor_
protected

Definition at line 64 of file SlabHashBackend.h.

◆ impl_

template<typename Key , typename Hash , typename Eq >
SlabHashBackendImpl<Key, Hash, Eq> cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::impl_
protected

The struct is directly passed to kernels by value, so cannot be a shared pointer.

Definition at line 62 of file SlabHashBackend.h.

Referenced by cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::GetImpl().

◆ node_mgr_

template<typename Key , typename Hash , typename Eq >
std::shared_ptr<SlabNodeManager> cloudViewer::core::SlabHashBackend< Key, Hash, Eq >::node_mgr_
protected

Definition at line 65 of file SlabHashBackend.h.


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