Skip to content

[flang][cuda][NFC] Add more descriptor inquiry tests for data transfer #108094

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
Sep 19, 2024

Conversation

clementval
Copy link
Contributor

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

@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Sep 10, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 10, 2024

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

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

Changes

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

@clementval clementval merged commit 5e1a54b into llvm:main Sep 19, 2024
11 checks passed
@clementval clementval deleted the cuf_descriptor_inquiry branch September 19, 2024 04:45
tmsri pushed a commit to tmsri/llvm-project that referenced this pull request Sep 19, 2024
llvm#108094)

Make sure there is no data transfer generated when a device variable is
used in these intrinsic functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants