Hi, On Mon, Mar 21, 2016 at 06:21:02PM +0800, 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.
I have just tested the whole patch-set on my HSA box (i.e. gomp.exp tests and all libgomp tests on trunk + some extra testing on the hsa branch) and found no issues. I have had a very superficial look over the patch and have no objections but since I am not familiar with the issue this addresses and because I do not have detailed understanding of the of internals of copying data to/from devices, my opinion should not really count much. Nevertheless, thanks for thinking about HSA and making me aware of the change, Martin > > Thanks, > Chung-Lin > > ChangeLog for the libgomp proper parts, patch as attached. > > 2016-03-20 Chung-Lin Tang <clt...@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. >