Open3D (C++ API)  0.15.1
SlabMacros.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// The MIT License (MIT)
5//
6// Copyright (c) 2018-2021 www.open3d.org
7//
8// Permission is hereby granted, free of charge, to any person obtaining a copy
9// of this software and associated documentation files (the "Software"), to deal
10// in the Software without restriction, including without limitation the rights
11// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12// copies of the Software, and to permit persons to whom the Software is
13// furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice shall be included in
16// all copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24// IN THE SOFTWARE.
25// ----------------------------------------------------------------------------
26
27// Copyright 2019 Saman Ashkiani
28//
29// Licensed under the Apache License, Version 2.0 (the "License");
30// you may not use this file except in compliance with the License.
31// You may obtain a copy of the License at
32//
33// http://www.apache.org/licenses/LICENSE-2.0
34//
35// Unless required by applicable law or agreed to in writing, software
36// distributed under the License is distributed on an "AS IS" BASIS,
37// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
38// implied. See the License for the specific language governing permissions
39// and limitations under the License.
40
41#pragma once
42#include <cstdint>
43
45
46namespace open3d {
47namespace core {
48
49// Device-specific, safe for current NVIDIA architectures.
50static constexpr uint32_t kWarpSize = 32;
51
53// Tunable variables
55// HashMap
56static constexpr uint32_t kSuperBlocks = 32;
57static constexpr uint32_t kBlocksPerSuperBlock = 4;
58static constexpr uint32_t kBlocksPerSuperBlockInBits = 2;
59static constexpr uint32_t kSlabsPerBlock = 1024;
60
61// Misc
62static constexpr uint32_t kMaxKeyByteSize = 32;
63static constexpr uint32_t kThreadsPerBlock = 128;
64
66// Combination of tunable variables
68static constexpr uint32_t kUIntsPerBlock = kSlabsPerBlock * kWarpSize;
69// We need one bitmap (32-bit) per slab (32 nodes). Number of bitmaps is equal
70// to number of slabs.
71static constexpr uint32_t kBitmapsPerSuperBlock =
72 kBlocksPerSuperBlock * kSlabsPerBlock;
73static constexpr uint32_t kUIntsPerSuperBlock =
74 kBlocksPerSuperBlock * kUIntsPerBlock + kBitmapsPerSuperBlock;
75
77// Non-tunable variables
79// Mask offsets
80static constexpr uint32_t kSuperBlockMaskBits = 27;
81static constexpr uint32_t kBlockMaskBits = 10;
82static constexpr uint32_t kSlabMaskBits = 5;
83
84// Masks & flags
85static constexpr uint32_t kSyncLanesMask = 0xFFFFFFFF;
86static constexpr uint32_t kNodePtrLanesMask = 0x7FFFFFFF;
87static constexpr uint32_t kNextSlabPtrLaneId = 31;
88
89static constexpr uint32_t kHeadSlabAddr = 0xFFFFFFFE;
90
91static constexpr uint32_t kEmptySlabAddr = 0xFFFFFFFF;
92static constexpr uint32_t kEmptyNodeAddr = 0xFFFFFFFF;
93static constexpr uint32_t kNullAddr = 0xFFFFFFFF;
94
95static constexpr uint32_t kNotFoundFlag = 0xFFFFFFFF;
96
97#define MEMCPY_AS_INTS(dst, src, num_bytes) \
98 auto dst_in_int = reinterpret_cast<int*>(dst); \
99 auto src_in_int = reinterpret_cast<const int*>(src); \
100 int count_in_int = num_bytes / sizeof(int); \
101 for (int i = 0; i < count_in_int; ++i) { \
102 dst_in_int[i] = src_in_int[i]; \
103 }
104
105} // namespace core
106} // namespace open3d
Common CUDA utilities.
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 k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle uint32_t
Definition: K4aPlugin.cpp:567
Definition: PinholeCameraIntrinsic.cpp:35