public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/35343]  New: Sum-reduction loop not recognized
@ 2008-02-24  4:28 xinliangli at gmail dot com
  2008-02-24 21:56 ` [Bug middle-end/35343] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: xinliangli at gmail dot com @ 2008-02-24  4:28 UTC (permalink / raw)
  To: gcc-bugs

It is beneficial to unroll reduction loop (and split the reduction target) to
reduce dependence height due to recurrence, but GCC does not perform such
optimization (-O3 -fno-tree-vectorize)


int a[1000];
int b[1000];
int foo(int n)
{

   int s = 0;
   int i = 0;
   for (i = 0; i < 1000 ; i++)
   {
       s += a[i] + b[2*i];
   }
   return s;
}


-- 
           Summary: Sum-reduction loop not recognized
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xinliangli at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35343


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

* [Bug middle-end/35343] Sum-reduction loop not recognized
  2008-02-24  4:28 [Bug middle-end/35343] New: Sum-reduction loop not recognized xinliangli at gmail dot com
@ 2008-02-24 21:56 ` rguenth at gcc dot gnu dot org
  2008-02-25 10:22 ` dorit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-24 21:56 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |missed-optimization
            Version|unknown                     |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35343


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

* [Bug middle-end/35343] Sum-reduction loop not recognized
  2008-02-24  4:28 [Bug middle-end/35343] New: Sum-reduction loop not recognized xinliangli at gmail dot com
  2008-02-24 21:56 ` [Bug middle-end/35343] " rguenth at gcc dot gnu dot org
@ 2008-02-25 10:22 ` dorit at gcc dot gnu dot org
  2008-02-25 21:37 ` xinliangli at gmail dot com
  2008-12-29  6:32 ` [Bug middle-end/35343] Sum-reduction loop not recognized (enable -fvariable-expansion-in-unroller by default) pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dorit at gcc dot gnu dot org @ 2008-02-25 10:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dorit at gcc dot gnu dot org  2008-02-25 10:21 -------
(In reply to comment #0)
> It is beneficial to unroll reduction loop (and split the reduction target) to
> reduce dependence height due to recurrence, but GCC does not perform such
> optimization (-O3 -fno-tree-vectorize)

it does, if you use -fvariable-expansion-in-unroller -funroll-loops
(this splits the reduction target into 2 accumulators. For more agressive
spiltting you can use --param max-variable-expansions-in-unrolle=[n])


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35343


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

* [Bug middle-end/35343] Sum-reduction loop not recognized
  2008-02-24  4:28 [Bug middle-end/35343] New: Sum-reduction loop not recognized xinliangli at gmail dot com
  2008-02-24 21:56 ` [Bug middle-end/35343] " rguenth at gcc dot gnu dot org
  2008-02-25 10:22 ` dorit at gcc dot gnu dot org
@ 2008-02-25 21:37 ` xinliangli at gmail dot com
  2008-12-29  6:32 ` [Bug middle-end/35343] Sum-reduction loop not recognized (enable -fvariable-expansion-in-unroller by default) pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: xinliangli at gmail dot com @ 2008-02-25 21:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from xinliangli at gmail dot com  2008-02-25 21:36 -------
(In reply to comment #1)
> (In reply to comment #0)
> > It is beneficial to unroll reduction loop (and split the reduction target) to
> > reduce dependence height due to recurrence, but GCC does not perform such
> > optimization (-O3 -fno-tree-vectorize)
> 
> it does, if you use -fvariable-expansion-in-unroller -funroll-loops
> (this splits the reduction target into 2 accumulators. For more agressive
> spiltting you can use --param max-variable-expansions-in-unrolle=[n])
> 

Thanks, it is good to know the option. It would be good to tune the default
behavior of the optimizer so that better out of box performance can be
achieved. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35343


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

* [Bug middle-end/35343] Sum-reduction loop not recognized (enable -fvariable-expansion-in-unroller by default)
  2008-02-24  4:28 [Bug middle-end/35343] New: Sum-reduction loop not recognized xinliangli at gmail dot com
                   ` (2 preceding siblings ...)
  2008-02-25 21:37 ` xinliangli at gmail dot com
@ 2008-12-29  6:32 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-29  6:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-12-29 06:30 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-29 06:30:36
               date|                            |
            Summary|Sum-reduction loop not      |Sum-reduction loop not
                   |recognized                  |recognized (enable -
                   |                            |fvariable-expansion-in-
                   |                            |unroller by default)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35343


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

end of thread, other threads:[~2008-12-29  6:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-24  4:28 [Bug middle-end/35343] New: Sum-reduction loop not recognized xinliangli at gmail dot com
2008-02-24 21:56 ` [Bug middle-end/35343] " rguenth at gcc dot gnu dot org
2008-02-25 10:22 ` dorit at gcc dot gnu dot org
2008-02-25 21:37 ` xinliangli at gmail dot com
2008-12-29  6:32 ` [Bug middle-end/35343] Sum-reduction loop not recognized (enable -fvariable-expansion-in-unroller by default) pinskia at gcc dot gnu dot org

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