[PATCH 36/40] openacc: Enable reduction variable localization for "kernels"
Frederik Harwath
frederik@codesourcery.com
Wed Dec 15 15:54:43 GMT 2021
gcc/ChangeLog:
* gimplify.c (gimplify_omp_for): Enable localization on
"kernels" regions.
(gimplify_omp_workshare): Likewise.
---
gcc/gimplify.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index bf37388f947c..a0137089496b 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -12229,11 +12229,9 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
&& outer->region_type != ORT_ACC_KERNELS)
outer = outer->outer_context;
- /* FIXME: Reductions only work in parallel regions at present. We avoid
- doing the reduction localization transformation in kernels regions
- here, because the code to remove reductions in kernels regions cannot
- handle that. */
- if (outer && outer->region_type == ORT_ACC_PARALLEL)
+ if (outer && (outer->region_type == ORT_ACC_PARALLEL
+ || (outer->region_type == ORT_ACC_KERNELS
+ && param_openacc_kernels == OPENACC_KERNELS_DECOMPOSE)))
localize_reductions (OMP_FOR_CLAUSES (for_stmt),
OMP_FOR_BODY (for_stmt));
}
@@ -13767,8 +13765,9 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p)
{
push_gimplify_context ();
- /* FIXME: Reductions are not supported in kernels regions yet. */
- if (/*ort == ORT_ACC_KERNELS ||*/ ort == ORT_ACC_PARALLEL)
+ if (ort == ORT_ACC_PARALLEL
+ || (ort == ORT_ACC_KERNELS
+ && param_openacc_kernels == OPENACC_KERNELS_DECOMPOSE))
localize_reductions (OMP_CLAUSES (expr), OMP_BODY (expr));
gimple *g = gimplify_and_return_first (OMP_BODY (expr), &body);
--
2.33.0
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
More information about the Gcc-patches
mailing list