[NFC][opt] Improve help message (#97805)
[llvm-project.git] / offload / DeviceRTL / include / Allocator.h
bloba28eb0fb2977eaa5953f0045e7bc2c9c1e317bf6
1 //===-------- Allocator.h - OpenMP memory allocator interface ---- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //
10 //===----------------------------------------------------------------------===//
12 #ifndef OMPTARGET_ALLOCATOR_H
13 #define OMPTARGET_ALLOCATOR_H
15 #include "Types.h"
17 // Forward declaration.
18 struct KernelEnvironmentTy;
20 #pragma omp begin declare target device_type(nohost)
22 namespace ompx {
24 namespace allocator {
26 static uint64_t constexpr ALIGNMENT = 16;
28 /// Initialize the allocator according to \p KernelEnvironment
29 void init(bool IsSPMD, KernelEnvironmentTy &KernelEnvironment);
31 /// Allocate \p Size bytes.
32 [[gnu::alloc_size(1), gnu::assume_aligned(ALIGNMENT), gnu::malloc]] void *
33 alloc(uint64_t Size);
35 /// Free the allocation pointed to by \p Ptr.
36 void free(void *Ptr);
38 } // namespace allocator
40 } // namespace ompx
42 #pragma omp end declare target
44 #endif