]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: enable reverse offload for AMDGCN
authorTobias Burnus <tobias@codesourcery.com>
Fri, 3 Feb 2023 07:33:17 +0000 (08:33 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Fri, 3 Feb 2023 07:33:17 +0000 (08:33 +0100)
libgomp/ChangeLog:

* libgomp.texi (5.0 Impl. Status, gcn specifics): Update for
reverse offload.
* plugin/plugin-gcn.c (GOMP_OFFLOAD_get_num_devices): Accept
reverse-offload requirement.

libgomp/libgomp.texi
libgomp/plugin/plugin-gcn.c

index 1f84b050eb265ac2591453d821aa04da2ecbe23d..698ae330942ddb2f85313bdafa24e23431c2f69a 100644 (file)
@@ -227,8 +227,7 @@ The OpenMP 4.5 specification is fully supported.
 @item @code{allocate} directive @tab N @tab
 @item @code{allocate} clause @tab P @tab Initial support
 @item @code{use_device_addr} clause on @code{target data} @tab Y @tab
-@item @code{ancestor} modifier on @code{device} clause
-      @tab Y @tab Host fallback with GCN devices
+@item @code{ancestor} modifier on @code{device} clause @tab Y @tab
 @item Implicit declare target directive @tab Y @tab
 @item Discontiguous array section with @code{target update} construct
       @tab N @tab
@@ -4455,9 +4454,13 @@ The implementation remark:
 @item I/O within OpenMP target regions and OpenACC parallel/kernels is supported
       using the C library @code{printf} functions and the Fortran
       @code{print}/@code{write} statements.
-@item OpenMP code that has a requires directive with @code{unified_address},
-      @code{unified_shared_memory} or @code{reverse_offload} will remove
-      any GCN device from the list of available devices (``host fallback'').
+@item Reverse offload (i.e. @code{target} regions with
+      @code{device(ancestor:1)}) are processed serially per @code{target} region
+      such that the next reverse offload region is only executed after the previous
+      one returned.
+@item OpenMP code that has a requires directive with @code{unified_address} or
+      @code{unified_shared_memory} will remove any GCN device from the list of
+      available devices (``host fallback'').
 @end itemize
 
 
index a7b35059ab3c6cc8d98bd63851a204605f95b5c5..11ce6b0fa8db43ab15321d117f65598ba20420f5 100644 (file)
@@ -3262,7 +3262,8 @@ GOMP_OFFLOAD_get_num_devices (unsigned int omp_requires_mask)
     return 0;
   /* Return -1 if no omp_requires_mask cannot be fulfilled but
      devices were present.  */
-  if (hsa_context.agent_count > 0 && omp_requires_mask != 0)
+  if (hsa_context.agent_count > 0
+      && (omp_requires_mask & ~GOMP_REQUIRES_REVERSE_OFFLOAD) != 0)
     return -1;
   return hsa_context.agent_count;
 }