From patchwork Tue Nov 30 14:50:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 73610 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]) by ozlabs.org (Postfix) with SMTP id E821A1007D1 for ; Wed, 1 Dec 2010 01:50:59 +1100 (EST) Received: (qmail 30031 invoked by alias); 30 Nov 2010 14:50:56 -0000 Received: (qmail 29958 invoked by uid 22791); 30 Nov 2010 14:50:53 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_SV, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Nov 2010 14:50:48 +0000 Received: by yxd5 with SMTP id 5so3054993yxd.20 for ; Tue, 30 Nov 2010 06:50:46 -0800 (PST) Received: by 10.150.198.7 with SMTP id v7mr12662087ybf.328.1291128644592; Tue, 30 Nov 2010 06:50:44 -0800 (PST) Received: from napoca (adsl-76-244-77-0.dsl.austtx.sbcglobal.net [76.244.77.0]) by mx.google.com with ESMTPS id p30sm4084839ybk.20.2010.11.30.06.50.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 30 Nov 2010 06:50:43 -0800 (PST) Received: by napoca (sSMTP sendmail emulation); Tue, 30 Nov 2010 08:50:41 -0600 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: gcc-graphite@googlegroups.com, rguenther@suse.de Subject: [PATCH 1/7] Add a stride parameter to scop_do_strip_mine. Date: Tue, 30 Nov 2010 08:50:30 -0600 Message-Id: <1291128636-30240-2-git-send-email-sebpop@gmail.com> In-Reply-To: <1291128636-30240-1-git-send-email-sebpop@gmail.com> References: <1291128636-30240-1-git-send-email-sebpop@gmail.com> X-IsSubscribed: yes 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 From: spop 2010-10-20 Sebastian Pop * graphite-blocking.c (lst_do_strip_mine_loop): Extra parameter for the stride. (lst_do_strip_mine): Same. (scop_do_strip_mine): Same. * graphite-poly.c (apply_poly_transforms): Update call to scop_do_strip_mine. * graphite-poly.h (scop_do_strip_mine): Update declaration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graphite@165738 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/ChangeLog.graphite | 10 ++++++++++ gcc/graphite-blocking.c | 42 ++++++++++++++++++++++++++++-------------- gcc/graphite-poly.c | 2 +- gcc/graphite-poly.h | 2 +- 5 files changed, 50 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5706ef8..3d6de3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2010-11-29 Sebastian Pop + + * graphite-blocking.c (lst_do_strip_mine_loop): Extra parameter + for the stride. + (lst_do_strip_mine): Same. + (scop_do_strip_mine): Same. + * graphite-poly.c (apply_poly_transforms): Update call to + scop_do_strip_mine. + * graphite-poly.h (scop_do_strip_mine): Update declaration. + 2010-11-29 H.J. Lu PR driver/46712 diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index 6f0038b..a205928 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,13 @@ +2010-10-20 Sebastian Pop + + * graphite-blocking.c (lst_do_strip_mine_loop): Extra parameter + for the stride. + (lst_do_strip_mine): Same. + (scop_do_strip_mine): Same. + * graphite-poly.c (apply_poly_transforms): Update call to + scop_do_strip_mine. + * graphite-poly.h (scop_do_strip_mine): Update declaration. + 2010-09-24 Sebastian Pop PR middle-end/45758 diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c index 3951b60..f1dd846 100644 --- a/gcc/graphite-blocking.c +++ b/gcc/graphite-blocking.c @@ -194,15 +194,14 @@ lst_strip_mine_profitable_p (lst_p lst, int stride) return res; } -/* Strip-mines all the loops of LST that are considered profitable to - strip-mine. Return true if it did strip-mined some loops. */ +/* Strip-mines all the loops of LST with STRIDE. Return true if it + did strip-mined some loops. */ static bool -lst_do_strip_mine_loop (lst_p lst, int depth) +lst_do_strip_mine_loop (lst_p lst, int depth, int stride) { int i; lst_p l; - int stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE); poly_bb_p pbb; if (!lst) @@ -213,7 +212,7 @@ lst_do_strip_mine_loop (lst_p lst, int depth) bool res = false; FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l) - res |= lst_do_strip_mine_loop (l, depth); + res |= lst_do_strip_mine_loop (l, depth, stride); return res; } @@ -223,30 +222,45 @@ lst_do_strip_mine_loop (lst_p lst, int depth) stride); } -/* Strip-mines all the loops of LST that are considered profitable to - strip-mine. Return true if it did strip-mined some loops. */ +/* Strip-mines all the loops of LST with STRIDE. When STRIDE is zero, + read the stride from the PARAM_LOOP_BLOCK_TILE_SIZE. Return true + if it did strip-mined some loops. + + Strip mining transforms a loop + + | for (i = 0; i < N; i++) + | S (i); + + into the following loop nest: + + | for (k = 0; k < N; k += STRIDE) + | for (j = 0; j < STRIDE; j++) + | S (i = k + j); +*/ static bool -lst_do_strip_mine (lst_p lst) +lst_do_strip_mine (lst_p lst, int stride) { int i; lst_p l; bool res = false; - int stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE); int depth; + if (!stride) + stride = PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE); + if (!lst || !LST_LOOP_P (lst)) return false; FOR_EACH_VEC_ELT (lst_p, LST_SEQ (lst), i, l) - res |= lst_do_strip_mine (l); + res |= lst_do_strip_mine (l, stride); depth = lst_depth (lst); if (depth >= 0 && lst_strip_mine_profitable_p (lst, stride)) { - res |= lst_do_strip_mine_loop (lst, lst_depth (lst)); + res |= lst_do_strip_mine_loop (lst, lst_depth (lst), stride); lst_add_loop_under_loop (lst); } @@ -257,9 +271,9 @@ lst_do_strip_mine (lst_p lst) have been strip-mined. */ bool -scop_do_strip_mine (scop_p scop) +scop_do_strip_mine (scop_p scop, int stride) { - return lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop)); + return lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop), stride); } /* Loop blocks all the loops in SCOP. Returns true when we manage to @@ -273,7 +287,7 @@ scop_do_block (scop_p scop) store_scattering (scop); - strip_mined = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop)); + strip_mined = lst_do_strip_mine (SCOP_TRANSFORMED_SCHEDULE (scop), 0); interchanged = scop_do_interchange (scop); /* If we don't interchange loops, the strip mine alone will not be diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 0dbd61c..eebaa13 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -777,7 +777,7 @@ apply_poly_transforms (scop_p scop) else { if (flag_loop_strip_mine) - transform_done |= scop_do_strip_mine (scop); + transform_done |= scop_do_strip_mine (scop, 0); if (flag_loop_interchange) transform_done |= scop_do_interchange (scop); diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h index 8b950a4..4a2f25c 100644 --- a/gcc/graphite-poly.h +++ b/gcc/graphite-poly.h @@ -412,7 +412,7 @@ extern void print_iteration_domains (FILE *, scop_p, int); extern void debug_iteration_domain (poly_bb_p, int); extern void debug_iteration_domains (scop_p, int); extern bool scop_do_interchange (scop_p); -extern bool scop_do_strip_mine (scop_p); +extern bool scop_do_strip_mine (scop_p, int); extern bool scop_do_block (scop_p); extern bool flatten_all_loops (scop_p); extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t);