On Mon, Aug 24, 2015 at 14:26:57 +0200, Jakub Jelinek wrote: > On Mon, Jul 20, 2015 at 09:53:42PM +0300, Ilya Verbin wrote: > > Latest liboffloadmic (I'm preparing an update for trunk) can take some > > pointer > > *ptr* as argument of __offload_offload, which is used for execution and data > > transfer. When given job is finished, it will call some callback in > > libgomp on > > host, passing *ptr* back to it, thus libgomp can distinguish which job has > > been finished. BTW, which word to use here to avoid confusion? (task? job?) > > > > I'm going to prototype something in libgomp using this interface. > > Based on the recent largish thread on omp-lang, it seems that the intent > is that depend clause on target* constructs is for an implicit "target task" > on the host side, so sorry for understanding it as dependencies on the > implicit task on the device instead before. As the "target task" is > supposed to be merged (i.e. sharing ICVs and variables), for > constructs without nowait and depend clauses we can do what we do right now, > perhaps later with some optimizations trying to invoke other tasks if > waiting for the hardware.
I just got back from vacation, and trying to understand that conversation :) > For target* constructs with nowait and/or depend clauses, we'll need to pass > in the depend info (which is a pointer to array of addresses, with first > "address" being total count and second "address" being number of out/inout > dependencies at the beginning, and whether nowait is present or not (a bit > somewhere), then create some struct gomp_task for it supposedly with a new > GOMP_TASK_TARGET kind, and handle the dependency waiting etc. like for other > tasks, except that it will not have a real body, but saved arguments from > the GOMP_target* call (at least for not immediately > satisfied dependency my understanding from the mail thread is that > the data transfer operations are supposed to start only when the dependency > is met). So, what will happen with a target task on the host when all dependencies are satisfied and it is ready to start? As I understood: * libgomp will call GOMP_OFFLOAD_run with a new 'async' argument, or a new function GOMP_OFFLOAD_run_async, which will start target function on the device and immediately return control to libgomp. * The task will go into some pending state, allowing to run another tasks on the host (I'm not very familiar with task.c yet). * When target function is finished, the target runtime library will notify libgomp by callback. libgomp will remove the task and make dependent tasks (if any) ready to start. Is this correct? -- Ilya