Skip to content

[flang][cuda] Fix module registration #113358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 22, 2024
Merged

[flang][cuda] Fix module registration #113358

merged 3 commits into from
Oct 22, 2024

Conversation

clementval
Copy link
Contributor

No description provided.

@llvmbot llvmbot added flang:runtime flang Flang issues not falling into any other category labels Oct 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 22, 2024

@llvm/pr-subscribers-flang-runtime

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/113358.diff

1 Files Affected:

  • (modified) flang/runtime/CUDA/registration.cpp (+5-2)
diff --git a/flang/runtime/CUDA/registration.cpp b/flang/runtime/CUDA/registration.cpp
index aed275e964680e..b83a43efaf500b 100644
--- a/flang/runtime/CUDA/registration.cpp
+++ b/flang/runtime/CUDA/registration.cpp
@@ -14,13 +14,16 @@ namespace Fortran::runtime::cuda {
 
 extern "C" {
 
-extern void **__cudaRegisterFatBinary(void *data);
+extern void **__cudaRegisterFatBinary(void *);
+extern void __cudaRegisterFatBinaryEnd(void *);
 extern void __cudaRegisterFunction(void **fatCubinHandle, const char *hostFun,
     char *deviceFun, const char *deviceName, int thread_limit, uint3 *tid,
     uint3 *bid, dim3 *bDim, dim3 *gDim, int *wSize);
 
 void *RTDECL(CUFRegisterModule)(void *data) {
-  return __cudaRegisterFatBinary(data);
+  void** fatHandle = __cudaRegisterFatBinary(data);
+  __cudaRegisterFatBinaryEnd(fatHandle);
+  return fatHandle;
 }
 
 void RTDEF(CUFRegisterFunction)(void **module, const char *fct) {

Copy link

github-actions bot commented Oct 22, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@clementval clementval merged commit cc4926a into main Oct 22, 2024
3 of 5 checks passed
@clementval clementval deleted the users/clementval/modreg branch October 22, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:runtime flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants