This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PING] [PATCH] _Cilk_for for C and C++
- From: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: 'Jason Merrill' <jason at redhat dot com>, 'Jeff Law' <law at redhat dot com>, "'Aldy Hernandez'" <aldyh at redhat dot com>, "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>, "'rth at redhat dot com'" <rth at redhat dot com>
- Date: Wed, 29 Jan 2014 15:53:59 +0000
- Subject: RE: [PING] [PATCH] _Cilk_for for C and C++
- Authentication-results: sourceware.org; auth=none
- References: <BF230D13CA30DD48930C31D4099330003A4C884E at FMSMSX101 dot amr dot corp dot intel dot com> <20140127205010 dot GG892 at tucnak dot redhat dot com> <BF230D13CA30DD48930C31D4099330003A4C8892 at FMSMSX101 dot amr dot corp dot intel dot com> <BF230D13CA30DD48930C31D4099330003A4C8E1C at FMSMSX101 dot amr dot corp dot intel dot com> <20140129113129 dot GT892 at tucnak dot redhat dot com>
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