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

via flang-commits flang-commits at lists.llvm.org
Tue Sep 10 14:23:49 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

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

<details>
<summary>Changes</summary>

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

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


1 Files Affected:

- (modified) flang/test/Lower/CUDA/cuda-data-transfer.cuf (+16-5) 


``````````diff
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

``````````

</details>


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


More information about the flang-commits mailing list