public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Martin Jambor <mjambor@suse.cz>, GCC Patches <gcc-patches@gcc.gnu.org>
Cc: "Martin Liška" <mliska@suse.cz>
Subject: Re: [HSA, PATCH] Load an HSA runtime via dlopen mechanism
Date: Fri, 19 May 2017 13:36:00 -0000	[thread overview]
Message-ID: <87shk1ynqr.fsf@hertz.schwinge.homeip.net> (raw)
In-Reply-To: <20170409162200.i2amqt5hgduct4at@virgil.suse.cz>

Hi!

On Sun, 9 Apr 2017 18:22:00 +0200, Martin Jambor <mjambor@suse.cz> wrote:
> On Wed, Apr 05, 2017 at 10:11:34AM +0200, Thomas Schwinge wrote:
> > I ran into a case where the libgomp hsa plugin wouldn't load.  The
> > following patch helped me to quickly diagnose and then fix that.  OK for
> > trunk?
> 
> Yes, thanks.

Thanks, now finally, as posted, committed to trunk in r248277:

commit b7d6170b96407c80b3e21dd6a665ebff7715d62e
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri May 19 13:32:04 2017 +0000

    libgomp hsa plugin: debug output for HSA runtime library loading failure
    
            libgomp/
            * plugin/plugin-hsa.c (DLSYM_FN, init_hsa_runtime_functions):
            Debug output for failure.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248277 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog           | 5 +++++
 libgomp/plugin/plugin-hsa.c | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index 083cb85..84d1c839 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-19  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* plugin/plugin-hsa.c (DLSYM_FN, init_hsa_runtime_functions):
+	Debug output for failure.
+
 2017-05-12  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* testsuite/lib/libgomp.exp: Load scanlang.exp.
diff --git libgomp/plugin/plugin-hsa.c libgomp/plugin/plugin-hsa.c
index 9cc243d..90ca247 100644
--- libgomp/plugin/plugin-hsa.c
+++ libgomp/plugin/plugin-hsa.c
@@ -491,14 +491,14 @@ static struct hsa_context_info hsa_context;
 #define DLSYM_FN(function) \
   hsa_fns.function##_fn = dlsym (handle, #function); \
   if (hsa_fns.function##_fn == NULL) \
-    return false;
+    goto dl_fail;
 
 static bool
 init_hsa_runtime_functions (void)
 {
   void *handle = dlopen (hsa_runtime_lib, RTLD_LAZY);
   if (handle == NULL)
-    return false;
+    goto dl_fail;
 
   DLSYM_FN (hsa_status_string)
   DLSYM_FN (hsa_agent_get_info)
@@ -530,6 +530,10 @@ init_hsa_runtime_functions (void)
   DLSYM_FN (hsa_ext_program_destroy)
   DLSYM_FN (hsa_ext_program_finalize)
   return true;
+
+ dl_fail:
+  HSA_DEBUG ("while loading %s: %s\n", hsa_runtime_lib, dlerror ());
+  return false;
 }
 
 /* Find kernel for an AGENT by name provided in KERNEL_NAME.  */


Grüße
 Thomas

      reply	other threads:[~2017-05-19 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19  8:24 Martin Liška
2017-04-05  8:11 ` Thomas Schwinge
2017-04-09 16:22   ` Martin Jambor
2017-05-19 13:36     ` Thomas Schwinge [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shk1ynqr.fsf@hertz.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).