[flang-commits] [flang] [flang][cuda] Crash if mode is not recognized (PR #114842)
Valentin Clement バレンタイン クレメン via flang-commits
flang-commits at lists.llvm.org
Mon Nov 4 09:59:38 PST 2024
https://github.com/clementval created https://github.com/llvm/llvm-project/pull/114842
None
>From 2a07e5163347f771ae97e8d0533648d6bda8c346 Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Mon, 4 Nov 2024 09:59:05 -0800
Subject: [PATCH] [flang][cuda] Crash if mode is not recognized
---
flang/runtime/CUDA/memory.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
More information about the flang-commits
mailing list