This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gomp4] auto partitioning tweak
- From: Nathan Sidwell <nathan at acm dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 4 Oct 2016 09:14:08 -0400
- Subject: [gomp4] auto partitioning tweak
- Authentication-results: sourceware.org; auth=none
We were determining in the host compiler as to whethe a particular loop had no
explicit partitioning. That'll break down if device_type comes into play. My
tiling patch exposed this difficulty, as tiling itself ends up essentially being
two nested loops, one of which could be explicitly partitioned and the other
not. So addressing this problem now.
Hopefully this is the last tweak before the tile patch itself.
nathan
2016-10-04 Nathan Sidwell <nathan@codesourcery.com>
* omp-low.c (lower_oacc_head_mark): Don't determine default auto
here ...
(oacc_loop_fixed_partitions): ... do it here instead.
Index: omp-low.c
===================================================================
--- omp-low.c (revision 240731)
+++ omp-low.c (working copy)
@@ -6394,14 +6394,13 @@ lower_oacc_head_mark (location_t loc, tr
if (!tgt || is_oacc_parallel (tgt))
tag |= OLF_INDEPENDENT;
- /* A loop lacking SEQ, GANG, WORKER and/or VECTOR is implicitly AUTO. */
- if (!(tag & (((GOMP_DIM_MASK (GOMP_DIM_MAX) - 1) << OLF_DIM_BASE)
- | OLF_SEQ)))
- tag |= OLF_AUTO;
-
- /* Ensure at least one level, or 2 for AUTO partitioning */
- if (levels < 1 + ((tag & OLF_AUTO) != 0))
- levels = 1 + ((tag & OLF_AUTO) != 0);
+ /* A loop lacking SEQ, GANG, WORKER and/or VECTOR could be AUTO */
+ bool maybe_auto = !(tag & (((GOMP_DIM_MASK (GOMP_DIM_MAX) - 1)
+ << OLF_DIM_BASE) | OLF_SEQ));
+
+ /* Ensure at least one level, or 2 for possible auto partitioning */
+ if (levels < 1u + maybe_auto)
+ levels = 1u + maybe_auto;
args.quick_push (build_int_cst (integer_type_node, levels));
args.quick_push (build_int_cst (integer_type_node, tag));
@@ -19759,6 +19758,8 @@ oacc_loop_fixed_partitions (oacc_loop *l
this_mask = ((loop->flags >> OLF_DIM_BASE)
& (GOMP_DIM_MASK (GOMP_DIM_MAX) - 1));
+ bool maybe_auto = !seq_par && !this_mask;
+
if ((this_mask != 0) + auto_par + seq_par > 1)
{
if (noisy)
@@ -19766,7 +19767,7 @@ oacc_loop_fixed_partitions (oacc_loop *l
seq_par
? "%<seq%> overrides other OpenACC loop specifiers"
: "%<auto%> conflicts with other OpenACC loop specifiers");
- auto_par = false;
+ maybe_auto = false;
loop->flags &= ~OLF_AUTO;
if (seq_par)
{
@@ -19775,8 +19776,11 @@ oacc_loop_fixed_partitions (oacc_loop *l
this_mask = 0;
}
}
- if (auto_par && (loop->flags & OLF_INDEPENDENT))
- mask_all |= GOMP_DIM_MASK (GOMP_DIM_MAX);
+ if (maybe_auto && (loop->flags & OLF_INDEPENDENT))
+ {
+ loop->flags |= OLF_AUTO;
+ mask_all |= GOMP_DIM_MASK (GOMP_DIM_MAX);
+ }
}
if (this_mask & outer_mask)