From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53828 invoked by alias); 19 May 2017 13:34:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 53810 invoked by uid 89); 19 May 2017 13:34:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=AGENT X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 19 May 2017 13:34:26 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1dBi31-0003Hf-Eo from Thomas_Schwinge@mentor.com ; Fri, 19 May 2017 06:34:27 -0700 Received: from hertz.schwinge.homeip.net (137.202.0.87) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 19 May 2017 14:34:24 +0100 From: Thomas Schwinge To: Martin Jambor , GCC Patches CC: Martin =?utf-8?Q?Li=C5=A1ka?= Subject: Re: [HSA, PATCH] Load an HSA runtime via dlopen mechanism In-Reply-To: <20170409162200.i2amqt5hgduct4at@virgil.suse.cz> References: <5715EB44.1030903@suse.cz> <87pogrgtop.fsf@euler.schwinge.homeip.net> <20170409162200.i2amqt5hgduct4at@virgil.suse.cz> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Fri, 19 May 2017 13:36:00 -0000 Message-ID: <87shk1ynqr.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-SW-Source: 2017-05/txt/msg01570.txt.bz2 Hi! On Sun, 9 Apr 2017 18:22:00 +0200, Martin Jambor 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? >=20 > Yes, thanks. Thanks, now finally, as posted, committed to trunk in r248277: commit b7d6170b96407c80b3e21dd6a665ebff7715d62e Author: tschwinge Date: Fri May 19 13:32:04 2017 +0000 libgomp hsa plugin: debug output for HSA runtime library loading failure =20=20=20=20 libgomp/ * plugin/plugin-hsa.c (DLSYM_FN, init_hsa_runtime_functions): Debug output for failure. =20=20=20=20 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248277 138bc75d-0d04-04= 10-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 + + * plugin/plugin-hsa.c (DLSYM_FN, init_hsa_runtime_functions): + Debug output for failure. + 2017-05-12 Rainer Orth =20 * 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 =3D dlsym (handle, #function); \ if (hsa_fns.function##_fn =3D=3D NULL) \ - return false; + goto dl_fail; =20 static bool init_hsa_runtime_functions (void) { void *handle =3D dlopen (hsa_runtime_lib, RTLD_LAZY); if (handle =3D=3D NULL) - return false; + goto dl_fail; =20 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; } =20 /* Find kernel for an AGENT by name provided in KERNEL_NAME. */ Gr=C3=BC=C3=9Fe Thomas