Skip to content

Commit 70d61f6

Browse files
authored
[flang][cuda] Adding runtime call to CUFRegisterVariable (#113952)
1 parent 9d9b1ba commit 70d61f6

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

flang/include/flang/Runtime/CUDA/registration.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "flang/Runtime/entry-names.h"
1313
#include <cstddef>
14+
#include <cstdint>
1415

1516
namespace Fortran::runtime::cuda {
1617

@@ -23,6 +24,10 @@ void *RTDECL(CUFRegisterModule)(void *data);
2324
void RTDECL(CUFRegisterFunction)(
2425
void **module, const char *fctSym, char *fctName);
2526

27+
/// Register a device variable.
28+
void RTDECL(CUFRegisterVariable)(
29+
void **module, char *varSym, const char *varName, int64_t size);
30+
2631
} // extern "C"
2732

2833
} // namespace Fortran::runtime::cuda

flang/runtime/CUDA/registration.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ extern void __cudaRegisterFatBinaryEnd(void *);
2121
extern void __cudaRegisterFunction(void **fatCubinHandle, const char *hostFun,
2222
char *deviceFun, const char *deviceName, int thread_limit, uint3 *tid,
2323
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);
2427

2528
void *RTDECL(CUFRegisterModule)(void *data) {
2629
void **fatHandle{__cudaRegisterFatBinary(data)};
@@ -34,6 +37,11 @@ void RTDEF(CUFRegisterFunction)(
3437
(uint3 *)0, (dim3 *)0, (dim3 *)0, (int *)0);
3538
}
3639

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);
43+
}
44+
3745
} // extern "C"
3846

3947
} // namespace Fortran::runtime::cuda

0 commit comments

Comments
 (0)