[flang-commits] [flang] [llvm] [Flang][OpenMP] Defer descriptor mapping for assumed dummy argument types (PR #154349)

Akash Banerjee via flang-commits flang-commits at lists.llvm.org
Thu Aug 21 08:51:04 PDT 2025


================
@@ -0,0 +1,52 @@
+! This test doesn't expect any results, the pass condition is running to completion
+! without any memory access errors on device or mapping issues from descriptor
+! collisions due to local descriptors being placed on device and not being unampped
+! before a subsequent local descriptor residing at the same address is mapped to
+! device.
+! REQUIRES: flang, amdgpu
+
+! RUN: %libomptarget-compile-fortran-run-and-check-generic
+module test
+contains
+  subroutine kernel_1d(array)
+      implicit none
+      real, dimension(:) :: array
+      integer :: i
+
+      print *, 'kernel_1d'
+      !$omp target enter data map(alloc:array)
+      !$omp target teams distribute parallel do
+      do i=1, ubound(array, 1)
+          array(i) = 42.0
+      end do
+  end subroutine
+
+  subroutine kernel_2d(array)
+      implicit none
+      real, dimension(:,:) :: array
+      integer :: i, j
+
+      !$omp target enter data map(alloc:array)
+      !$omp target teams distribute parallel do collapse(2)
+      do j=1, ubound(array, 2)
+          do i=1, ubound(array, 1)
+              array(i,j) = 42.0
+          end do
+      end do
+  end subroutine
+end module
+
+program main
+    use test
+    implicit none
+    integer, parameter :: n = 10
+    real :: array1(n)
+    real :: array2(n,n)
+
+    call kernel_1d(array1)
+    call kernel_2d(array2)
+
+    print *, "PASS"
----------------
TIFitis wrote:

Can you please verify the array contents before printing the `PASS`.

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


More information about the flang-commits mailing list