]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp, OpenMP: Fix issue for omp_get_device_num on gcn targets.
authorMarcel Vollweiler <marcel@codesourcery.com>
Wed, 19 Jan 2022 13:57:54 +0000 (05:57 -0800)
committerMarcel Vollweiler <marcel@codesourcery.com>
Wed, 19 Jan 2022 13:57:54 +0000 (05:57 -0800)
Currently omp_get_device_num does not work on gcn targets with more than one
offload device. The reason is that GOMP_DEVICE_NUM_VAR is static in
icv-device.c and thus "__gomp_device_num" is not visible in the offload image.

This patch removes "static" such that "__gomp_device_num" is now part of the
offload image and can now be found in GOMP_OFFLOAD_load_image in the plugin.

This is not an issue for nvptx. There, "__gomp_device_num" is in the offload
image even with "static".

libgomp/ChangeLog:

* config/gcn/icv-device.c: Make GOMP_DEVICE_NUM_VAR public (remove
"static") to make the device num available in the offload image.

(cherry picked from commit 0bd247bbbe4cf396173f09eeec37e116e98f8471)

gcc/ChangeLog.omp
libgomp/config/gcn/icv-device.c

index 88826ce2944061ab297cb074d24133769a26215c..568ffb839cfa19a362541409ac57bd2855860b67 100644 (file)
@@ -1,3 +1,9 @@
+2022-01-19  Marcel Vollweiler  <marcel@codesourcery.com>
+
+       Backport from master:
+       * config/gcn/icv-device.c: Make GOMP_DEVICE_NUM_VAR public (remove
+       "static") to make the device num available in the offload image.
+
 2021-12-22  Andrew Stubbs  <ams@codesourcery.com>
 
        Backport from master:
index 34e0f8346f2348f77feadd16332a14787f77aadb..9676427e28b7805511eb0be49898c633285996a0 100644 (file)
@@ -72,7 +72,7 @@ omp_is_initial_device (void)
 
 /* This is set to the device number of current GPU during device initialization,
    when the offload image containing this libgomp portion is loaded.  */
-static volatile int GOMP_DEVICE_NUM_VAR;
+volatile int GOMP_DEVICE_NUM_VAR;
 
 int
 omp_get_device_num (void)