From patchwork Mon Oct 19 07:27:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 532179 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 0043F1401F6 for ; Mon, 19 Oct 2015 18:28:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=azg6SHM8; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=fpJw5EC+++x11QcsMmzlV0+lOykYkjNzW5MTC+A0ILO+yTsI2R Q33IMBSCFzlcz+2iv/oVDdtneErMh6XCqLPsC/ZhyfL9TYq8m6NMgmZi7MFtcb8h j2XStfeCl4+XV6HVySjduPVNxZNFQMQ8m9QVWY7PBJ+AhNqHyI9rlPjwg= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=tPZxutZfvFNoiOq9IvWWKnu+8fE=; b=azg6SHM8lctU1mdSx94P EFUepU59IF0lsj4iOAs3xkX0pIY5sZ8KTEVQbHKwqlCDqa/jGJsH6BHu5A87+9p4 CrJi2/grrInuyQDxu5wnXBxmMbddhTEmrBrWKYbuCvtzYkh4QNNwG7RqQupDKBF5 Sw7g908M2F/x1ST1kLdxqPU= Received: (qmail 78146 invoked by alias); 19 Oct 2015 07:28:16 -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 78133 invoked by uid 89); 19 Oct 2015 07:28:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 19 Oct 2015 07:28:13 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35836) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1Zo4rb-0004JK-D8 for gcc-patches@gnu.org; Mon, 19 Oct 2015 03:28:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zo4rV-00039z-Vw for gcc-patches@gnu.org; Mon, 19 Oct 2015 03:28:10 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:58769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zo4rV-00039p-PU for gcc-patches@gnu.org; Mon, 19 Oct 2015 03:28:05 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Zo4rS-00078x-Vf from Tom_deVries@mentor.com for gcc-patches@gnu.org; Mon, 19 Oct 2015 00:28:03 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Mon, 19 Oct 2015 08:28:01 +0100 To: "gcc-patches@gnu.org" From: Tom de Vries Subject: [RFC] Add OPTGROUP_PAR Message-ID: <56249B7D.6010301@mentor.com> Date: Mon, 19 Oct 2015 09:27:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Hi, this patch adds OPTGROUP_PAR. It allows a user to see on stderr what loops are parallelized by pass_parallelize_loops, using -fopt-info-par: ... $ gcc -O2 -fopt-info-par test.c -ftree-parallelize-loops=32 test.c:5:3: note: parallelized inner loop ... This patch doesn't include any MSG_MISSED_OPTIMIZATION/MSG_NOTE messages yet. Idea of the patch OK? Any other comments? Thanks, - Tom Add OPTGROUP_PAR 2015-10-19 Tom de Vries * doc/invoke.texi (@item -fopt-info): Add @item par in group of optimizations table. * dumpfile.c (optgroup_options): Add OPTGROUP_PAR entry. * dumpfile.h (OPTGROUP_PAR): New define. (OPTGROUP_OTHER): Renumber. (OPTGROUP_ALL): Add OPTGROUP_PAR. * tree-parloops.c (parallelize_loops): Handle -fopt-info-par. (pass_data_parallelize_loops): Change optinfo_flags from OPTGROUP_LOOP to OPTGROUP_PAR. --- gcc/doc/invoke.texi | 2 ++ gcc/dumpfile.c | 1 + gcc/dumpfile.h | 5 +++-- gcc/tree-parloops.c | 16 ++++++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 54e9f12..629ee37 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -7319,6 +7319,8 @@ Enable dumps from all loop optimizations. Enable dumps from all inlining optimizations. @item vec Enable dumps from all vectorization optimizations. +@item par +Enable dumps from all auto-parallelization optimizations. @item optall Enable dumps from all optimizations. This is a superset of the optimization groups listed above. diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index e4c4748..421d19b 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -138,6 +138,7 @@ static const struct dump_option_value_info optgroup_options[] = {"loop", OPTGROUP_LOOP}, {"inline", OPTGROUP_INLINE}, {"vec", OPTGROUP_VEC}, + {"par", OPTGROUP_PAR}, {"optall", OPTGROUP_ALL}, {NULL, 0} }; diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 5f30077..52371f4 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -97,9 +97,10 @@ 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_PAR (1 << 5) /* Auto-parallelization passes */ +#define OPTGROUP_OTHER (1 << 6) /* All other passes */ #define OPTGROUP_ALL (OPTGROUP_IPA | OPTGROUP_LOOP | OPTGROUP_INLINE \ - | OPTGROUP_VEC | OPTGROUP_OTHER) + | OPTGROUP_VEC | OPTGROUP_PAR | OPTGROUP_OTHER) /* Define a tree dump switch. */ struct dump_file_info diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index c7aa62c..e98c2c7 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2718,17 +2718,21 @@ parallelize_loops (void) changed = true; skip_loop = loop->inner; + const char *loop_describe = (loop->inner + ? "outer" + : "inner"); + loop_loc = find_loop_location (loop); if (dump_file && (dump_flags & TDF_DETAILS)) { - if (loop->inner) - fprintf (dump_file, "parallelizing outer loop %d\n",loop->header->index); - else - fprintf (dump_file, "parallelizing inner loop %d\n",loop->header->index); - loop_loc = find_loop_location (loop); + fprintf (dump_file, "parallelizing %s loop %d\n", loop_describe, + loop->header->index); if (loop_loc != UNKNOWN_LOCATION) fprintf (dump_file, "\nloop at %s:%d: ", LOCATION_FILE (loop_loc), LOCATION_LINE (loop_loc)); } + if (dump_enabled_p ()) + dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loop_loc, + "parallelized %s loop\n", loop_describe); gen_parallel_loop (loop, &reduction_list, n_threads, &niter_desc); } @@ -2752,7 +2756,7 @@ const pass_data pass_data_parallelize_loops = { GIMPLE_PASS, /* type */ "parloops", /* name */ - OPTGROUP_LOOP, /* optinfo_flags */ + OPTGROUP_PAR, /* optinfo_flags */ TV_TREE_PARALLELIZE_LOOPS, /* tv_id */ ( PROP_cfg | PROP_ssa ), /* properties_required */ 0, /* properties_provided */ -- 1.9.1