1 //===-- runtime/CUDA/registration.cpp -------------------------------------===//
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
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
{
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
);
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);
47 } // namespace Fortran::runtime::cuda