gcc/libgomp/config
Chung-Lin Tang 0bac793ed6 openmp: Implement omp_get_device_num routine
This patch implements the omp_get_device_num library routine, specified in
OpenMP 5.0.

GOMP_DEVICE_NUM_VAR is a macro symbol which defines name of a "device number"
variable, is defined on the device-side libgomp, has it's address returned to
host-side libgomp during device initialization, and the host libgomp then
sets its value to the designated device number.

libgomp/ChangeLog:

	* icv-device.c (omp_get_device_num): New API function, host side.
	* fortran.c (omp_get_device_num_): New interface function.
	* libgomp-plugin.h (GOMP_DEVICE_NUM_VAR): Define macro symbol.
	* libgomp.map (OMP_5.0.2): New version space with omp_get_device_num,
	omp_get_device_num_.
	* libgomp.texi (omp_get_device_num): Add documentation for new API
	function.
	* omp.h.in (omp_get_device_num): Add declaration.
	* omp_lib.f90.in (omp_get_device_num): Likewise.
	* omp_lib.h.in (omp_get_device_num): Likewise.
	* target.c (gomp_load_image_to_device): If additional entry for device
	number exists at end of returned entries from 'load_image_func' hook,
	copy the assigned device number over to the device variable.

	* config/gcn/icv-device.c (GOMP_DEVICE_NUM_VAR): Define static global.
	(omp_get_device_num): New API function, device side.
	* plugin/plugin-gcn.c ("symcat.h"): Add include.
	(GOMP_OFFLOAD_load_image): Add addresses of device GOMP_DEVICE_NUM_VAR
	at end of returned 'target_table' entries.

	* config/nvptx/icv-device.c (GOMP_DEVICE_NUM_VAR): Define static global.
	(omp_get_device_num): New API function, device side.
	* plugin/plugin-nvptx.c ("symcat.h"): Add include.
	(GOMP_OFFLOAD_load_image): Add addresses of device GOMP_DEVICE_NUM_VAR
	at end of returned 'target_table' entries.

	* testsuite/lib/libgomp.exp
	(check_effective_target_offload_target_intelmic): New function for
	testing for intelmic offloading.
	* testsuite/libgomp.c-c++-common/target-45.c: New test.
	* testsuite/libgomp.fortran/target10.f90: New test.
2021-08-05 23:29:03 +08:00
..
accel libgomp: Don't access gomp_sem_t as int using atomics unconditionally 2021-01-18 07:18:46 +01:00
bsd Update copyright years. 2021-01-04 10:26:59 +01:00
darwin Update copyright years. 2021-01-04 10:26:59 +01:00
gcn openmp: Implement omp_get_device_num routine 2021-08-05 23:29:03 +08:00
hpux Update copyright years. 2021-01-04 10:26:59 +01:00
linux libgomp: Don't include limits.h instead of hidden visibility block 2021-07-13 09:50:49 +02:00
mingw32 Update copyright years. 2021-01-04 10:26:59 +01:00
nvptx openmp: Implement omp_get_device_num routine 2021-08-05 23:29:03 +08:00
posix libgomp: Don't access gomp_sem_t as int using atomics unconditionally 2021-01-18 07:18:46 +01:00
rtems RTEMS: Fix libgomp build 2021-01-18 07:24:56 +01:00
t-aix aix: remove libgomp and libatomic archives before creating FAT archives 2020-10-11 17:30:24 -04:00