diff mbox

[gomp4] Remove redundant get_caps hook invocations

Message ID 20141028164031.6d53c732@octopus
State New
Headers show

Commit Message

Julian Brown Oct. 28, 2014, 4:40 p.m. UTC
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.

Comments

Thomas Schwinge Oct. 28, 2014, 7:26 p.m. UTC | #1
Hi Julian!

On Tue, 28 Oct 2014 16:40:31 +0000, Julian Brown <julian@codesourcery.com> wrote:
> 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?

Yes, thanks!  I think such patches you can also apply without pre-commit
review, on a "obvious" basis.

>     libgomp/
>     * target.c (gomp_load_plugin_for_device): Only call get_caps once.
>     (gomp_find_available_plugins): ...and don't call it again here.


Grüße,
 Thomas
diff mbox

Patch

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;