ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
SlabNodeManager.cu
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 // Copyright 2019 Saman Ashkiani
9 // Rewritten by Wei Dong 2019 - 2020
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 #include "core/hashmap/CUDA/SlabNodeManager.h"
23 
24 namespace cloudViewer {
25 namespace core {
26 
27 __global__ void CountSlabsPerSuperblockKernel(SlabNodeManagerImpl impl,
28  uint32_t* slabs_per_superblock) {
29  uint32_t tid = threadIdx.x + blockIdx.x * blockDim.x;
30 
31  int num_bitmaps = kBlocksPerSuperBlock * 32;
32  if (tid >= num_bitmaps) {
33  return;
34  }
35 
36  for (uint32_t i = 0; i < kSuperBlocks; i++) {
37  uint32_t read_bitmap = *(impl.get_ptr_for_bitmap(i, tid));
38  atomicAdd(&slabs_per_superblock[i], __popc(read_bitmap));
39  }
40 }
41 } // namespace core
42 } // namespace cloudViewer