FLANG
allocator.h
1//===-- include/flang/Runtime/CUDA/allocator.h ------------------*- 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#ifndef FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_
10#define FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_
11
12#include "common.h"
13#include "flang/Runtime/descriptor-consts.h"
14#include "flang/Runtime/entry-names.h"
15
16#include "cuda_runtime.h"
17
18namespace Fortran::runtime::cuda {
19
20extern "C" {
21cudaStream_t RTDECL(CUFGetAssociatedStream)(void *);
22int RTDECL(CUFSetAssociatedStream)(void *, cudaStream_t);
23void RTDECL(CUFRegisterAllocator)();
24}
25
26void CUFResetStream(cudaStream_t stream);
27
28void *CUFAllocPinned(std::size_t, std::int64_t *);
29void CUFFreePinned(void *);
30
31void *CUFAllocDevice(std::size_t, std::int64_t *);
32void CUFFreeDevice(void *);
33
34void *CUFAllocManaged(std::size_t, std::int64_t *);
35void CUFFreeManaged(void *);
36
37void *CUFAllocUnified(std::size_t, std::int64_t *);
38void CUFFreeUnified(void *);
39
40} // namespace Fortran::runtime::cuda
41#endif // FORTRAN_RUNTIME_CUDA_ALLOCATOR_H_