From: Julian Brown Date: Mon, 20 Jan 2020 19:42:28 +0000 (-0800) Subject: openacc: Turn off worker partitioning if num_workers==1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22a3ca1e6605fc75bcf1264a70ca4514317e8476;p=thirdparty%2Fgcc.git 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 gcc/ * omp-offload.c (pass_oacc_gimple_workers::gate): Disable worker partitioning if num_workers is 1. --- diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp index 8ceb7af77124..b1553758db23 100644 --- a/gcc/ChangeLog.omp +++ b/gcc/ChangeLog.omp @@ -1,3 +1,8 @@ +2020-07-15 Julian Brown + + * omp-offload.c (pass_oacc_gimple_workers::gate): Disable worker + partitioning if num_workers is 1. + 2020-07-15 Julian Brown * config/gcn/mkoffload.c (process_asm): Initialise regcount. Update diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c index bf72782ba4ce..2b730d057781 100644 --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -2165,7 +2165,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 *)