[PATCH 1/4, libgomp] Resolve deadlock on plugin exit

Chung-Lin Tang cltang@codesourcery.com
Mon Mar 21 10:22:00 GMT 2016


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01-libgomp.patch
Type: text/x-patch
Size: 21945 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160321/98dedf09/attachment.bin>


More information about the Gcc-patches mailing list