[PING] [PATCH] _Cilk_for for C and C++

Iyer, Balaji V balaji.v.iyer@intel.com
Fri Jan 31 15:39:00 GMT 2014


Hello Everyone,
	Did anyone get a chance to look at this patch (link to patches: http://gcc.gnu.org/ml/gcc-patches/2014-01/msg01612.html)? I tried to do as Jakub mentioned but it hits a road-block when it comes to iterators due to variable scoping issues.
	This patch does not disrupt any other parts of the code and all the code here are wrapped inside a check for for Cilk Plus enabling. It also passes all the tests and does not disrupt any existing failing or passing ones for both 32 and 64 bit modes in my x86_64 machine. 

It is the last feature to make Cilk Plus feature-complete. Is the patch OK for trunk?

Thanks,

Balaji V. Iyer.

> -----Original Message-----
> From: Iyer, Balaji V
> Sent: Wednesday, January 29, 2014 10:54 AM
> To: Jakub Jelinek
> 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++
> 
> Hi Jakub,
> 
> > -----Original Message-----
> > From: Jakub Jelinek [mailto:jakub@redhat.com]
> > Sent: Wednesday, January 29, 2014 6:31 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 Tue, Jan 28, 2014 at 04:55:38PM +0000, Iyer, Balaji V wrote:
> > > 	I thought about it a bit more, and the main issue here is that we
> > > need access to the _Cilk_for loop's components both inside the child
> > > function and the parent function.
> >
> > I guess for the C++ iterators, if in the _Cilk_for model you need to
> > provide number of iterations before parallelization, it really depends
> > on what the standard allows and what you want to do exactly.
> 
> Yes, I need the value before the parallelization context hits. This is why in my
> last patch I had the parallel around the body and omp for around the _Cilk-
> for statement.
> 
> 
> > If you need to provide the iteration count before spawning the threads
> > and the standard allows you that, then just lower it in the C++ FE
> > already so that you do:
> >   vector<int>::iterator temp = array.begin ();
> >   sizetype tempcount = (array.end () - temp); before the parallel, and then
> >   #pragma omp parallel firstprivate(temp, tempcount)
> >     _Cilk_for (sizetype temp2 = 0; temp2 < tempcount; temp2++)
> >       {
> >         vector<int>::iterator ii = temp + temp2;
> >         <body>
> >       }
> 
> This is kind of what I did (atlest tried to accomplish what you mentioned
> above). I can look into doing this, but is it possible for you to accept the patch
> as-is and we will look into fixing it in the future?
> 
> Thanks,
> 
> Balaji V. Iyer.
> 
> > or similar.  The C++ FE needs to lower the C++ iterators anyway, the
> > middle- end can really only work with integral or pointer iterators,
> > and it depends on how exactly the Cilk+ standard defines _Cilk_for
> > with iterators (what methods must be implemented on the iterators and
> > what methods and in what order should be called).
> >
> > 	Jakub



More information about the Gcc-patches mailing list