]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgomp/oacc-parallel.c
Update copyright years.
[thirdparty/gcc.git] / libgomp / oacc-parallel.c
index edfc6067ee915f21e5d8aa5c95586bc1c3c2bd99..9f97cbd0390bb7258c9261b154307bd52e56f272 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2020 Free Software Foundation, Inc.
+/* Copyright (C) 2013-2022 Free Software Foundation, Inc.
 
    Contributed by Mentor Embedded.
 
@@ -290,8 +290,8 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *),
 
   goacc_aq aq = get_goacc_asyncqueue (async);
 
-  tgt = gomp_map_vars_async (acc_dev, aq, mapnum, hostaddrs, NULL, sizes, kinds,
-                            true, GOMP_MAP_VARS_OPENACC);
+  tgt = goacc_map_vars (acc_dev, aq, mapnum, hostaddrs, NULL, sizes, kinds,
+                       true, 0);
   if (profiling_p)
     {
       prof_info.event_type = acc_ev_enter_data_end;
@@ -300,7 +300,7 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *),
       goacc_profiling_dispatch (&prof_info, &enter_exit_data_event_info,
                                &api_info);
     }
-  
+
   devaddrs = gomp_alloca (sizeof (void *) * mapnum);
   for (i = 0; i < mapnum; i++)
     devaddrs[i] = (void *) gomp_map_val (tgt, hostaddrs, i);
@@ -321,11 +321,8 @@ GOACC_parallel_keyed (int flags_m, void (*fn) (void *),
                                &api_info);
     }
 
-  /* If running synchronously, unmap immediately.  */
-  if (aq == NULL)
-    gomp_unmap_vars (tgt, true);
-  else
-    gomp_unmap_vars_async (tgt, true, aq);
+  /* If running synchronously (aq == NULL), this will unmap immediately.  */
+  goacc_unmap_vars (tgt, true, aq);
 
   if (profiling_p)
     {
@@ -415,7 +412,8 @@ GOACC_data_start (int flags_m, size_t mapnum,
        = _ACC_OTHER_EVENT_INFO_VALID_BYTES;
       enter_data_event_info.other_event.parent_construct = acc_construct_data;
       for (int i = 0; i < mapnum; ++i)
-       if ((kinds[i] & 0xff) == GOMP_MAP_USE_DEVICE_PTR)
+       if ((kinds[i] & 0xff) == GOMP_MAP_USE_DEVICE_PTR
+           || (kinds[i] & 0xff) == GOMP_MAP_USE_DEVICE_PTR_IF_PRESENT)
          {
            /* If there is one such data mapping kind, then this is actually an
               OpenACC 'host_data' construct.  (GCC maps the OpenACC
@@ -455,8 +453,7 @@ GOACC_data_start (int flags_m, size_t mapnum,
     {
       prof_info.device_type = acc_device_host;
       api_info.device_type = prof_info.device_type;
-      tgt = gomp_map_vars (NULL, 0, NULL, NULL, NULL, NULL, true,
-                          GOMP_MAP_VARS_OPENACC);
+      tgt = goacc_map_vars (NULL, NULL, 0, NULL, NULL, NULL, NULL, true, 0);
       tgt->prev = thr->mapped_data;
       thr->mapped_data = tgt;
 
@@ -464,8 +461,8 @@ GOACC_data_start (int flags_m, size_t mapnum,
     }
 
   gomp_debug (0, "  %s: prepare mappings\n", __FUNCTION__);
-  tgt = gomp_map_vars (acc_dev, mapnum, hostaddrs, NULL, sizes, kinds, true,
-                      GOMP_MAP_VARS_OPENACC);
+  tgt = goacc_map_vars (acc_dev, NULL, mapnum, hostaddrs, NULL, sizes, kinds,
+                       true, 0);
   gomp_debug (0, "  %s: mappings prepared\n", __FUNCTION__);
   tgt->prev = thr->mapped_data;
   thr->mapped_data = tgt;
@@ -541,7 +538,7 @@ GOACC_data_end (void)
 
   gomp_debug (0, "  %s: restore mappings\n", __FUNCTION__);
   thr->mapped_data = tgt->prev;
-  gomp_unmap_vars (tgt, true);
+  goacc_unmap_vars (tgt, true, NULL);
   gomp_debug (0, "  %s: mappings restored\n", __FUNCTION__);
 
   if (profiling_p)
@@ -727,61 +724,3 @@ GOACC_get_thread_num (void)
 {
   return 0;
 }
-
-void
-GOACC_declare (int flags_m, size_t mapnum,
-              void **hostaddrs, size_t *sizes, unsigned short *kinds)
-{
-  int i;
-
-  for (i = 0; i < mapnum; i++)
-    {
-      unsigned char kind = kinds[i] & 0xff;
-
-      if (kind == GOMP_MAP_POINTER || kind == GOMP_MAP_TO_PSET)
-       continue;
-
-      switch (kind)
-       {
-         case GOMP_MAP_FORCE_ALLOC:
-         case GOMP_MAP_FORCE_FROM:
-         case GOMP_MAP_FORCE_TO:
-         case GOMP_MAP_POINTER:
-         case GOMP_MAP_RELEASE:
-         case GOMP_MAP_DELETE:
-           GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-                                  &kinds[i], GOMP_ASYNC_SYNC, 0);
-           break;
-
-         case GOMP_MAP_FORCE_DEVICEPTR:
-           break;
-
-         case GOMP_MAP_ALLOC:
-           if (!acc_is_present (hostaddrs[i], sizes[i]))
-             GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-                                    &kinds[i], GOMP_ASYNC_SYNC, 0);
-           break;
-
-         case GOMP_MAP_TO:
-           GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-                                  &kinds[i], GOMP_ASYNC_SYNC, 0);
-
-           break;
-
-         case GOMP_MAP_FROM:
-           GOACC_enter_exit_data (flags_m, 1, &hostaddrs[i], &sizes[i],
-                                  &kinds[i], GOMP_ASYNC_SYNC, 0);
-           break;
-
-         case GOMP_MAP_FORCE_PRESENT:
-           if (!acc_is_present (hostaddrs[i], sizes[i]))
-             gomp_fatal ("[%p,%ld] is not mapped", hostaddrs[i],
-                         (unsigned long) sizes[i]);
-           break;
-
-         default:
-           assert (0);
-           break;
-       }
-    }
-}