From patchwork Fri May 19 13:34:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 764665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wTpv64nClz9s5L for ; Fri, 19 May 2017 23:34:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="q3JMmKvK"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=J6HJeTrwgVdagRDTvlktHouTLZL+pq1VKideb6bHgcP+HkOg++yyQ HDn8jIDxJsZ52xbv5J9aBWik+QFKsB2ttD4JT5rkv+TWp4iO/7Weah/Tz5TqvZMA GTii9A1c/jH7wPcVL29h0zpGHk0kDpYRuwMlDIJuEQWcq5TgfeatEY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=ZcaObDZ9WqYZiMVZk+6F/R4iMfg=; b=q3JMmKvKC34ZCmPpzlwvqcRbzpVW FP0hzoWy2FNnxV3jQ7oZZ/5IMbmfEJoINjeeaxv9D2xnHuGoJQMEK5lzuel72Hdw wIDV0rRRdqR0JXBgFbAseAFc6XLW6POOnhC0PoeY79i/ltWY/0J26Hy9w9sauhmL YW4BQOtRiXA10x0= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 15:34:04 +0200 Message-ID: <87shk1ynqr.fsf@hertz.schwinge.homeip.net> MIME-Version: 1.0 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) 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? > > 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 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(-) Grüße Thomas 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 * 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. */