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: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation


On 03/05/2014 06:15 PM, Ilya Verbin wrote:
On 28 Feb 17:21, Bernd Schmidt wrote:
I think it won't help that much - I still think this entire scheme
is likely to fail on nvptx. I'll try to construct an example at
some point.

One other thing about the split tables is that we don't have to
write a useless size of 1 for functions.


The concept of "image" is likely to vary somewhat between
accelerators. For ptx, it's just a string and it can't really be
generated the same way as for your target where you can manipulate
ELF images. So I think it is better to have a call to a gomp
registration function for every offload target. That should also
give you the ordering you said you wanted between shared
libraries.


Probably. I think the constructor call to the gomp registration
function would contain an opaque pointer to whatever data the
target wants, so it can arrange its image/table data in whatever
way it likes.

Assuming that we're using the scheme with tables. Every DSO with
offloading must contain a constructor call to GOMP_offload_register
(const void *openmp_target); The openmp_target descriptor in every
DSO will have target-independent entries (addresses of host tables)
and target-dependent entries for each target. Its format may be like
this:

void *__OPENMP_TARGET__[] = { _omp_host_func_table;
_omp_host_funcs_end; _omp_host_var_table; _omp_host_vars_end;
_omp_num_targets; _omp_target_descs[]; /* array of tgt_desc */ }

I don't see why you want the array of target descriptors - it would take
some effort to construct, and as far as I can tell it's unnecessary. You
can just pass a pointer to the corresponding descriptor to every
GOMP_offload_register call.


struct tgt_desc { int _omp_tgt_id; void *_omp_tgt_%s_image_start;
void *_omp_tgt_%s_image_end; void *_omp_tgt_%s_func_mappings; void
*_omp_tgt_%s_var_mappings; /* some other data if needed */ }

This looks reasonable.

During the devices initialization libgomp will pass the openmp_target
pointer to all plugins. Each plugin will scan over tgt_descs and find
the required entries using the _omp_tgt_id.

Once again, that seems unnecessarily complicated. The plugins can register their target ID with libgomp, and when libgomp sees a GOMP_offload_register call with the corresponding target ID, it can invoke the appropriate plugin immediately.

BTW, do you have any estimate when you will commit your patches to
the branch, so that we could merge them with ours, and get something
working for everybody?

I've been waiting for us to reach agreement on how things should look. If there are patches in the series that you're happy with, let me know and I can commit them (it may be next week though).


Bernd


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