diff options
author | Chung-Lin Tang <cltang@codesourcery.com> | 2021-08-05 23:29:03 +0800 |
---|---|---|
committer | Chung-Lin Tang <cltang@codesourcery.com> | 2021-08-05 23:29:03 +0800 |
commit | 0bac793ed6bad2c0c13cd1e93a1aa5808467afc8 (patch) | |
tree | 4f956146f4b129e344b00fa47e0326b831ef9928 /libgomp/fortran.c | |
parent | 8dec72aeb54e98643c0fb3d53768cdb96cf1342a (diff) | |
download | gcc-0bac793ed6bad2c0c13cd1e93a1aa5808467afc8.zip gcc-0bac793ed6bad2c0c13cd1e93a1aa5808467afc8.tar.gz gcc-0bac793ed6bad2c0c13cd1e93a1aa5808467afc8.tar.bz2 |
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.
Diffstat (limited to 'libgomp/fortran.c')
-rw-r--r-- | libgomp/fortran.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libgomp/fortran.c b/libgomp/fortran.c index e042702..07f9765 100644 --- a/libgomp/fortran.c +++ b/libgomp/fortran.c @@ -83,6 +83,7 @@ ialias_redirect (omp_get_partition_place_nums) ialias_redirect (omp_set_default_device) ialias_redirect (omp_get_default_device) ialias_redirect (omp_get_num_devices) +ialias_redirect (omp_get_device_num) ialias_redirect (omp_get_num_teams) ialias_redirect (omp_get_team_num) ialias_redirect (omp_is_initial_device) @@ -600,6 +601,12 @@ omp_get_initial_device_ (void) } int32_t +omp_get_device_num_ (void) +{ + return omp_get_device_num (); +} + +int32_t omp_get_max_task_priority_ (void) { return omp_get_max_task_priority (); |