public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zdenek Dvorak <rakdver@kam.mff.cuni.cz>
To: Bingfeng Mei <bmei@broadcom.com>
Cc: Jean Christophe Beyler <jean.christophe.beyler@gmail.com>,
		"gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: Re: Turning off unrolling to certain loops
Date: Thu, 15 Oct 2009 14:41:00 -0000	[thread overview]
Message-ID: <20091015100020.GA21790@kam.mff.cuni.cz> (raw)
In-Reply-To: <7FB04A5C213E9943A72EE127DB74F0AD93CCBE4AD6@SJEXCHCCR02.corp.ad.broadcom.com>

Hi,

> I faced a similar issue a while ago. I filed a bug report 
> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36712) In the end, 
> I implemented a simple tree-level unrolling pass in our port
> which uses all the existing infrastructure. It works quite well for 
> our purpose, but I hesitated to submit the patch because it contains
> our not-very-elegannt #prgama unroll implementation. 

could you please do so anyway?  Even if there are some issues with the
#prgama unroll implementation, it could serve as a basis of a usable
patch.

> /* Perfect unrolling of a loop */
> static void tree_unroll_perfect_loop (struct loop *loop, unsigned factor,
> 		  edge exit)
> {
> ...
> }
> 
> 
>                   
> /* Go through all the loops: 
>      1. Determine unrolling factor
>      2. Unroll loops in different conditions
>         -- perfect loop: no extra copy of original loop
>         -- other loops: the original version of loops to execute the remaining iterations
> */        
> static unsigned int rest_of_tree_unroll (void)
> {
...
>        tree niters = number_of_exit_cond_executions(loop);
>        
>        bool perfect_unrolling = false;
>        if(niters != NULL_TREE && niters!= chrec_dont_know && TREE_CODE(niters) == INTEGER_CST){
>          int num_iters = tree_low_cst(niters, 1);
>          if((num_iters % unroll_factor) == 0)
>            perfect_unrolling = true;
>        }
>        
>        /* If no. of iterations can be divided by unrolling factor, we have perfect unrolling */
>        if(perfect_unrolling){
>          tree_unroll_perfect_loop(loop, unroll_factor, single_dom_exit(loop));
>        }
>        else{
>          tree_unroll_loop (loop, unroll_factor, single_dom_exit (loop), &desc);
>        }

It would be better to move this test to tree_unroll_loop, and not
duplicate its code in tree_unroll_perfect_loop.

Zdenek

  reply	other threads:[~2009-10-15 10:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05 20:46 Jean Christophe Beyler
2009-10-06  6:54 ` Zdenek Dvorak
2009-10-06 13:34   ` Jean Christophe Beyler
     [not found]     ` <20091006135624.GA18714@kam.mff.cuni.cz>
     [not found]       ` <c568a2600910060756m96adf86mb1507c6717fdfdb6@mail.gmail.com>
     [not found]         ` <20091006150918.GA19277@kam.mff.cuni.cz>
     [not found]           ` <c568a2600910060828l24ec5ecct926eb2624a1d2157@mail.gmail.com>
2009-10-08 16:18             ` Jean Christophe Beyler
2009-10-08 16:23               ` Zdenek Dvorak
2009-10-08 18:52                 ` Jean Christophe Beyler
2009-10-14 18:56                   ` Jean Christophe Beyler
2009-10-15  0:45                     ` Zdenek Dvorak
2009-10-15 10:00                     ` Bingfeng Mei
2009-10-15 14:41                       ` Zdenek Dvorak [this message]
2009-10-15 15:56                         ` Jean Christophe Beyler
2009-10-15 16:27                           ` Bingfeng Mei
2009-10-15 17:16                             ` Jean Christophe Beyler
2009-10-16 12:17                               ` Bingfeng Mei
2009-10-16 13:51                                 ` Jean Christophe Beyler

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=20091015100020.GA21790@kam.mff.cuni.cz \
    --to=rakdver@kam.mff.cuni.cz \
    --cc=bmei@broadcom.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jean.christophe.beyler@gmail.com \
    /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).