OpenMP: Add get_device_from_uid/omp_get_uid_from_device routines
Those TR13/OpenMP 6.0 routines permit a reproducible offloading to a specific device by mapping an OpenMP device number to a unique ID (UID). The GPU device UIDs should be universally unique, the one for the host is not. gcc/ChangeLog: * omp-general.cc (omp_runtime_api_procname): Add get_device_from_uid and omp_get_uid_from_device routines. include/ChangeLog: * cuda/cuda.h (cuDeviceGetUuid): Declare. (cuDeviceGetUuid_v2): Add prototype. libgomp/ChangeLog: * config/gcn/target.c (omp_get_uid_from_device, omp_get_device_from_uid): Add stub implementation. * config/nvptx/target.c (omp_get_uid_from_device, omp_get_device_from_uid): Likewise. * fortran.c (omp_get_uid_from_device_, omp_get_uid_from_device_8_): New functions. * libgomp-plugin.h (GOMP_OFFLOAD_get_uid): Add prototype. * libgomp.h (struct gomp_device_descr): Add 'uid' and 'get_uid_func'. * libgomp.map (GOMP_6.0): New, includind the new UID routines. * libgomp.texi (OpenMP Technical Report 13): Mark UID routines as 'Y'. (Device Information Routines): Document new UID routines. (Offload-Target Specifics): Document UID format. * omp.h.in (omp_get_device_from_uid, omp_get_uid_from_device): New prototype. * omp_lib.f90.in (omp_get_device_from_uid, omp_get_uid_from_device): New interface. * omp_lib.h.in: Likewise. * plugin/cuda-lib.def: Add cuDeviceGetUuid and cuDeviceGetUuid_v2 via CUDA_ONE_CALL_MAYBE_NULL. * plugin/plugin-gcn.c (GOMP_OFFLOAD_get_uid): New. * plugin/plugin-nvptx.c (GOMP_OFFLOAD_get_uid): New. * target.c (str_omp_initial_device): New static var. (STR_OMP_DEV_PREFIX): Define. (gomp_get_uid_for_device, omp_get_uid_from_device, omp_get_device_from_uid): New. (gomp_load_plugin_for_device): DLSYM_OPT the function 'get_uid'. (gomp_target_init): Set the device's 'uid' field to NULL. * testsuite/libgomp.c/device_uid.c: New test. * testsuite/libgomp.fortran/device_uid.f90: New test.
Showing
- gcc/omp-general.cc 3 additions, 1 deletiongcc/omp-general.cc
- include/cuda/cuda.h 7 additions, 0 deletionsinclude/cuda/cuda.h
- libgomp/config/gcn/target.c 14 additions, 0 deletionslibgomp/config/gcn/target.c
- libgomp/config/nvptx/target.c 14 additions, 0 deletionslibgomp/config/nvptx/target.c
- libgomp/fortran.c 15 additions, 0 deletionslibgomp/fortran.c
- libgomp/libgomp-plugin.h 1 addition, 0 deletionslibgomp/libgomp-plugin.h
- libgomp/libgomp.h 2 additions, 0 deletionslibgomp/libgomp.h
- libgomp/libgomp.map 8 additions, 0 deletionslibgomp/libgomp.map
- libgomp/libgomp.texi 83 additions, 6 deletionslibgomp/libgomp.texi
- libgomp/omp.h.in 3 additions, 0 deletionslibgomp/omp.h.in
- libgomp/omp_lib.f90.in 23 additions, 0 deletionslibgomp/omp_lib.f90.in
- libgomp/omp_lib.h.in 23 additions, 0 deletionslibgomp/omp_lib.h.in
- libgomp/plugin/cuda-lib.def 2 additions, 0 deletionslibgomp/plugin/cuda-lib.def
- libgomp/plugin/plugin-gcn.c 16 additions, 0 deletionslibgomp/plugin/plugin-gcn.c
- libgomp/plugin/plugin-nvptx.c 34 additions, 0 deletionslibgomp/plugin/plugin-nvptx.c
- libgomp/target.c 56 additions, 0 deletionslibgomp/target.c
- libgomp/testsuite/libgomp.c/device_uid.c 38 additions, 0 deletionslibgomp/testsuite/libgomp.c/device_uid.c
- libgomp/testsuite/libgomp.fortran/device_uid.f90 42 additions, 0 deletionslibgomp/testsuite/libgomp.fortran/device_uid.f90
Loading
Please register or sign in to comment