This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
- From: Bernd Schmidt <bernds at codesourcery dot com>
- To: Ilya Verbin <iverbin at gmail dot com>
- Cc: Thomas Schwinge <thomas at codesourcery dot com>, "Michael V. Zolotukhin" <michael dot v dot zolotukhin at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>, Richard Biener <rguenther at suse dot de>, Kirill Yukhin <kirill dot yukhin at gmail dot com>, Andrey Turetskiy <andrey dot turetskiy at gmail dot com>, Ilya Tocar <tocarip dot intel at gmail dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Nathan Sidwell <nathan_sidwell at mentor dot com>
- Date: Thu, 6 Mar 2014 09:47:00 +0100
- Subject: Re: Fwd: [RFC][gomp4] Offloading patches (2/3): Add tables generation
- Authentication-results: sourceware.org; auth=none
- References: <20131217113957 dot GA39975 at msticlxl57 dot ims dot intel dot com> <52E7927B dot 8030509 at codesourcery dot com> <CADG=Z0GQ8ORLe1XRUU7VMYeLhwuWisMyCcGLQj-nY_bhkbD_1Q at mail dot gmail dot com> <CADG=Z0HRb1ojtTc4xEAG=hH_GcfAARDAmn70XGB5khF0mME4pQ at mail dot gmail dot com> <52E9137C dot 4020706 at codesourcery dot com> <CADG=Z0HkhefrBJ_tKyhEHv+p+AMTvpbxf=Md6JOCv6rAUu1u9g at mail dot gmail dot com> <CADG=Z0GW==Wax+3B5Z2JiieOWoz_gWpqtdhHA_L9-Nzb6u4bnA at mail dot gmail dot com> <530648F8 dot 2010409 at codesourcery dot com> <CADG=Z0HE6AudmZuQK2vWz+E4fh8PnqoJ-aq9GXjZXgn-ZRW0kw at mail dot gmail dot com> <5310B791 dot 1000703 at codesourcery dot com> <20140305171518 dot GA26771 at msticlxl57 dot ims dot intel dot com>
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