public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Iyer, Balaji V" <balaji.v.iyer@intel.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: 'Jason Merrill' <jason@redhat.com>, 'Jeff Law' <law@redhat.com>,
	"'Aldy Hernandez'" <aldyh@redhat.com>,
	"'gcc-patches@gcc.gnu.org'"	<gcc-patches@gcc.gnu.org>,
	"'rth@redhat.com'" <rth@redhat.com>
Subject: RE: [PING] [PATCH] _Cilk_for for C and C++
Date: Wed, 12 Feb 2014 15:14:00 -0000	[thread overview]
Message-ID: <BF230D13CA30DD48930C31D4099330003A4CDF8D@FMSMSX101.amr.corp.intel.com> (raw)
In-Reply-To: <20140212145913.GM20378@tucnak.redhat.com>



> -----Original Message-----
> From: Jakub Jelinek [mailto:jakub@redhat.com]
> Sent: Wednesday, February 12, 2014 9:59 AM
> To: Iyer, Balaji V
> Cc: 'Jason Merrill'; 'Jeff Law'; 'Aldy Hernandez'; 'gcc-patches@gcc.gnu.org';
> 'rth@redhat.com'
> Subject: Re: [PING] [PATCH] _Cilk_for for C and C++
> 
> On Mon, Feb 10, 2014 at 10:07:18PM +0000, Iyer, Balaji V wrote:
> > I looked at both but forgot to test them with my implementation. Sorry
> > about this.  I have fixed the ICE issue.  To make sure this does not
> > happen further, I have added your test cf3.C into test suite (renamed
> > to cf3.cc).  I hope that is OK with you.
> 
> The testcase is GPL as the original libgomp.c++/for-1.C testcase, so sure.
> Perhaps it would be much better though if instead of having a compile time
> testcase you'd just do what libgomp.c++/for-1.C does, just replace all the
> #pragma omp parallel for in there with _Cilk_for and turn it into a runtime
> testcase.
> 
I really don't want to do that because I don't think there is a 1:1 match-up between the rules of #pragma omp for and _Cilk_for. 

> > I have attached a fixed patch and Changelogs. Is this OK?
> 
> Looks better (note, still looking just at the dumps), but not completely ok
> yet.  On cf3.cc, I see in *.gimple:
> 
>         D.2883 = J<int>::begin (j);
>         I<int>::I (&i, D.2883);
>         D.2885 = J<int>::end (j);
>         retval.0 = operator-<int> (D.2885, &i);
>         D.2886 = retval.0 / 2;
>         #pragma omp parallel firstprivate(i) if(D.2886) shared(D.2865) shared(j)
>           {
>             difference_type retval.1;
>             const struct I & D.2888;
>             const difference_type D.2866;
>             long int D.2889;
>             struct I & D.2890;
> 
>             try
>               {
> 
>                 _Cilk_for (D.2864 = 0; D.2864 < retval.1; D.2864 = D.2864 + 2)
> private(D.2864)
>                   {
>                     D.2889 = D.2864 - D.2865;
>                     D.2866 = D.2889;
>                     try
>                       {
>                         D.2890 = I<int>::operator+= (&i, &D.2866);
> 
> First a minor nit, there is extra newline before _Cilk_for:
>           newline_and_indent (buffer, spc);
>           if (flag_cilkplus
>               && gimple_omp_for_kind (gs) == GF_OMP_FOR_KIND_CILKFOR)
>             pp_string (buffer, "_Cilk_for (");
>           else
>             pp_string (buffer, "for ("); I guess for _Cilk_for collapse is never > 1,
> right?  If that is the case, then perhaps you should move the
> newline_and_indent (buffer, spc); call into the else block.
> 

OK. I will fix this and send you a patch? 

> More importantly, what is retval.1?  I'd expect you should be using retval.0
> there and have it also as firstprivate(retval.0) on the parallel.
> In *.omplower dump I actually see:
>         retval.0 = operator-<int> (D.2885, &i); ...
>                             retval.1 = operator-<int> (D.2888, &i); i.e. operator-<int> is
> called twice.
> 

Yes, one is for the if-clause and one is for the condition. It really doesn't matter because we get of the stuff in the condition and replace with our own for loop with something like the for-loop shown  below. So retval1 doesn't come into picture. It is only alive from parser to the expand_cilk_for function.

For (i = low; i < high; i++)
{
	<_Cilk_for_body>
}

So, is there any other changes that you need me to make?

Thanks,

Balaji V. Iyer.


> 	Jakub

  reply	other threads:[~2014-02-12 15:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 20:41 Iyer, Balaji V
2014-01-27 20:53 ` Jakub Jelinek
2014-01-27 21:36   ` Iyer, Balaji V
2014-01-28 16:55     ` Iyer, Balaji V
2014-01-29 11:31       ` Jakub Jelinek
2014-01-29 15:54         ` Iyer, Balaji V
2014-01-31 15:39           ` Iyer, Balaji V
2014-02-05  5:27         ` Iyer, Balaji V
2014-02-07 14:02           ` Jakub Jelinek
2014-02-07 14:33             ` Iyer, Balaji V
2014-02-07 14:53               ` Jakub Jelinek
2014-02-07 22:14                 ` Iyer, Balaji V
2014-02-10 17:57                   ` Jakub Jelinek
2014-02-10 22:07                     ` Iyer, Balaji V
2014-02-12 14:59                       ` Jakub Jelinek
2014-02-12 15:14                         ` Iyer, Balaji V [this message]
2014-02-12 15:28                           ` Jakub Jelinek
2014-02-12 17:05                             ` Iyer, Balaji V
2014-02-12 17:09                               ` Jakub Jelinek
2014-02-12 17:15                                 ` Iyer, Balaji V
2014-02-17  6:42                                 ` Iyer, Balaji V
2014-02-19  4:43                                   ` Iyer, Balaji V
2014-02-19 11:24                                     ` Jakub Jelinek
2014-02-21  4:38                                       ` Iyer, Balaji V
2014-02-24 23:16                                         ` Iyer, Balaji V
     [not found]                                           ` <BF230D13CA30DD48930C31D4099330003A4D2123@FMSMSX101.amr.corp.intel.com>
     [not found]                                             ` <20140306115443.GC22862@tucnak.redhat.com>
2014-03-20 21:19                                               ` FW: " Iyer, Balaji V

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=BF230D13CA30DD48930C31D4099330003A4CDF8D@FMSMSX101.amr.corp.intel.com \
    --to=balaji.v.iyer@intel.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jason@redhat.com \
    --cc=law@redhat.com \
    --cc=rth@redhat.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).