This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp4] Remove redundant get_caps hook invocations


Hi,

This patch causes the get_caps hook to be called only once during
device initialisation, and caches the result in the device's
"capabilities" field.

OK for gomp4 branch?

Thanks,

Julian

ChangeLog

    libgomp/
    * target.c (gomp_load_plugin_for_device): Only call get_caps once.
    (gomp_find_available_plugins): ...and don't call it again here.
commit 271ee70eec93866e312c7b9363cb0e736b6361d3
Author: Julian Brown <julian@codesourcery.com>
Date:   Tue Oct 28 07:14:19 2014 -0700

    Remove redundant get_caps calls.

diff --git a/libgomp/target.c b/libgomp/target.c
index 73a186b..615ba6b 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -1036,9 +1036,10 @@ gomp_load_plugin_for_device (struct gomp_device_descr *device,
   DLSYM (device_free);
   DLSYM (device_dev2host);
   DLSYM (device_host2dev);
-  if (device->get_caps_func () & TARGET_CAP_OPENMP_400)
+  device->capabilities = device->get_caps_func ();
+  if (device->capabilities & TARGET_CAP_OPENMP_400)
     DLSYM (device_run);
-  if (device->get_caps_func () & TARGET_CAP_OPENACC_200)
+  if (device->capabilities & TARGET_CAP_OPENACC_200)
     {
       optional_present = optional_total = 0;
       DLSYM_OPT (openacc.exec, openacc_parallel);
@@ -1167,7 +1168,6 @@ gomp_find_available_plugins (void)
 	  devicep->mem_map.is_initialized = false;
 	  devicep->type = devicep->get_type_func ();
 	  devicep->name = devicep->get_name_func ();
-	  devicep->capabilities = devicep->get_caps_func ();
 	  gomp_mutex_init (&devicep->mem_map.lock);
 	  devicep->ord = i;
 	  devicep->target_data = NULL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]