public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PING] [PATCH] _Cilk_for for C and C++
@ 2014-01-27 20:41 Iyer, Balaji V
  2014-01-27 20:53 ` Jakub Jelinek
  0 siblings, 1 reply; 26+ messages in thread
From: Iyer, Balaji V @ 2014-01-27 20:41 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Jason Merrill, 'Jeff Law', 'Aldy Hernandez',
	'gcc-patches@gcc.gnu.org', 'rth@redhat.com'

Hi Jakub et al.,

	Did you get a chance to look at this _Cilk_for patch? 

Thanks,

Balaji V. Iyer.

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Iyer, Balaji V
> Sent: Friday, January 24, 2014 3:34 PM
> To: Jakub Jelinek
> Cc: Jason Merrill; 'Jeff Law'; 'Aldy Hernandez'; 'gcc-patches@gcc.gnu.org';
> 'rth@redhat.com'
> Subject: RE: [PATCH] _Cilk_for for C and C++
> 
> 
> 
> > -----Original Message-----
> > From: Jakub Jelinek [mailto:jakub@redhat.com]
> > Sent: Friday, January 24, 2014 2:42 PM
> > To: Iyer, Balaji V
> > Cc: Jason Merrill; 'Jeff Law'; 'Aldy Hernandez';
> > 'gcc-patches@gcc.gnu.org'; 'rth@redhat.com'
> > Subject: Re: [PATCH] _Cilk_for for C and C++
> >
> > On Thu, Jan 23, 2014 at 04:38:53PM +0000, Iyer, Balaji V wrote:
> > > 	This is how I started to think of it at first, but then when I
> > > thought
> > about it ... in _Cilk_for unlike the #pragma simd's for, the for
> > statement - not the body - (e.g. "_Cilk_for (int ii = 0; ii < 10;
> > ii++") doesn't really do anything nor does it belong in the child
> > function. It is really mostly used to calculate the loop count and capture
> step-size and starting point.
> > >
> > > 	The child function has its own loop that will have a step size of 1
> > regardless of your step size. You use the step-size to find the correct spot.
> > Let me give you an example:
> > >
> > > _Cilk_for (int ii = 0; ii < 10; ii = ii  + 2) {
> > > 	Array [ii] = 5;
> > > }
> > >
> > > This is translated to the following (assume grain is something that
> > > the user
> > input):
> > >
> > > data_ptr.start = 0;
> > > data_ptr.end = 10;
> > > data_ptr.step_size = 2;
> > > __cilkrts_cilk_for_32 (child_function, &data_ptr, (10-0)/2, grain);
> > >
> > > Child_function (void *data_ptr, int high, int low) {
> > > 	for (xx = low; xx < high; xx++)
> > > 	 {
> > > 		Tmp_var = (xx * data_ptr->step_size) + data_ptr->start;
> > > 		// Note: if the _Cilk_for was (ii = 9; ii >= 0; ii -= 2), we would
> > have something like this:
> > > 		// Tmp_var = data_ptr->end - (xx * data_ptr->step_size)
> > > 		// The for-loop above won't change.
> > > 		Array[Tmp_var] = 5;
> > > 	}
> > > }
> >
> > This isn't really much different from
> > #pragma omp parallel for schedule(runtime, N) (i.e. the combined
> > construct), when it is combined, we also don't emit a call to
> > GOMP_parallel but to some other function to which we pass the number
> > of iterations and chunk size (== grain in Cilk+ terminology), the only
> > (minor) difference is that for OpenMP when you handle the whole low ...
> > high range the child function doesn't exit, but calls a function to
> > give it next pari of low/high and only when that function tells it
> > there is no further work to do, it returns.  But, the Cilk+ case is
> > clearly the same thing with just implicit telling there is no further work in
> the current function.
> >
> > So, I'd strongly prefer if you swap the parallel with Cilk_for, just
> > set the flag that the two are combined like OpenMP already has for
> > tons of constructs, and during expansion you just treat it together.
> 
> Hi Jakub,
> 	What you are suggesting here would require a significant rewrite of
> the code. This version of _Cilk_for works and it does share significant amount
> of work with OMP routines as requested by other GCC developers. Given
> the time constraints, let's try to get this version accepted so that the feature
> will be available for the users and we will look into moving toward your
> suggestion when the phase 1 opens again.
> 
> Thanks,
> 
> Balaji V. Iyer.
> 
> 
> >
> > 	Jakub

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

end of thread, other threads:[~2014-03-20 20:39 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-27 20:41 [PING] [PATCH] _Cilk_for for C and C++ 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
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

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