[flang-commits] [flang] [flang][cuda][NFC] Add more descriptor inquiry tests for data transfer (PR #108094)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Tue Sep 10 14:23:19 PDT 2024


https://github.com/clementval created https://github.com/llvm/llvm-project/pull/108094

Make sure there is no data transfer generated when a device variable is used in these intrinsic functions. 

>From 082a003ef5bb7d5f5faac87b294823cf1eaf27de Mon Sep 17 00:00:00 2001
From: Valentin Clement <clementval at gmail.com>
Date: Tue, 10 Sep 2024 14:21:57 -0700
Subject: [PATCH] [flang][cuda][NFC] Add more descripot inquiry tests for data
 transfer

---
 flang/test/Lower/CUDA/cuda-data-transfer.cuf | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/flang/test/Lower/CUDA/cuda-data-transfer.cuf b/flang/test/Lower/CUDA/cuda-data-transfer.cuf
index 11f1f33d7cb587..2f76b5e78800ad 100644
--- a/flang/test/Lower/CUDA/cuda-data-transfer.cuf
+++ b/flang/test/Lower/CUDA/cuda-data-transfer.cuf
@@ -354,12 +354,23 @@ end subroutine
 ! CHECK: cuf.kernel<<<*, *>>>
 ! CHECK-NOT: cuf.data_transfer
 
-subroutine sub18()
+subroutine sub18(o)
+  integer, device, optional, allocatable :: o(:)
   integer, device, allocatable :: a(:)
-  integer :: isz
-
-  isz = size(a)
+  integer, device, pointer :: p(:)
+  integer :: b
+  integer :: s(1)
+  logical :: l
+
+  b = size(a)
+  b = lbound(a, dim=1)
+  b = ubound(a, dim=1)
+  s = shape(a)
+  l = allocated(a)
+  l = associated(p)
+  b = kind(a)
+  l = present(o)
 end subroutine
 
-! CHECK-LABEL: func.func @_QPsub18()
+! CHECK-LABEL: func.func @_QPsub18
 ! CHECK-NOT: cuf.data_transfer



More information about the flang-commits mailing list