[libc++][Android] Allow testing libc++ with clang-r536225 (#116149)
[llvm-project.git] / flang / runtime / CUDA / registration.cpp
blobb7b6ef389bffba9e49e843ba5407c7cf6de568b3
1 //===-- runtime/CUDA/registration.cpp -------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "flang/Runtime/CUDA/registration.h"
10 #include "../terminator.h"
11 #include "flang/Runtime/CUDA/common.h"
13 #include "cuda_runtime.h"
15 namespace Fortran::runtime::cuda {
17 extern "C" {
19 extern void **__cudaRegisterFatBinary(void *);
20 extern void __cudaRegisterFatBinaryEnd(void *);
21 extern void __cudaRegisterFunction(void **fatCubinHandle, const char *hostFun,
22 char *deviceFun, const char *deviceName, int thread_limit, uint3 *tid,
23 uint3 *bid, dim3 *bDim, dim3 *gDim, int *wSize);
24 extern void __cudaRegisterVar(void **fatCubinHandle, char *hostVar,
25 const char *deviceAddress, const char *deviceName, int ext, size_t size,
26 int constant, int global);
28 void *RTDECL(CUFRegisterModule)(void *data) {
29 void **fatHandle{__cudaRegisterFatBinary(data)};
30 __cudaRegisterFatBinaryEnd(fatHandle);
31 return fatHandle;
34 void RTDEF(CUFRegisterFunction)(
35 void **module, const char *fctSym, char *fctName) {
36 __cudaRegisterFunction(module, fctSym, fctName, fctName, -1, (uint3 *)0,
37 (uint3 *)0, (dim3 *)0, (dim3 *)0, (int *)0);
40 void RTDEF(CUFRegisterVariable)(
41 void **module, char *varSym, const char *varName, int64_t size) {
42 __cudaRegisterVar(module, varSym, varName, varName, 0, size, 0, 0);
45 } // extern "C"
47 } // namespace Fortran::runtime::cuda