[3/6,OpenACC,libgomp] acc_get/set_default_async API, Fortran specific parts

Message ID f5f5450c-eed2-80e5-9130-7f5655bf7d27@mentor.com
State New
Headers show
Series
  • Async re-work
Related show

Commit Message

Chung-Lin Tang Sept. 25, 2018, 1:11 p.m.
This patch adds the OpenACC 2.5 new APIs of acc_get_default_async/acc_set_default_async,
contained are the modifications for Fortran in libgomp/openacc.f90, libgomp/openacc_lib.h,
and a small testsuite adjustment.

Thanks,
Chung-Lin

	* openacc.f90 (acc_async_default): Declare.
	(acc_set_default_async): Likewise.
	(acc_get_default_async): Likewise.
  	* openacc_lib.h (acc_async_default): Declare.
  	(acc_set_default_async): Likewise.
	(acc_get_default_async): Likewise.

	* testsuite/libgomp.oacc-fortran/lib-12.f90: Likewise.

Patch

diff --git a/libgomp/openacc.f90 b/libgomp/openacc.f90
index 7c809fe..7d31ee6 100644
--- a/libgomp/openacc.f90
+++ b/libgomp/openacc.f90
@@ -51,9 +51,10 @@  module openacc_kinds
 
   integer, parameter :: acc_handle_kind = int32
 
-  public :: acc_async_noval, acc_async_sync
+  public :: acc_async_default, acc_async_noval, acc_async_sync
 
   ! Keep in sync with include/gomp-constants.h.
+  integer (acc_handle_kind), parameter :: acc_async_default = 0
   integer (acc_handle_kind), parameter :: acc_async_noval = -1
   integer (acc_handle_kind), parameter :: acc_async_sync = -2
 
@@ -92,6 +93,16 @@  module openacc_internal
       integer (acc_device_kind) d
     end function
 
+    subroutine acc_set_default_async_h (a)
+      import
+      integer a
+    end subroutine
+
+    function acc_get_default_async_h ()
+      import
+      integer acc_get_default_async_h
+    end function
+
     function acc_async_test_h (a)
       logical acc_async_test_h
       integer a
@@ -720,6 +731,7 @@  module openacc
 
   public :: acc_get_num_devices, acc_set_device_type, acc_get_device_type
   public :: acc_set_device_num, acc_get_device_num, acc_async_test
+  public :: acc_set_default_async, acc_get_default_async
   public :: acc_async_test_all
   public :: acc_wait, acc_async_wait, acc_wait_async
   public :: acc_wait_all, acc_async_wait_all, acc_wait_all_async
@@ -752,6 +764,14 @@  module openacc
     procedure :: acc_get_device_num_h
   end interface
 
+  interface acc_set_default_async
+    procedure :: acc_set_default_async_h
+  end interface
+
+  interface acc_get_default_async
+    procedure :: acc_get_default_async_h
+  end interface
+
   interface acc_async_test
     procedure :: acc_async_test_h
   end interface
diff --git a/libgomp/openacc_lib.h b/libgomp/openacc_lib.h
index 820d987..75a6939 100644
--- a/libgomp/openacc_lib.h
+++ b/libgomp/openacc_lib.h
@@ -46,6 +46,7 @@ 
       integer, parameter :: acc_handle_kind = 4
 
 !     Keep in sync with include/gomp-constants.h.
+      integer (acc_handle_kind), parameter :: acc_async_default = 0
       integer (acc_handle_kind), parameter :: acc_async_noval = -1
       integer (acc_handle_kind), parameter :: acc_async_sync = -2
 
@@ -89,6 +90,18 @@ 
         end function
       end interface
 
+      interface acc_set_default_async
+        subroutine acc_set_default_async_h (a)
+          integer a
+        end subroutine
+      end interface
+
+      interface acc_get_default_async
+        function acc_get_default_async_h ()
+          integer acc_get_default_async_h
+        end function
+      end interface
+
       interface acc_async_test
         function acc_async_test_h (a)
           logical acc_async_test_h
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/lib-12.f90 b/libgomp/testsuite/libgomp.oacc-fortran/lib-12.f90
index 6912f67..ffbbf33 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/lib-12.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/lib-12.f90
@@ -1,4 +1,5 @@ 
 ! { dg-do run }
+! { dg-xfail-run-if "n/a" { openacc_host_selected } }
 
 program main
   use openacc