This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 1/4, libgomp] Resolve deadlock on plugin exit
- From: Chung-Lin Tang <cltang at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, Nathan Sidwell <nathan at codesourcery dot com>, Thomas Schwinge <thomas at codesourcery dot com>, "Verbin, Ilya" <ilya dot verbin at intel dot com>, Martin Jambor <mjambor at suse dot cz>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 16 Apr 2016 15:39:24 +0800
- Subject: Re: [PATCH 1/4, libgomp] Resolve deadlock on plugin exit
- Authentication-results: sourceware.org; auth=none
- References: <56EFCB0E dot 7010308 at codesourcery dot com>
Ping.
On 2016/3/21 06:21 PM, Chung-Lin Tang wrote:
> Hi, this is the set of patches from https://gcc.gnu.org/ml/gcc-patches/2015-12/msg01411.html
> revised again, this time also with audits for the HSA plugin.
>
> The changes are pretty minor, mainly that the unload_image hook now
> receives similar error handling treatment.
>
> Tested again without regressions for nvptx and intelmic, however
> while I was able to build the toolchain with HSA offloading support, I was
> unsure how I could test it, as I currently don't have any AMD hardware (not
> aware if there's an emulator like intelmic). I would be grateful if
> the HSA folks can run them for me.
>
> Thanks,
> Chung-Lin
>
> ChangeLog for the libgomp proper parts, patch as attached.
>
> 2016-03-20 Chung-Lin Tang <cltang@codesourcery.com>
>
> * target.c (gomp_device_copy): New function.
> (gomp_copy_host2dev): Likewise.
> (gomp_copy_dev2host): Likewise.
> (gomp_free_device_memory): Likewise.
> (gomp_map_vars_existing): Adjust to call gomp_copy_host2dev().
> (gomp_map_pointer): Likewise.
> (gomp_map_vars): Adjust to call gomp_copy_host2dev(), handle
> NULL value from alloc_func plugin hook.
> (gomp_unmap_tgt): Adjust to call gomp_free_device_memory().
> (gomp_copy_from_async): Adjust to call gomp_copy_dev2host().
> (gomp_unmap_vars): Likewise.
> (gomp_update): Adjust to call gomp_copy_dev2host() and
> gomp_copy_host2dev() functions.
> (gomp_unload_image_from_device): Handle false value from
> unload_image_func plugin hook.
> (gomp_init_device): Handle false value from init_device_func
> plugin hook.
> (gomp_exit_data): Adjust to call gomp_copy_dev2host().
> (omp_target_free): Adjust to call gomp_free_device_memory().
> (omp_target_memcpy): Handle return values from host2dev_func,
> dev2host_func, and dev2dev_func plugin hooks.
> (omp_target_memcpy_rect_worker): Likewise.
> (gomp_target_fini): Handle false value from fini_device_func
> plugin hook.
> * libgomp.h (struct gomp_device_descr): Adjust return type of
> init_device_func, fini_device_func, unload_image_func, free_func,
> dev2host_func,host2dev_func, and dev2dev_func plugin hooks to 'bool'.
> * oacc-host.c (host_init_device): Change return type to bool.
> (host_fini_device): Likewise.
> (host_unload_image): Likewise.
> (host_free): Likewise.
> (host_dev2host): Likewise.
> (host_host2dev): Likewise.
> * oacc-mem.c (acc_free): Handle plugin hook fatal error case.
> (acc_memcpy_to_device): Likewise.
> (acc_memcpy_from_device): Likewise.
> (delete_copyout): Add libfnname parameter, handle free_func
> hook fatal error case.
> (acc_delete): Adjust delete_copyout call.
> (acc_copyout): Likewise.
> (update_dev_host): Move gomp_mutex_unlock to after
> host2dev/dev2host hook calls.
>