public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/4] IVOPTs consider step cost for different forms when unrolling
@ 2020-05-28 12:17 Kewen.Lin
  2020-05-28 12:19 ` [PATCH 1/4] unroll: Add middle-end unroll factor estimation Kewen.Lin
                   ` (3 more replies)
  0 siblings, 4 replies; 64+ messages in thread
From: Kewen.Lin @ 2020-05-28 12:17 UTC (permalink / raw)
  To: GCC Patches
  Cc: Segher Boessenkool, Bill Schmidt, bin.cheng, Richard Guenther,
	Richard Sandiford

Hi,

This is one repost and you can refer to the original series 
via https://gcc.gnu.org/pipermail/gcc-patches/2020-January/538360.html.

As we discussed in the thread
https://gcc.gnu.org/ml/gcc-patches/2020-01/msg00196.html
Original: https://gcc.gnu.org/ml/gcc-patches/2020-01/msg00104.html,
I'm working to teach IVOPTs to consider D-form group access during unrolling.
The difference on D-form and other forms during unrolling is we can put the
stride into displacement field to avoid additional step increment. eg:

With X-form (uf step increment):
  ...
  LD A = baseA, X
  LD B = baseB, X
  ST C = baseC, X
  X = X + stride
  LD A = baseA, X
  LD B = baseB, X
  ST C = baseC, X
  X = X + stride
  LD A = baseA, X
  LD B = baseB, X
  ST C = baseC, X
  X = X + stride
  ...

With D-form (one step increment for each base):
  ...
  LD A = baseA, OFF
  LD B = baseB, OFF
  ST C = baseC, OFF
  LD A = baseA, OFF+stride
  LD B = baseB, OFF+stride
  ST C = baseC, OFF+stride
  LD A = baseA, OFF+2*stride
  LD B = baseB, OFF+2*stride
  ST C = baseC, OFF+2*stride
  ...
  baseA += stride * uf
  baseB += stride * uf
  baseC += stride * uf

Imagining that if the loop get unrolled by 8 times, then 3 step updates with
D-form vs. 8 step updates with X-form. Here we only need to check stride
meet D-form field requirement, since if OFF doesn't meet, we can construct
baseA' with baseA + OFF.

This patch set consists four parts:
     
  [PATCH 1/4] unroll: Add middle-end unroll factor estimation

     Add unroll factor estimation in middle-end. It mainly refers to current
     RTL unroll factor determination in function decide_unrolling and its
     sub calls.  As Richi suggested, we probably can force unroll factor
     with this and avoid duplicate unroll factor calculation, but I think it
     need more benchmarking work and should be handled separately.

  [PATCH 2/4] param: Introduce one param to control unroll factor 

     As Richard and Segher's suggestion, I used addr_offset_valid_p for the
     addressing mode, rather than one target hook.  As Richard's suggestion,     
     it introduces one parameter to control this IVOPTs consideration and
     further tweaking [3/4] on top of unroll factor estimation [1/4].
     
  [PATCH 3/4] ivopts: Consider cost_step on different forms during unrolling

     Teach IVOPTs to mark the IV cand as reg_offset_p which is derived from
     one address IV type group where the whole group is valid to use reg_offset
     mode.  Then scaling up the IV cand step cost by (uf - 1) for no
     reg_offset_p IV cands, here the uf is one estimated unroll factor [1/4].
     
  [PATCH 4/4] rs6000: P9 D-form test cases

     Add some test cases, mainly copied from Kelvin's patch.  This is approved
     by Segher if the whole series is fine.


Many thanks to Richard and Segher on previous version reviews.

Bootstrapped and regress tested on powerpc64le-linux-gnu.

Any comments are highly appreciated!  Thanks in advance!


BR,
Kewen

-------

 gcc/cfgloop.h                  |   3 ++
 gcc/config/i386/i386-options.c |   6 +++
 gcc/config/s390/s390.c         |   6 +++
 gcc/doc/invoke.texi            |   9 +++++
 gcc/params.opt                 |   4 ++
 gcc/tree-ssa-loop-ivopts.c     | 100 ++++++++++++++++++++++++++++++++++++++++++++++-
 gcc/tree-ssa-loop-manip.c      | 253 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gcc/tree-ssa-loop-manip.h      |   3 +-
 gcc/tree-ssa-loop.c            |  33 ++++++++++++++++
 gcc/tree-ssa-loop.h            |   2 +
 10 files changed, 416 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2021-03-01  2:45 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 12:17 [PATCH 0/4] IVOPTs consider step cost for different forms when unrolling Kewen.Lin
2020-05-28 12:19 ` [PATCH 1/4] unroll: Add middle-end unroll factor estimation Kewen.Lin
2020-08-31  5:49   ` PING " Kewen.Lin
2020-09-15  7:44     ` PING^2 " Kewen.Lin
2020-10-13  7:06       ` PING^3 " Kewen.Lin
2020-11-02  9:13         ` PING^4 " Kewen.Lin
2020-11-19  5:50           ` PING^5 " Kewen.Lin
2020-12-17  2:58             ` PING^6 " Kewen.Lin
2021-01-14  2:36               ` PING^7 " Kewen.Lin
2021-01-21 21:45   ` Segher Boessenkool
2021-01-22 12:50     ` Richard Sandiford
2021-01-22 13:47     ` Richard Biener
2021-01-22 21:37       ` Segher Boessenkool
2021-01-25  7:56         ` Richard Biener
2021-01-25 17:59           ` Richard Sandiford
2021-01-25 20:37             ` Segher Boessenkool
2021-01-26  8:53               ` Kewen.Lin
2021-01-26 17:31                 ` Segher Boessenkool
2021-01-26  8:43             ` Kewen.Lin
2021-01-26 10:47             ` Richard Biener
2021-01-26 17:54               ` Segher Boessenkool
2021-01-26  8:36           ` Kewen.Lin
2021-01-26 10:53             ` Richard Biener
2021-01-27  9:43               ` Kewen.Lin
2021-03-01  2:45                 ` Kewen.Lin
2020-05-28 12:23 ` [PATCH 2/4] param: Introduce one param to control ivopts reg-offset consideration Kewen.Lin
2020-05-28 12:24 ` [PATCH 3/4] ivopts: Consider cost_step on different forms during unrolling Kewen.Lin
2020-06-01 17:59   ` Richard Sandiford
2020-06-02  3:39     ` Kewen.Lin
2020-06-02  7:14       ` Richard Sandiford
2020-06-03  3:18         ` Kewen.Lin
2020-08-08  8:01   ` Bin.Cheng
2020-08-10  4:27     ` Kewen.Lin
2020-08-10 12:38       ` Bin.Cheng
2020-08-10 14:41         ` Kewen.Lin
2020-08-16  3:59           ` Bin.Cheng
2020-08-18  9:02             ` [PATCH 3/4 v2] " Kewen.Lin
2020-08-22  5:11               ` Bin.Cheng
2020-08-25 12:46                 ` [PATCH 3/4 v3] " Kewen.Lin
2020-08-31 19:41                   ` Segher Boessenkool
2020-09-02  3:16                     ` Kewen.Lin
2020-09-02 10:25                       ` Segher Boessenkool
2020-09-03  2:24                         ` Kewen.Lin
2020-09-03 22:37                           ` Segher Boessenkool
2020-09-04  8:27                             ` Bin.Cheng
2020-09-04 13:53                               ` Segher Boessenkool
2020-09-04  8:47                             ` Kewen.Lin
2020-09-04 14:16                               ` Segher Boessenkool
2020-09-04 15:47                                 ` Kewen.Lin
2020-09-17 23:12                             ` Jeff Law
2020-09-17 23:46                               ` Segher Boessenkool
2020-09-01 11:19                   ` Bin.Cheng
2020-09-02  3:50                     ` Kewen.Lin
2020-09-02  3:55                       ` Bin.Cheng
2020-09-02  4:51                         ` Kewen.Lin
2020-09-06  2:47                     ` Hans-Peter Nilsson
2020-09-15  7:41                       ` Kewen.Lin
2020-06-02 11:38 ` [PATCH 0/4] IVOPTs consider step cost for different forms when unrolling Richard Biener
2020-06-03  3:46   ` Kewen.Lin
2020-06-03  7:07     ` Richard Biener
2020-06-03  7:58       ` Kewen.Lin
2020-06-03  9:27         ` Richard Biener
2020-06-03 10:47           ` Kewen.Lin
2020-06-03 11:08             ` Richard Sandiford

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).