diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2018-12-14 21:41:58 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2018-12-14 21:41:58 +0100 |
commit | 5d390fd3ae4e2de66b4f53efbb657ea01fee5620 (patch) | |
tree | 79273ca3c675e032a4b134069769b88030d859f6 /gcc/omp-offload.c | |
parent | 890b87d1743154cc57f54e6085e292b537dba428 (diff) |
Add user-friendly diagnostics for OpenACC loop parallelism assigned
gcc/
* omp-offload.c (inform_oacc_loop): New function.
(execute_oacc_device_lower): Use it to display loop parallelism.
gcc/testsuite/
* c-c++-common/goacc/note-parallelism.c: New test.
* gfortran.dg/goacc/note-parallelism.f90: New test.
* c-c++-common/goacc/classify-kernels-unparallelized.c: Update.
* c-c++-common/goacc/classify-kernels.c: Likewise.
* c-c++-common/goacc/classify-parallel.c: Likewise.
* c-c++-common/goacc/classify-routine.c: Likewise.
* c-c++-common/goacc/kernels-1.c: Likewise.
* c-c++-common/goacc/kernels-double-reduction-n.c: Likewise.
* c-c++-common/goacc/kernels-double-reduction.c: Likewise.
* gfortran.dg/goacc/classify-kernels-unparallelized.f95: Likewise.
* gfortran.dg/goacc/classify-kernels.f95: Likewise.
* gfortran.dg/goacc/classify-parallel.f95: Likewise.
* gfortran.dg/goacc/classify-routine.f95: Likewise.
* gfortran.dg/goacc/kernels-loop-inner.f95: Likewise.
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
From-SVN: r267146
Diffstat (limited to 'gcc/omp-offload.c')
-rw-r--r-- | gcc/omp-offload.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c index 0abf0283c9e..4457e1a3079 100644 --- a/gcc/omp-offload.c +++ b/gcc/omp-offload.c @@ -823,7 +823,7 @@ dump_oacc_loop_part (FILE *file, gcall *from, int depth, } } -/* Dump OpenACC loops LOOP, its siblings and its children. */ +/* Dump OpenACC loop LOOP, its children, and its siblings. */ static void dump_oacc_loop (FILE *file, oacc_loop *loop, int depth) @@ -866,6 +866,31 @@ debug_oacc_loop (oacc_loop *loop) dump_oacc_loop (stderr, loop, 0); } +/* Provide diagnostics on OpenACC loop LOOP, its children, and its + siblings. */ + +static void +inform_oacc_loop (const oacc_loop *loop) +{ + const char *gang + = loop->mask & GOMP_DIM_MASK (GOMP_DIM_GANG) ? " gang" : ""; + const char *worker + = loop->mask & GOMP_DIM_MASK (GOMP_DIM_WORKER) ? " worker" : ""; + const char *vector + = loop->mask & GOMP_DIM_MASK (GOMP_DIM_VECTOR) ? " vector" : ""; + const char *seq = loop->mask == 0 ? " seq" : ""; + const dump_user_location_t loc + = dump_user_location_t::from_location_t (loop->loc); + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc, + "assigned OpenACC%s%s%s%s loop parallelism\n", gang, worker, + vector, seq); + + if (loop->child) + inform_oacc_loop (loop->child); + if (loop->sibling) + inform_oacc_loop (loop->sibling); +} + /* DFS walk of basic blocks BB onwards, creating OpenACC loop structures as we go. By construction these loops are properly nested. */ @@ -1533,6 +1558,28 @@ execute_oacc_device_lower () dump_oacc_loop (dump_file, loops, 0); fprintf (dump_file, "\n"); } + if (dump_enabled_p ()) + { + oacc_loop *l = loops; + /* OpenACC kernels constructs are special: they currently don't use the + generic oacc_loop infrastructure. */ + if (is_oacc_kernels) + { + /* Create a fake oacc_loop for diagnostic purposes. */ + l = new_oacc_loop_raw (NULL, + DECL_SOURCE_LOCATION (current_function_decl)); + l->mask = used_mask; + } + else + { + /* Skip the outermost, dummy OpenACC loop */ + l = l->child; + } + if (l) + inform_oacc_loop (l); + if (is_oacc_kernels) + free_oacc_loop (l); + } /* Offloaded targets may introduce new basic blocks, which require dominance information to update SSA. */ |