Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:21:38

0001 /*
0002     Copyright (c) 2026 UXL Foundation Contributors
0003 
0004     Licensed under the Apache License, Version 2.0 (the "License");
0005     you may not use this file except in compliance with the License.
0006     You may obtain a copy of the License at
0007 
0008         http://www.apache.org/licenses/LICENSE-2.0
0009 
0010     Unless required by applicable law or agreed to in writing, software
0011     distributed under the License is distributed on an "AS IS" BASIS,
0012     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013     See the License for the specific language governing permissions and
0014     limitations under the License.
0015 */
0016 
0017 #ifndef __TBB_numa_allocation_H
0018 #define __TBB_numa_allocation_H
0019 
0020 #include "detail/_config.h"
0021 #if !__TBB_PREVIEW_NUMA_ALLOCATION
0022 #error Set TBB_PREVIEW_NUMA_ALLOCATION to include numa_allocation.h
0023 #endif
0024 
0025 #include "info.h"
0026 
0027 namespace tbb {
0028 namespace detail {
0029 
0030 namespace r1 {
0031 
0032 TBB_EXPORT void *__TBB_EXPORTED_FUNC allocate_interleaved(size_t bytes,
0033     const tbb::detail::d1::numa_node_id *nodes, size_t nodes_count, size_t bytes_per_chunk);
0034 TBB_EXPORT void __TBB_EXPORTED_FUNC deallocate_interleaved(void *ptr, size_t bytes);
0035 
0036 } // namespace r1
0037 
0038 namespace d1 {
0039 
0040 inline void *allocate_numa_interleaved(size_t bytes,
0041                                        const std::vector<tbb::numa_node_id>& nodes,
0042                                        size_t bytes_per_chunk = 0) {
0043     if (nodes.empty())
0044         return nullptr;
0045     return r1::allocate_interleaved(bytes, nodes.data(), nodes.size(), bytes_per_chunk);
0046 }
0047 
0048 inline void *allocate_numa_interleaved(size_t bytes, size_t bytes_per_chunk = 0) {
0049     return r1::allocate_interleaved(bytes, nullptr, 0, bytes_per_chunk);
0050 }
0051 
0052 inline void deallocate_numa_interleaved(void *ptr, size_t bytes) {
0053     r1::deallocate_interleaved(ptr, bytes);
0054 }
0055 
0056 } // namespace d1
0057 } // namespace detail
0058 
0059 inline namespace v1 {
0060 using detail::d1::allocate_numa_interleaved;
0061 using detail::d1::deallocate_numa_interleaved;
0062 } // inline namespace v1
0063 
0064 } // namespace tbb
0065 
0066 #endif /* __TBB_numa_allocation_H */