This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libgomp, WIP, GSoC'19] Modification to a single queue, single execution path.


On Wed, Jul 24, 2019 at 05:25:56PM +0900, 김규래 wrote:
> > Generally, we don't want to have code commented out like this in the final
> > patch submission.  For this WIP, I think it is acceptable, as I think in the
> > end you don't want to use the team's queue, but actually either
> > children_queue (renamed), but only use it on the implicit tasks, or during
>  
> Can you elaborate?
> What do you mean by "children_queue (renamed)"?

I meant use a queue structure member in the same location as current
children_queue, just rename it to something more sensible (just task_queue
etc.), because it will not be really a queue of task children anymore.

> > team creation allocate together with the team structure also memory that
> > would be used as a trailing array for an array of the implicit queues next
> > to the array of implicit tasks. 
>  
> Do you mean to make two trailing arrays in gomp_team?

Yes.  Of course, in C you can't have two flexible array members after each
other, and we certainly don't want to use the GNU C extension of variable
length structures, but it would be something like struct gomp_team have
a struct priority_queue *task_queues; where the struct gomp_team
initialization would set team->task_queues to (struct priority_queue *)
&team->implicit_task[team->nthreads].

> Also, this is a personal question, why do gcc prefer trailing arrays over dynamically allocated pointers?

Because malloc is fairly expensive and lots of benchmarks etc. care about
#pragma omp parallel latency (when the threads are already around, of course
the first one that needs to pthread_create is much more expensive).  So it
makes quite noticeable difference if you allocate one allocation or 3 or
more.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]