47 "[DefaultHash] Only support keys whose byte size is " 48 "multiples of sizeof(int)");
53 uint64_t hash = UINT64_C(14695981039346656037);
55 auto cast_key_ptr =
static_cast<const int*
>(key_ptr);
57 hash ^= cast_key_ptr[i];
58 hash *= UINT64_C(1099511628211);
76 "[DefaultKeyEq] Only support keys whose byte size is " 77 "multiples of sizeof(int)");
82 if (lhs ==
nullptr || rhs ==
nullptr) {
86 auto lhs_key_ptr =
static_cast<const int*
>(lhs);
87 auto rhs_key_ptr =
static_cast<const int*
>(rhs);
91 is_eq = is_eq && (lhs_key_ptr[i] == rhs_key_ptr[i]);
100 template <
typename Hash,
typename KeyEq>
105 int64_t init_capacity,
109 : bucket_count_(init_buckets),
110 capacity_(init_capacity),
111 dsize_key_(dsize_key),
112 dsize_value_(dsize_value),
122 virtual void Rehash(int64_t buckets) = 0;
125 virtual void Insert(
const void* input_keys,
126 const void* input_values,
134 virtual void Activate(
const void* input_keys,
140 virtual void Find(
const void* input_keys,
146 virtual void Erase(
const void* input_keys,
151 virtual int64_t GetActiveIndices(
addr_t* output_indices) = 0;
153 virtual int64_t Size()
const = 0;
166 virtual std::vector<int64_t> BucketSizes()
const = 0;
169 virtual float LoadFactor()
const = 0;
182 return float(capacity_) /
float(bucket_count_);
197 int64_t init_buckets,
198 int64_t init_capacity,
204 int64_t init_buckets,
205 int64_t init_capacity,
211 int64_t init_buckets,
212 int64_t init_capacity,
DefaultKeyEq()
Definition: DeviceHashmap.h:72
int64_t GetKeyBytesize() const
Definition: DeviceHashmap.h:158
Tensor & GetKeyBuffer()
Definition: DeviceHashmap.h:161
int64_t dsize_value_
Definition: DeviceHashmap.h:175
bool OPEN3D_HOST_DEVICE operator()(const void *lhs, const void *rhs) const
Definition: DeviceHashmap.h:81
int64_t GetCapacity() const
Definition: DeviceHashmap.h:155
float avg_capacity_bucket_ratio()
Definition: DeviceHashmap.h:181
DeviceHashmap< DefaultHash, DefaultKeyEq > DefaultDeviceHashmap
Definition: DeviceHashmap.h:194
DefaultKeyEq(int64_t key_size)
Definition: DeviceHashmap.h:73
void LogError(const char *format, const Args &... args)
Definition: Console.h:176
Tensor & GetValueBuffer()
Definition: DeviceHashmap.h:162
DefaultHash(int64_t key_size)
Definition: DeviceHashmap.h:44
Definition: DeviceHashmap.h:37
DeviceHashmap(int64_t init_buckets, int64_t init_capacity, int64_t dsize_key, int64_t dsize_value, const Device &device)
Comprehensive constructor for the developer.
Definition: DeviceHashmap.h:104
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample uint64_t
Definition: K4aPlugin.cpp:352
Base class: shared interface.
Definition: DeviceHashmap.h:101
int64_t capacity_
Definition: DeviceHashmap.h:173
Definition: DeviceHashmap.h:66
std::shared_ptr< DefaultDeviceHashmap > CreateDefaultDeviceHashmap(int64_t init_buckets, int64_t init_capacity, int64_t dsize_key, int64_t dsize_value, const Device &device)
Definition: DeviceHashmap.cpp:41
#define OPEN3D_HOST_DEVICE
Definition: CUDAUtils.h:54
std::shared_ptr< DefaultDeviceHashmap > CreateDefaultCPUHashmap(int64_t init_buckets, int64_t init_capacity, int64_t dsize_key, int64_t dsize_value, const Device &device)
Non-templated factory.
Definition: DefaultHashmapCPU.cpp:33
std::shared_ptr< HashmapBuffer > buffer_
Definition: DeviceHashmap.h:179
int64_t GetValueBytesize() const
Definition: DeviceHashmap.h:159
Device GetDevice() const
Definition: DeviceHashmap.h:157
int64_t key_size_in_int_
Definition: DeviceHashmap.h:63
int64_t dsize_key_
Definition: DeviceHashmap.h:174
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c int
Definition: K4aPlugin.cpp:479
int count
Definition: FilePCD.cpp:61
DefaultHash()
Definition: DeviceHashmap.h:43
Device device_
Definition: DeviceHashmap.h:177
Definition: PinholeCameraIntrinsic.cpp:35
std::shared_ptr< DefaultDeviceHashmap > CreateDefaultCUDAHashmap(int64_t init_buckets, int64_t init_capacity, int64_t dsize_key, int64_t dsize_value, const Device &device)
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle float
Definition: K4aPlugin.cpp:465
virtual ~DeviceHashmap()
Definition: DeviceHashmap.h:114
uint32_t addr_t
Definition: HashmapBuffer.h:58
uint64_t OPEN3D_HOST_DEVICE operator()(const void *key_ptr) const
Definition: DeviceHashmap.h:52
int64_t GetBucketCount() const
Definition: DeviceHashmap.h:156
int64_t key_size_in_int_
Definition: DeviceHashmap.h:96
int64_t bucket_count_
Definition: DeviceHashmap.h:172