public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] openacc: Turn off worker partitioning if num_workers==1
@ 2021-05-13 16:15 Kwok Yeung
  0 siblings, 0 replies; only message in thread
From: Kwok Yeung @ 2021-05-13 16:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4a4f6b3f3b94f33fe28e0e83b8f309eae2e7ed24

commit 4a4f6b3f3b94f33fe28e0e83b8f309eae2e7ed24
Author: Julian Brown <julian@codesourcery.com>
Date:   Mon Jan 20 11:42:28 2020 -0800

    openacc: Turn off worker partitioning if num_workers==1
    
    This patch turns off the middle-end worker-partitioning support if the
    number of workers for an outlined offload function is one.  In that case,
    we do not need to perform the broadcasting/neutering code transformation.
    
    2020-07-15  Julian Brown  <julian@codesourcery.com>
    
    gcc/
            * omp-offload.c (pass_oacc_gimple_workers::gate): Disable worker
            partitioning if num_workers is 1.

Diff:
---
 gcc/ChangeLog.omp |  5 +++++
 gcc/omp-offload.c | 15 ++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index d1b0640c9ea..500a58e5fd3 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,8 @@
+2020-07-15  Julian Brown  <julian@codesourcery.com>
+
+	* omp-offload.c (pass_oacc_gimple_workers::gate): Disable worker
+	partitioning if num_workers is 1.
+
 2020-06-06  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
 	* omp-sese.c (oacc_build_component_ref): Apply address space of
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c
index 21e9b923443..22bb3ac1c40 100644
--- a/gcc/omp-offload.c
+++ b/gcc/omp-offload.c
@@ -2400,7 +2400,20 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *)
   {
-    return flag_openacc && targetm.goacc.worker_partitioning;
+    if (!flag_openacc || !targetm.goacc.worker_partitioning)
+      return false;
+
+    tree attr = oacc_get_fn_attrib (current_function_decl);
+
+    if (!attr)
+      /* Not an offloaded function.  */
+      return false;
+
+    int worker_dim
+      = oacc_get_fn_dim_size (current_function_decl, GOMP_DIM_WORKER);
+
+    /* No worker partitioning if we know the number of workers is 1.  */
+    return worker_dim != 1;
   };
 
   virtual unsigned int execute (function *)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-13 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 16:15 [gcc/devel/omp/gcc-11] openacc: Turn off worker partitioning if num_workers==1 Kwok Yeung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).