Open3D (C++ API)  0.17.0
SlabMacros.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 // Copyright 2019 Saman Ashkiani
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
19 // implied. See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 #include <cstdint>
24 
25 #include "open3d/core/CUDAUtils.h"
26 
27 namespace open3d {
28 namespace core {
29 
30 // Device-specific, safe for current NVIDIA architectures.
31 static constexpr uint32_t kWarpSize = 32;
32 
34 // Tunable variables
36 // HashMap
37 static constexpr uint32_t kSuperBlocks = 32;
38 static constexpr uint32_t kBlocksPerSuperBlock = 4;
39 static constexpr uint32_t kBlocksPerSuperBlockInBits = 2;
40 static constexpr uint32_t kSlabsPerBlock = 1024;
41 
42 // Misc
43 static constexpr uint32_t kMaxKeyByteSize = 32;
44 static constexpr uint32_t kThreadsPerBlock = 128;
45 
47 // Combination of tunable variables
49 static constexpr uint32_t kUIntsPerBlock = kSlabsPerBlock * kWarpSize;
50 // We need one bitmap (32-bit) per slab (32 nodes). Number of bitmaps is equal
51 // to number of slabs.
52 static constexpr uint32_t kBitmapsPerSuperBlock =
53  kBlocksPerSuperBlock * kSlabsPerBlock;
54 static constexpr uint32_t kUIntsPerSuperBlock =
55  kBlocksPerSuperBlock * kUIntsPerBlock + kBitmapsPerSuperBlock;
56 
58 // Non-tunable variables
60 // Mask offsets
61 static constexpr uint32_t kSuperBlockMaskBits = 27;
62 static constexpr uint32_t kBlockMaskBits = 10;
63 static constexpr uint32_t kSlabMaskBits = 5;
64 
65 // Masks & flags
66 static constexpr uint32_t kSyncLanesMask = 0xFFFFFFFF;
67 static constexpr uint32_t kNodePtrLanesMask = 0x7FFFFFFF;
68 static constexpr uint32_t kNextSlabPtrLaneId = 31;
69 
70 static constexpr uint32_t kHeadSlabAddr = 0xFFFFFFFE;
71 
72 static constexpr uint32_t kEmptySlabAddr = 0xFFFFFFFF;
73 static constexpr uint32_t kEmptyNodeAddr = 0xFFFFFFFF;
74 static constexpr uint32_t kNullAddr = 0xFFFFFFFF;
75 
76 static constexpr uint32_t kNotFoundFlag = 0xFFFFFFFF;
77 
78 #define MEMCPY_AS_INTS(dst, src, num_bytes) \
79  auto dst_in_int = reinterpret_cast<int*>(dst); \
80  auto src_in_int = reinterpret_cast<const int*>(src); \
81  int count_in_int = num_bytes / sizeof(int); \
82  for (int i = 0; i < count_in_int; ++i) { \
83  dst_in_int[i] = src_in_int[i]; \
84  }
85 
86 } // namespace core
87 } // 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:548
Definition: PinholeCameraIntrinsic.cpp:16