From patchwork Mon Aug 31 11:45:25 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: 512469 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 18C71140273 for ; Mon, 31 Aug 2015 21:45:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=rnXX9UXh; 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=can912Yu9CD//nh4o ykavzz++ugUOqEDrXV7m4eqGLmscr6PVdQyQ/ChVYUB/WqyUWQOhnf4ckJ2dnbk8 VMMz897a7B/7XP6GPTdmQ94xlxehrIql4oAO2DLmNMb6a5HT8ye5eSHEqxtaG/Ev II/3w+WuAbbodCHUS/S5Zx3V48= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=8AeqDj+1HUkjDIIsGnKO2ZQ BHSg=; b=rnXX9UXhdEaLYHZgdGOhTGSGlTc4WWPApY/ES3o5pKkOQYU+QaFgSeb ZwaF2P3rLHWZs7mpGFaB45nyokvYWnSjGtKOr2mPWfus0r4s+IGSDrOvzWw4OBdy Stery6KyWuXWKu0Fq+fCyzbfNzPd4BFVRXUZaNK4dA0wMpDIKVIA= Received: (qmail 7867 invoked by alias); 31 Aug 2015 11:45:42 -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 7858 invoked by uid 89); 31 Aug 2015 11:45:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 31 Aug 2015 11:45:40 +0000 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 1ZWNWr-00033u-Id from Tom_deVries@mentor.com ; Mon, 31 Aug 2015 04:45:37 -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, 31 Aug 2015 12:45:35 +0100 Message-ID: <55E43E55.1030204@mentor.com> Date: Mon, 31 Aug 2015 13:45:25 +0200 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Jakub Jelinek CC: GCC Patches , Richard Biener Subject: [PATCH][1/5] Add param parloops-chunk-size References: <552E6341.4040401@mentor.com> <55E43D5D.5020300@mentor.com> In-Reply-To: <55E43D5D.5020300@mentor.com> On 31/08/15 13:41, Tom de Vries wrote: > On 15/04/15 15:10, Tom de Vries wrote: >> Hi, >> >> This patch series fixes PR65637. >> >> Currently, ssa-handling code in expand_omp_for_static_chunk is dead and >> not exercised by testing. >> >> Ssa-handling code in omp-low.c is only triggered by >> pass_parallelize_loops, and that pass doesn't specify a chunk size on >> the GIMPLE_OMP_FOR it constructs, so that only exercises the >> expand_omp_for_static_nochunk path. >> >> Using the attached trigger patch, we excercise the ssa-handling code in >> expand_omp_for_static_chunk. > > > > 1. Fix gcc_assert in expand_omp_for_static_chunk > > 2. Fix inner loop phi in expand_omp_for_static_chunk > > 3. Handle 2 preds for fin_bb in expand_omp_for_static_chunk > > I'm posting an updated series. > > 1. Add param parloops-chunk-size > 2. Handle simple latch bb in expand_omp_for_static_chunk > 3. Fix gcc_assert in expand_omp_for_static_chunk > 4. Fix inner loop phi in expand_omp_for_static_chunk > 5. Handle 2 preds for fin_bb in expand_omp_for_static_chunk > > There are two new patches, (1) and (2) in the new numbering. > > The first patch adds a param parloops-chunk-size, which means the > ssa-handling code in expand_omp_for_static_chunk is no longer dead. > > The second patch handles simple latches in expand_omp_for_static_chunk, > similar to the fix for PR66846 in expand_omp_for_static_nochunk. > > The rest of the patches are now updated to include the testcases (and > patch number 4 has been updated to handle simple latches). > > The patch series has been bootstrapped and reg-tested on x86_64. > > I'll post the patches from the patch series individually. The first two > in response to this email, the latter three in response to the earlier > submissions. > Hi, this patch adds a param parloops-chunk-size. The param is used to set the chunk-size of the schedule of omp-for loops generated by parloops. Thanks, - Tom Add param parloops-chunk-size 2015-08-31 Tom de Vries * doc/invoke.texi (parloops-chunk-size): Add item. * params.def (PARAM_PARLOOPS_CHUNK_SIZE): Add DEFPARAM. * tree-parloops.c: Include params.h. (create_parallel_loop): Set chunk-size of schedule of omp-for loop, if param parloops-chunk-size is used. --- gcc/doc/invoke.texi | 4 ++++ gcc/params.def | 5 +++++ gcc/tree-parloops.c | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index c0ec0fd..6dd144d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -11000,6 +11000,10 @@ path. The default is 10. Maximum number of new jump thread paths to create for a finite state automaton. The default is 50. +@item parloops-chunk-size +Chunk size of omp schedule for loops parallelized by parloops. The default +is 0. + @end table @end table diff --git a/gcc/params.def b/gcc/params.def index c8b3a90..11238cb 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -1135,6 +1135,11 @@ DEFPARAM (PARAM_MAX_FSM_THREAD_PATHS, "max-fsm-thread-paths", "Maximum number of new jump thread paths to create for a finite state automaton", 50, 1, 999999) + +DEFPARAM (PARAM_PARLOOPS_CHUNK_SIZE, + "parloops-chunk-size", + "Chunk size of omp schedule for loops parallelized by parloops", + 0, 0, 0) /* Local variables: diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index d017479..c164121 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-nested.h" #include "cgraph.h" #include "tree-ssa.h" +#include "params.h" /* This pass tries to distribute iterations of loops into several threads. The implementation is straightforward -- for each loop we test whether its @@ -2092,6 +2093,10 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data, type = TREE_TYPE (cvar); t = build_omp_clause (loc, OMP_CLAUSE_SCHEDULE); OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_STATIC; + int chunk_size = PARAM_VALUE (PARAM_PARLOOPS_CHUNK_SIZE); + if (chunk_size != 0) + OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (t) + = build_int_cst (integer_type_node, chunk_size); for_stmt = gimple_build_omp_for (NULL, GF_OMP_FOR_KIND_FOR, t, 1, NULL); gimple_set_location (for_stmt, loc); -- 1.9.1