[Mlir-commits] [clang] [llvm] [mlir] [OMPIRBuilder] - Handle dependencies in `createTarget` (PR #93977)

Sergio Afonso llvmlistbot at llvm.org
Wed Jun 5 04:11:55 PDT 2024


================
@@ -0,0 +1,37 @@
+! Offloading test checking the use of the depend clause on
+! the target construct
+! REQUIRES: flang, amdgcn-amd-amdhsa
+! UNSUPPORTED: nvptx64-nvidia-cuda
+! UNSUPPORTED: nvptx64-nvidia-cuda-LTO
+! UNSUPPORTED: aarch64-unknown-linux-gnu
+! UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
+! UNSUPPORTED: x86_64-pc-linux-gnu
+! UNSUPPORTED: x86_64-pc-linux-gnu-LTO
+
+! RUN: %libomptarget-compile-fortran-run-and-check-generic
+program main
+  integer :: a = 0
+  call foo(5, a)
+  print*, "======= FORTRAN Test passed! ======="
+  print*, "foo(5) returned ", a, ", expected 6\n"
+  !       stop 0
+end program main
+subroutine foo(N, r)
+  integer, intent(in) :: N
+  integer, intent(out) :: r
+  integer :: z
+
+  z = 1
+  !$omp task depend(out: z) shared(z)
+  z = N
----------------
skatrak wrote:

Would it make sense to perhaps add a relatively long-running loop before setting the value of `z` here? Just to make sure that the target task below has had to wait for the first to finish (rather than being able to assume it did because it possibly runs so fast that it always finishes before the next task starts running).

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


More information about the Mlir-commits mailing list