public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21827] unroll misses simple elimination - works with manual unroll
       [not found] <bug-21827-4@http.gcc.gnu.org/bugzilla/>
@ 2023-05-26  0:30 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26  0:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21827

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |6.1.0
      Known to fail|                            |5.5.0

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like the testcase in comment #5 is fixed for GCC 6+.

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

* [Bug tree-optimization/21827] unroll misses simple elimination - works with manual unroll
       [not found] <bug-21827-10734@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-08-27 14:56 ` rakdver at gcc dot gnu dot org
@ 2006-08-27 19:33 ` martsummsw at hotmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: martsummsw at hotmail dot com @ 2006-08-27 19:33 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1289 bytes --]



------- Comment #11 from martsummsw at hotmail dot com  2006-08-27 19:33 -------
You are right =) 

I recall I did play with some params in 3.4, but without result.... but I did
not in 4.0 - since I did not expect a so (in my head) fairly low number to be
"large" ...

It would be real nice if gcc had an option forceing it to compile both unrolled
and not unrolled versions of known sizes and "at last" deciding the speed gain
contra the extra used space. In this case with e.g 14 iterations the space is
not even doubled in space however the speed is increased with more than 400%.
(I know gcc cannot know how much faster it is)

The #pragma would also be real nice....
I could dream about a pragma with the following behaviour ...
#pragma unroll-next-loop [guess x1,x2,x3] 

and if guess was used (for unknown sizes) it expanded "for (int u=0;u<x;u++)"
to
switch(x)
{
  case x1:
    unrolled x1 times
    break;
  case x2:
    unrolled x2 times
    break;
  and so on..
  default: 
    not unrolled ...
}


But to be realistic - you probaly have a lot of work and lot of better
suggestions to put into gcc. So maybe this should just be close now.

Thanks for reply! I am sorry I have wasted your time....

regards
Thorbjørn


-- 


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


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

* [Bug tree-optimization/21827] unroll misses simple elimination - works with manual unroll
       [not found] <bug-21827-10734@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-08-27 13:21 ` martsummsw at hotmail dot com
@ 2006-08-27 14:56 ` rakdver at gcc dot gnu dot org
  2006-08-27 19:33 ` martsummsw at hotmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2006-08-27 14:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rakdver at gcc dot gnu dot org  2006-08-27 14:56 -------
(In reply to comment #8)
> The problem is still visible on the mainline, unrolling the loop on the tree
> level pessimizes the generated code.  Zdenek, maybe you can have a look at this
> (testcase in comment #5).

I probably do not understand what the problem is supposed to be:

In auto_unrolled_knight_count8, the loop is fully unrolled (i.e., the loop
ceases to exist), and as expected, constant propagation makes sure that the
compile-time resolvable conditions are eliminated.

In auto_unrolled_knight_count9, the number of unrollings necessary to fully
unroll the loop (9) is considered too high, hence the loop gets only partially
unrolled (the body of the loop is copied three times).  This time, there are no
compile-time resolvable conditions.

If you really want even large loops to be unrolled, you may play with --param
max-completely-peeled-insns and --param max-completely-peel-times parameters. 
There were thoughts about providing pragmas to enable requiring more unrolling
just for specific loops, but as far as I know, nobody is working on that just
now.


-- 


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


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

* [Bug tree-optimization/21827] unroll misses simple elimination - works with manual unroll
       [not found] <bug-21827-10734@http.gcc.gnu.org/bugzilla/>
  2006-08-27  6:37 ` martsummsw at hotmail dot com
  2006-08-27 10:51 ` rguenth at gcc dot gnu dot org
@ 2006-08-27 13:21 ` martsummsw at hotmail dot com
  2006-08-27 14:56 ` rakdver at gcc dot gnu dot org
  2006-08-27 19:33 ` martsummsw at hotmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: martsummsw at hotmail dot com @ 2006-08-27 13:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from martsummsw at hotmail dot com  2006-08-27 13:21 -------
Hmmm - I am (also) wrong when I claimed it was solved in 4.1.1. It is improved
since the example that goes wrong in #5 now is right, but it is just 
the limit (for when the compiler gets comfused) that is pushed a bit.

e.g.
for (int bp=0;bp<11;++bp) 
// Up to 11 is fine unrolled in gcc 4.1.1 

However 12 and above e.g.
for (int bp=0;bp<12;++bp) 
// this still produces the poor performing code


-- 


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


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

* [Bug tree-optimization/21827] unroll misses simple elimination - works with manual unroll
       [not found] <bug-21827-10734@http.gcc.gnu.org/bugzilla/>
  2006-08-27  6:37 ` martsummsw at hotmail dot com
@ 2006-08-27 10:51 ` rguenth at gcc dot gnu dot org
  2006-08-27 13:21 ` martsummsw at hotmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-08-27 10:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2006-08-27 10:51 -------
The problem is still visible on the mainline, unrolling the loop on the tree
level pessimizes the generated code.  Zdenek, maybe you can have a look at this
(testcase in comment #5).


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rakdver at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/21827] unroll misses simple elimination - works with manual unroll
       [not found] <bug-21827-10734@http.gcc.gnu.org/bugzilla/>
@ 2006-08-27  6:37 ` martsummsw at hotmail dot com
  2006-08-27 10:51 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: martsummsw at hotmail dot com @ 2006-08-27  6:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from martsummsw at hotmail dot com  2006-08-27 06:37 -------
I am the reporter of this bug (with a new email-adress)
This problem seems to be solved with 4.1.1 =)

(Consider only #5 and forward - the first is wrong/irrelevant)


-- 

martsummsw at hotmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |martsummsw at hotmail dot
                   |                            |com


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


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

end of thread, other threads:[~2023-05-26  0:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21827-4@http.gcc.gnu.org/bugzilla/>
2023-05-26  0:30 ` [Bug tree-optimization/21827] unroll misses simple elimination - works with manual unroll pinskia at gcc dot gnu.org
     [not found] <bug-21827-10734@http.gcc.gnu.org/bugzilla/>
2006-08-27  6:37 ` martsummsw at hotmail dot com
2006-08-27 10:51 ` rguenth at gcc dot gnu dot org
2006-08-27 13:21 ` martsummsw at hotmail dot com
2006-08-27 14:56 ` rakdver at gcc dot gnu dot org
2006-08-27 19:33 ` martsummsw at hotmail dot com

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