From patchwork Wed Mar 16 14:12:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 598404 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3qQD3T6z5Mz9sRZ for ; Thu, 17 Mar 2016 01:13:08 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=yuWxjlz2; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=OTd8YNdLF5U0ZkvuQ8q8xIxMV72Z62OYE21FiFN/rwBv+GEm6tiqm 2EVJj/coL6sPAHnTvzShHokSWYGbrfz8kOgECwK/kV120pssExU300j43tLaqNNV 2xR8ItTxknnqWWgy0xy9cJZBaFyQAE6KANA1+3k/1s972pPWjuqRXo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=J4BUtajXAeldxrqMdb45mlBQ3MY=; b=yuWxjlz2LTsA2xw7WEf7 YIY2s/3eXTXSv8ZO0v8+GUtMVFk6W1joOXZUMaedMqtPSlWaVAPEt2+dcC3TW0sO hmFWrrReVq0R1nyOJ9Cji9XLlW8gkui9dJli+3tta00gHE02nYt/YGiduxKwrB0m kgmaUU23eWyUbIVWhZ2TW9E= Received: (qmail 35164 invoked by alias); 16 Mar 2016 14:13:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 35140 invoked by uid 89); 16 Mar 2016 14:12:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=autumn, moves, standalone, dist X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 16 Mar 2016 14:12:55 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9F9FCAC46 for ; Wed, 16 Mar 2016 14:12:51 +0000 (UTC) Date: Wed, 16 Mar 2016 15:12:51 +0100 From: Martin Jambor To: GCC Patches Subject: [omp] Create openmp -fopt-info optimization group Message-ID: <20160316141251.GF9566@virgil.suse.cz> Mail-Followup-To: GCC Patches MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes Hi, the following patch does two things. First, it creates a new optinfo group for OpenMP and moves OpenMP lowering and expansion to this group. Second, it changes all gridification MSG_NOTE dumps to MSG_MISSED_OPTIMIZATION, which is more appropriate. (Apparently, I remembered to change the dump about performed gridification to MSG_OPTIMIZED_LOCATIONS last autumn but failed to do it for dumps with failure reasons). With these changes, users that configured their compiler with HSA can use (for example) the -fopt-info-all-openmp option to get information about which target constructs have been gridified and which were not: mjambor@virgil:~/gcc/hsa/tests/grid$ ~/gcc/hsa/inst/bin/gcc -fopenmp -O combined-hsa.c -fopt-info-all-openmp combined-hsa.c:9:9: note: Target construct will be turned into a gridified GPGPU kernel or /home/mjambor/gcc/hsa/src/libgomp/testsuite/libgomp.c/examples-4/target_data-3.c:50:10: note: Will not turn target construct into a simple GPGPU kernel because it does not have a sole teams construct in it. and so forth. I have bootstrapped and tested the patch on x86_64-linux (with and without configured HSA) and by running make info and examining the generated info files. Since it is only a dumping change, I'd like to propose it for trunk even at this late stage. If release managers however do not think it is desirable, I'll commit it to the hsa branch and propose to trunk again once stage1 opens. Thanks, Martin 2016-03-14 Martin Jambor * doc/invoke.texi (-fopt-info): Document openmp optimization group. * doc/optinfo.texi (Optimization groups): Document OPTGROUP_OPENMP. * dumpfile.c (optgroup_options): Add entry for OpenMP optimizations. * dumpfile.h (OPTGROUP_OPENMP): New define. * omp-low.c (pass_data_expand_omp): Change optinfo_flags to OPTGROUP_OPENMP. (pass_data_expand_omp_ssa): Likewise. (pass_data_lower_omp): Likewise. (pass_data_omp_simd_clone): Likewise. (grid_find_single_omp_among_assignments_1): Changed all occurrences of MSG_NOTE to MSG_MISSED_OPTIMIZATION. (grid_find_single_omp_among_assignments): Likewise. (grid_target_follows_gridifiable_pattern): Likewise. --- gcc/doc/invoke.texi | 2 ++ gcc/doc/optinfo.texi | 3 +++ gcc/dumpfile.c | 1 + gcc/dumpfile.h | 3 ++- gcc/omp-low.c | 56 ++++++++++++++++++++++++++-------------------------- 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 99ac11b..5c798a4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -12194,6 +12194,8 @@ Enable dumps from all interprocedural optimizations. Enable dumps from all loop optimizations. @item inline Enable dumps from all inlining optimizations. +@item openmp +Enable dumps from OpenMP optimizations. @item vec Enable dumps from all vectorization optimizations. @item optall diff --git a/gcc/doc/optinfo.texi b/gcc/doc/optinfo.texi index 3c8fdba..20ca560 100644 --- a/gcc/doc/optinfo.texi +++ b/gcc/doc/optinfo.texi @@ -59,6 +59,9 @@ Loop optimization passes. Enabled by @option{-loop}. @item OPTGROUP_INLINE Inlining passes. Enabled by @option{-inline}. +@item OPTGROUP_OPENMP +OpenMP passes. Enabled by @option{-openmp}. + @item OPTGROUP_VEC Vectorization passes. Enabled by @option{-vec}. diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index 144e371..f2430f3 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -136,6 +136,7 @@ static const struct dump_option_value_info optgroup_options[] = {"ipa", OPTGROUP_IPA}, {"loop", OPTGROUP_LOOP}, {"inline", OPTGROUP_INLINE}, + {"openmp", OPTGROUP_OPENMP}, {"vec", OPTGROUP_VEC}, {"optall", OPTGROUP_ALL}, {NULL, 0} diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index c168cbf..72f696b 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -97,7 +97,8 @@ enum tree_dump_index #define OPTGROUP_LOOP (1 << 2) /* Loop optimization passes */ #define OPTGROUP_INLINE (1 << 3) /* Inlining passes */ #define OPTGROUP_VEC (1 << 4) /* Vectorization passes */ -#define OPTGROUP_OTHER (1 << 5) /* All other passes */ +#define OPTGROUP_OPENMP (1 << 5) /* OpenMP specific transformations */ +#define OPTGROUP_OTHER (1 << 6) /* All other passes */ #define OPTGROUP_ALL (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \ | OPTGROUP_VEC | OPTGROUP_OTHER) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 82dec9d..6f42717 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -13990,7 +13990,7 @@ const pass_data pass_data_expand_omp = { GIMPLE_PASS, /* type */ "ompexp", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ + OPTGROUP_OPENMP, /* optinfo_flags */ TV_NONE, /* tv_id */ PROP_gimple_any, /* properties_required */ PROP_gimple_eomp, /* properties_provided */ @@ -14037,7 +14037,7 @@ const pass_data pass_data_expand_omp_ssa = { GIMPLE_PASS, /* type */ "ompexpssa", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ + OPTGROUP_OPENMP, /* optinfo_flags */ TV_NONE, /* tv_id */ PROP_cfg | PROP_ssa, /* properties_required */ PROP_gimple_eomp, /* properties_provided */ @@ -17210,7 +17210,7 @@ grid_find_single_omp_among_assignments_1 (gimple_seq seq, location_t target_loc, if (*ret) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, target_loc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, target_loc, "Will not turn target construct into a simple " "GPGPU kernel because %s construct contains " "multiple OpenMP constructs\n", name); @@ -17221,7 +17221,7 @@ grid_find_single_omp_among_assignments_1 (gimple_seq seq, location_t target_loc, else { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, target_loc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, target_loc, "Will not turn target construct into a simple " "GPGPU kernel because %s construct contains " "a complex statement\n", name); @@ -17244,7 +17244,7 @@ grid_find_single_omp_among_assignments (gimple_seq seq, location_t target_loc, if (!seq) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, target_loc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, target_loc, "Will not turn target construct into a simple " "GPGPU kernel because %s construct has empty " "body\n", @@ -17256,7 +17256,7 @@ grid_find_single_omp_among_assignments (gimple_seq seq, location_t target_loc, if (grid_find_single_omp_among_assignments_1 (seq, target_loc, name, &ret)) { if (!ret && dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, target_loc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, target_loc, "Will not turn target construct into a simple " "GPGPU kernel because %s construct does not contain" "any other OpenMP construct\n", name); @@ -17340,7 +17340,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p tree group_size = NULL; if (!teams) { - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a simple " "GPGPU kernel because it does not have a sole teams " "construct in it.\n"); @@ -17354,7 +17354,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p { case OMP_CLAUSE_NUM_TEAMS: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because we cannot " "handle num_teams clause of teams " @@ -17363,7 +17363,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p case OMP_CLAUSE_REDUCTION: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because a reduction " "clause is present\n "); @@ -17371,7 +17371,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p case OMP_CLAUSE_LASTPRIVATE: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because a lastprivate " "clause is present\n "); @@ -17394,7 +17394,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p gomp_for *dist = dyn_cast (stmt); if (!dist) { - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a simple " "GPGPU kernel because the teams construct does not have " "a sole distribute construct in it.\n"); @@ -17405,7 +17405,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (!gimple_omp_for_combined_p (dist)) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified GPGPU " "kernel because we cannot handle a standalone " "distribute construct\n "); @@ -17414,7 +17414,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (dist->collapse > 1) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified GPGPU " "kernel because the distribute construct contains " "collapse clause\n"); @@ -17427,7 +17427,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (group_size && !operand_equal_p (group_size, fd.chunk_size, 0)) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because the teams " "thread limit is different from distribute " @@ -17449,7 +17449,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p { case OMP_CLAUSE_NUM_THREADS: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified" "GPGPU kernel because there is a num_threads " "clause of the parallel construct\n"); @@ -17457,7 +17457,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p case OMP_CLAUSE_REDUCTION: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because a reduction " "clause is present\n "); @@ -17465,7 +17465,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p case OMP_CLAUSE_LASTPRIVATE: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because a lastprivate " "clause is present\n "); @@ -17486,7 +17486,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (gimple_omp_for_kind (gfor) != GF_OMP_FOR_KIND_FOR) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified GPGPU " "kernel because the inner loop is not a simple for " "loop\n"); @@ -17495,7 +17495,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (gfor->collapse > 1) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified GPGPU " "kernel because the inner loop contains collapse " "clause\n"); @@ -17505,7 +17505,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (!grid_seq_only_contains_local_assignments (gimple_omp_for_pre_body (gfor))) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified GPGPU " "kernel because the inner loop pre_body contains" "a complex instruction\n"); @@ -17521,7 +17521,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (OMP_CLAUSE_SCHEDULE_KIND (clauses) != OMP_CLAUSE_SCHEDULE_AUTO) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because the inner " "loop has a non-automatic scheduling clause\n"); @@ -17531,7 +17531,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p case OMP_CLAUSE_REDUCTION: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because a reduction " "clause is present\n "); @@ -17539,7 +17539,7 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p case OMP_CLAUSE_LASTPRIVATE: if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a " "gridified GPGPU kernel because a lastprivate " "clause is present\n "); @@ -17561,17 +17561,17 @@ grid_target_follows_gridifiable_pattern (gomp_target *target, tree *group_size_p if (dump_enabled_p ()) { if (is_gimple_call (bad)) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified " " GPGPU kernel because the inner loop contains " "call to a noreturn function\n"); if (gimple_code (bad) == GIMPLE_OMP_FOR) - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified " " GPGPU kernel because the inner loop contains " "a simd construct\n"); else - dump_printf_loc (MSG_NOTE, tloc, + dump_printf_loc (MSG_MISSED_OPTIMIZATION, tloc, "Will not turn target construct into a gridified " "GPGPU kernel because the inner loop contains " "statement %s which cannot be transformed\n", @@ -17895,7 +17895,7 @@ const pass_data pass_data_lower_omp = { GIMPLE_PASS, /* type */ "omplower", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ + OPTGROUP_OPENMP, /* optinfo_flags */ TV_NONE, /* tv_id */ PROP_gimple_any, /* properties_required */ PROP_gimple_lomp, /* properties_provided */ @@ -19895,7 +19895,7 @@ const pass_data pass_data_omp_simd_clone = { SIMPLE_IPA_PASS, /* type */ "simdclone", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ + OPTGROUP_OPENMP, /* optinfo_flags */ TV_NONE, /* tv_id */ ( PROP_ssa | PROP_cfg ), /* properties_required */ 0, /* properties_provided */