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.
+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
/* 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 *)