Hi Chung-Lin!

On Tue, 25 Sep 2018 21:10:47 +0800, Chung-Lin Tang <chunglin_t...@mentor.com> 
wrote:
> --- a/libgomp/oacc-parallel.c
> +++ b/libgomp/oacc-parallel.c
> @@ -377,8 +360,6 @@ GOACC_enter_exit_data (int device, size_t mapnum,
>       finalize = true;
>      }
>  
> -  acc_dev->openacc.async_set_async_func (async);
> -
>    /* Determine if this is an "acc enter data".  */
>    for (i = 0; i < mapnum; ++i)
>      {
> @@ -450,7 +431,7 @@ GOACC_enter_exit_data (int device, size_t mapnum,
>         else
>           {
>             gomp_acc_insert_pointer (pointer, &hostaddrs[i],
> -                                    &sizes[i], &kinds[i]);
> +                                    &sizes[i], &kinds[i], async);
>             /* Increment 'i' by two because OpenACC requires fortran
>                arrays to be contiguous, so each PSET is associated with
>                one of MAP_FORCE_ALLOC/MAP_FORCE_PRESET/MAP_FORCE_TO, and
> @@ -475,17 +456,17 @@ GOACC_enter_exit_data (int device, size_t mapnum,
>               if (acc_is_present (hostaddrs[i], sizes[i]))
>                 {
>                   if (finalize)
> -                   acc_delete_finalize (hostaddrs[i], sizes[i]);
> +                   acc_delete_finalize_async (hostaddrs[i], sizes[i], async);
>                   else
> -                   acc_delete (hostaddrs[i], sizes[i]);
> +                   acc_delete_async (hostaddrs[i], sizes[i], async);
>                 }
>               break;
>             case GOMP_MAP_FROM:
>             case GOMP_MAP_FORCE_FROM:
>               if (finalize)
> -               acc_copyout_finalize (hostaddrs[i], sizes[i]);
> +               acc_copyout_finalize_async (hostaddrs[i], sizes[i], async);
>               else
> -               acc_copyout (hostaddrs[i], sizes[i]);
> +               acc_copyout_async (hostaddrs[i], sizes[i], async);
>               break;
>             default:
>               gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 0x%.2x",
> @@ -503,8 +484,6 @@ GOACC_enter_exit_data (int device, size_t mapnum,
>           i += pointer - 1;
>         }
>        }
> -
> -  acc_dev->openacc.async_set_async_func (acc_async_sync);
>  }

Additionally the following, or why not?  Please comment on the one TODO
which before your async re-work also was -- incorrectly? -- run
asynchronously?

commit 34c9ce65ad1f9865d0716d18c364d8c6928e694c
Author: Thomas Schwinge <tho...@codesourcery.com>
Date:   Fri Dec 14 14:34:17 2018 +0100

    into async re-work: more async function usage
---
 libgomp/oacc-parallel.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git libgomp/oacc-parallel.c libgomp/oacc-parallel.c
index 5a441c9efe38..91875c57fc97 100644
--- libgomp/oacc-parallel.c
+++ libgomp/oacc-parallel.c
@@ -413,11 +413,11 @@ GOACC_enter_exit_data (int device, size_t mapnum,
                {
                case GOMP_MAP_ALLOC:
                case GOMP_MAP_FORCE_ALLOC:
-                 acc_create (hostaddrs[i], sizes[i]);
+                 acc_create_async (hostaddrs[i], sizes[i], async);
                  break;
                case GOMP_MAP_TO:
                case GOMP_MAP_FORCE_TO:
-                 acc_copyin (hostaddrs[i], sizes[i]);
+                 acc_copyin_async (hostaddrs[i], sizes[i], async);
                  break;
                default:
                  gomp_fatal (">>>> GOACC_enter_exit_data UNHANDLED kind 
0x%.2x",
@@ -563,6 +563,8 @@ GOACC_update (int device, size_t mapnum,
                 the value of the allocated device memory in the
                 previous pointer.  */
              *(uintptr_t *) hostaddrs[i] = (uintptr_t)dptr;
+             /* This is intentionally no calling acc_update_device_async,
+                because TODO.  */
              acc_update_device (hostaddrs[i], sizeof (uintptr_t));
 
              /* Restore the host pointer.  */


Grüße
 Thomas

Reply via email to