This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libgomp nvptx plugin: rework initialisation and support the proposed load/unload hooks (was: Merge current set of OpenACC changes from gomp-4_0-branch)
- From: Ilya Verbin <iverbin at gmail dot com>
- To: Julian Brown <julian at codesourcery dot com>, Thomas Schwinge <thomas at codesourcery dot com>, Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Kirill Yukhin <kirill dot yukhin at gmail dot com>
- Date: Mon, 23 Mar 2015 22:44:39 +0300
- Subject: Re: libgomp nvptx plugin: rework initialisation and support the proposed load/unload hooks (was: Merge current set of OpenACC changes from gomp-4_0-branch)
- Authentication-results: sourceware.org; auth=none
- References: <20150127140741 dot 3f6d650b at octopus> <20150203112844 dot GA54416 at msticlxl57 dot ims dot intel dot com> <20150203130000 dot 7be35f5e at octopus> <20150203200104 dot GB54416 at msticlxl57 dot ims dot intel dot com> <20150204150545 dot 2628ad35 at octopus> <20150224112951 dot 363b71fd at octopus> <87a902ib93 dot fsf at schwinge dot name> <20150226172511 dot GA49293 at msticlxl57 dot ims dot intel dot com> <20150306140113 dot GB26588 at msticlxl57 dot ims dot intel dot com> <20150309144555 dot 3a078f48 at octopus>
On Mon, Mar 09, 2015 at 14:45:55 +0000, Julian Brown wrote:
> On Fri, 6 Mar 2015 17:01:13 +0300
> Ilya Verbin <iverbin@gmail.com> wrote:
>
> > On Thu, Feb 26, 2015 at 20:25:11 +0300, Ilya Verbin wrote:
> > > On Wed, Feb 25, 2015 at 10:36:08 +0100, Thomas Schwinge wrote:
> > > > > Julian Brown <julian@codesourcery.com> wrote:
> > > > > This is a version of the previously-posted patch to rework
> > > > > initialisation and support the proposed load/unload hooks,
> > > > > merged to gomp4 branch and tested alongside the two patches
> > > > > (from
> > >
> > > Currently the 'struct gomp_memory_mapping' contains 'lock' and
> > > 'is_initialized'. Do you still need them? Or we can use
> > > gomp_device_descr::lock and is_initialized instead? If yes, then
> > > we can replace the gomp_memory_mapping structure with a splay_tree,
> > > as it was before the OpenACC merge.
> >
> > Ping?
>
> Apologies, I've been distracted with travel and other things. I
> suspect, as you suggest, that the gomp_memory_mapping
> lock/is_initialized fields may no longer be required. I haven't yet had
> time to address that nor all of Thomas's comments on the patch (mostly
> breakage with multiple devices), and I'm unlikely to have time this
> week either due to vacation...
If it is too late for such global changes (rework initialization in libgomp,
change mic and ptx plugins), then here is a small workaround patch to fix
offloading from libraries. Likely, it will not affect OpenACC programs with one
image. make check-target-libgomp passed.
PR libgomp/65338
libgomp/
* libgomp.h (struct gomp_device_descr): Remove
offload_regions_registered.
* oacc-host.c (host_dispatch): Do not initialize
offload_regions_registered.
* target.c (gomp_register_image_for_device): Do not check for
offload_regions_registered.
(gomp_target_init): Do not initialize offload_regions_registered.
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 3089401..f45fdba 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -793,9 +793,6 @@ struct gomp_device_descr
/* Set to true when device is initialized. */
bool is_initialized;
- /* True when offload regions have been registered with this device. */
- bool offload_regions_registered;
-
/* OpenACC-specific data and functions. */
/* This is mutable because of its mutable data_environ and target_data
members. */
diff --git a/libgomp/oacc-host.c b/libgomp/oacc-host.c
index 6aeb1e7..2763f44 100644
--- a/libgomp/oacc-host.c
+++ b/libgomp/oacc-host.c
@@ -56,7 +56,6 @@ static struct gomp_device_descr host_dispatch =
.mem_map.is_initialized = false,
.mem_map.splay_tree.root = NULL,
.is_initialized = false,
- .offload_regions_registered = false,
.openacc = {
.open_device_func = GOMP_OFFLOAD_openacc_open_device,
diff --git a/libgomp/target.c b/libgomp/target.c
index 50baa4d..db1f509 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1035,13 +1035,8 @@ static void
gomp_register_image_for_device (struct gomp_device_descr *device,
struct offload_image_descr *image)
{
- if (!device->offload_regions_registered
- && (device->type == image->type
- || device->type == OFFLOAD_TARGET_TYPE_HOST))
- {
- device->register_image_func (image->host_table, image->target_data);
- device->offload_regions_registered = true;
- }
+ if (device->type == image->type || device->type == OFFLOAD_TARGET_TYPE_HOST)
+ device->register_image_func (image->host_table, image->target_data);
}
/* This function initializes the runtime needed for offloading.
@@ -1105,7 +1100,6 @@ gomp_target_init (void)
current_device.mem_map.is_initialized = false;
current_device.mem_map.splay_tree.root = NULL;
current_device.is_initialized = false;
- current_device.offload_regions_registered = false;
current_device.openacc.data_environ = NULL;
current_device.openacc.target_data = NULL;
for (i = 0; i < new_num_devices; i++)
-- Ilya