Skip to content

[flang][cuda] Crash if mode is not handled #114842

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 1 commit into from
Nov 4, 2024

Conversation

clementval
Copy link
Contributor

No description provided.

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

llvmbot commented Nov 4, 2024

@llvm/pr-subscribers-flang-runtime

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

Changes

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

1 Files Affected:

  • (modified) flang/runtime/CUDA/memory.cpp (+3-1)
diff --git a/flang/runtime/CUDA/memory.cpp b/flang/runtime/CUDA/memory.cpp
index daf1db684a3d2e..5aa7ac5c3cccd1 100644
--- a/flang/runtime/CUDA/memory.cpp
+++ b/flang/runtime/CUDA/memory.cpp
@@ -111,7 +111,6 @@ void RTDEF(CUFDataTransferPtrDesc)(void *addr, Descriptor *desc,
 
 void RTDECL(CUFDataTransferDescDesc)(Descriptor *dstDesc, Descriptor *srcDesc,
     unsigned mode, const char *sourceFile, int sourceLine) {
-  Terminator terminator{sourceFile, sourceLine};
   MemmoveFct memmoveFct;
   if (mode == kHostToDevice) {
     memmoveFct = &MemmoveHostToDevice;
@@ -119,6 +118,9 @@ void RTDECL(CUFDataTransferDescDesc)(Descriptor *dstDesc, Descriptor *srcDesc,
     memmoveFct = &MemmoveDeviceToHost;
   } else if (mode == kDeviceToDevice) {
     memmoveFct = &MemmoveDeviceToDevice;
+  } else {
+    Terminator terminator{sourceFile, sourceLine};
+    terminator.Crash("host to host copy not supported");
   }
   Fortran::runtime::Assign(
       *dstDesc, *srcDesc, terminator, MaybeReallocate, memmoveFct);

@clementval clementval changed the title [flang][cuda] Crash if mode is not recognized [flang][cuda] Crash if mode is not handled Nov 4, 2024
@clementval clementval merged commit 51f7e98 into llvm:main Nov 4, 2024
9 of 10 checks passed
@clementval clementval deleted the cuf_desc_desc_error branch November 4, 2024 19:47
PhilippRados pushed a commit to PhilippRados/llvm-project that referenced this pull request Nov 6, 2024
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