public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Richard Biener <rguenther@suse.de>
Subject: [PATCH][1/5] Add param parloops-chunk-size
Date: Mon, 31 Aug 2015 11:51:00 -0000	[thread overview]
Message-ID: <55E43E55.1030204@mentor.com> (raw)
In-Reply-To: <55E43D5D.5020300@mentor.com>

[-- Attachment #1: Type: text/plain, Size: 1940 bytes --]

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

[-- Attachment #2: 0001-Add-param-parloops-chunk-size.patch --]
[-- Type: text/x-patch, Size: 2378 bytes --]

Add param parloops-chunk-size

2015-08-31  Tom de Vries  <tom@codesourcery.com>

	* 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


  reply	other threads:[~2015-08-31 11:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15 13:10 [PR65637] Fix ssa-handling code in expand_omp_for_static_chunk Tom de Vries
2015-04-15 13:15 ` [PR65637][PATCH][1/3] Fix gcc_assert " Tom de Vries
2015-08-31 12:00   ` [PR65637][PATCH][3/5] " Tom de Vries
2015-09-03  9:16     ` Jakub Jelinek
2015-04-15 13:17 ` [PR65637][PATCH][2/3] Fix inner loop phi " Tom de Vries
2015-08-31 12:03   ` [PR65637][PATCH][4/5] " Tom de Vries
2015-09-03  9:20     ` Jakub Jelinek
2015-04-15 13:23 ` [PR65637][PATCH][3/3] Handle 2 preds for fin_bb " Tom de Vries
2015-08-31 12:26   ` [PR65637][PATCH][5/5] " Tom de Vries
2015-09-03  9:40     ` Jakub Jelinek
2015-05-18 13:13 ` [PING][PR65637] Fix ssa-handling code " Tom de Vries
2015-05-18 14:19   ` Tom de Vries
2015-06-08 12:34   ` [PING^2][PR65637] " Tom de Vries
2015-08-31 11:44 ` [PR65637] " Tom de Vries
2015-08-31 11:51   ` Tom de Vries [this message]
2015-09-03  8:57     ` [PATCH][1/5] Add param parloops-chunk-size Jakub Jelinek
2015-08-31 11:55   ` [PATCH][2/5] Handle simple latch bb in expand_omp_for_static_chunk Tom de Vries
2015-09-03  9:02     ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E43E55.1030204@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).