diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2016-05-02 13:16:22 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2016-05-02 13:16:22 +0000 |
commit | 5b37e8664b05336df60996a2411b4d61a852c613 (patch) | |
tree | 87acdea4347b49c250d21fc4ba6bac0ece39f7c3 /gcc/omp-low.c | |
parent | 87cdf04b1adacaf5dc161d2c0c1f990f4a36d67f (diff) | |
download | gcc-5b37e8664b05336df60996a2411b4d61a852c613.zip gcc-5b37e8664b05336df60996a2411b4d61a852c613.tar.gz gcc-5b37e8664b05336df60996a2411b4d61a852c613.tar.bz2 |
omp-low.c (struct oacc_loop): Add 'inner' field.
gcc/
* omp-low.c (struct oacc_loop): Add 'inner' field.
(new_oacc_loop_raw): Initialize it to zero.
(oacc_loop_fixed_partitions): Initialize it.
(oacc_loop_auto_partitions): Partition outermost loop to outermost
available partitioning.
gcc/testsuite/
* c-c++-common/goacc/loop-auto-1.c: Adjust expected warnings.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/loop-auto-1.c: Adjust
expected partitioning.
From-SVN: r235756
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 50ad68e..e4a1e47 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -241,6 +241,7 @@ struct oacc_loop tree routine; /* Pseudo-loop enclosing a routine. */ unsigned mask; /* Partitioning mask. */ + unsigned inner; /* Partitioning of inner loops. */ unsigned flags; /* Partitioning flags. */ unsigned ifns; /* Contained loop abstraction functions. */ tree chunk_size; /* Chunk size. */ @@ -18921,7 +18922,7 @@ new_oacc_loop_raw (oacc_loop *parent, location_t loc) memset (loop->tails, 0, sizeof (loop->tails)); loop->routine = NULL_TREE; - loop->mask = loop->flags = 0; + loop->mask = loop->flags = loop->inner = 0; loop->ifns = 0; loop->chunk_size = 0; loop->head_end = NULL; @@ -19449,8 +19450,11 @@ oacc_loop_fixed_partitions (oacc_loop *loop, unsigned outer_mask) mask_all |= this_mask; if (loop->child) - mask_all |= oacc_loop_fixed_partitions (loop->child, - outer_mask | this_mask); + { + loop->inner = oacc_loop_fixed_partitions (loop->child, + outer_mask | this_mask); + mask_all |= loop->inner; + } if (loop->sibling) mask_all |= oacc_loop_fixed_partitions (loop->sibling, outer_mask); @@ -19466,7 +19470,7 @@ oacc_loop_fixed_partitions (oacc_loop *loop, unsigned outer_mask) static unsigned oacc_loop_auto_partitions (oacc_loop *loop, unsigned outer_mask) { - unsigned inner_mask = 0; + bool assign = (loop->flags & OLF_AUTO) && (loop->flags & OLF_INDEPENDENT); bool noisy = true; #ifdef ACCEL_COMPILER @@ -19475,16 +19479,33 @@ oacc_loop_auto_partitions (oacc_loop *loop, unsigned outer_mask) noisy = false; #endif + if (assign && outer_mask < GOMP_DIM_MASK (GOMP_DIM_MAX - 1)) + { + /* Allocate the outermost loop at the outermost available + level. */ + unsigned this_mask = outer_mask + 1; + + if (!(this_mask & loop->inner)) + loop->mask = this_mask; + } + if (loop->child) - inner_mask |= oacc_loop_auto_partitions (loop->child, - outer_mask | loop->mask); + { + unsigned child_mask = outer_mask | loop->mask; + + if (loop->mask || assign) + child_mask |= GOMP_DIM_MASK (GOMP_DIM_MAX); - if ((loop->flags & OLF_AUTO) && (loop->flags & OLF_INDEPENDENT)) + loop->inner = oacc_loop_auto_partitions (loop->child, child_mask); + } + + if (assign && !loop->mask) { + /* Allocate the loop at the innermost available level. */ unsigned this_mask = 0; /* Determine the outermost partitioning used within this loop. */ - this_mask = inner_mask | GOMP_DIM_MASK (GOMP_DIM_MAX); + this_mask = loop->inner | GOMP_DIM_MASK (GOMP_DIM_MAX); this_mask = (this_mask & -this_mask); /* Pick the partitioning just inside that one. */ @@ -19497,17 +19518,20 @@ oacc_loop_auto_partitions (oacc_loop *loop, unsigned outer_mask) warning_at (loop->loc, 0, "insufficient partitioning available to parallelize loop"); - if (dump_file) - fprintf (dump_file, "Auto loop %s:%d assigned %d\n", - LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc), - this_mask); - loop->mask = this_mask; } - inner_mask |= loop->mask; + + if (assign && dump_file) + fprintf (dump_file, "Auto loop %s:%d assigned %d\n", + LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc), + loop->mask); + + unsigned inner_mask = 0; if (loop->sibling) inner_mask |= oacc_loop_auto_partitions (loop->sibling, outer_mask); + + inner_mask |= loop->inner | loop->mask; return inner_mask; } |