1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
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
14 // http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include "core/hashmap/CUDA/SlabNodeManager.h"
24 namespace cloudViewer {
27 __global__ void CountSlabsPerSuperblockKernel(SlabNodeManagerImpl impl,
28 uint32_t* slabs_per_superblock) {
29 uint32_t tid = threadIdx.x + blockIdx.x * blockDim.x;
31 int num_bitmaps = kBlocksPerSuperBlock * 32;
32 if (tid >= num_bitmaps) {
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));
42 } // namespace cloudViewer