From patchwork Mon Jun 26 11:31:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 780675 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 3wx6ND4Ls4z9s7f for ; Mon, 26 Jun 2017 21:32:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="x3E4TXeS"; 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 :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=fosJVRhJ/ostMYKTT qWmizHu28drBYWIFXag92ytcUFx5IwTO/F6tG81jwZdY8U3n4nFBeSKOJlbC2f5s VMjse70OZmYIUrKBjC9Goh/7F3wnT9Vd0imss8oyCqBHXRzBaQ3GHCUaWCY9Q0XE b4rvrj0hQGD0K48t2/yMo3jsa4= 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 :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=msr51if8RH3HN2SABrkLDaa 5EPQ=; b=x3E4TXeSOy7hQeHucpRldpDcn6Qq1K+LYHAyHsjtVOYVtP9ZxzfUPsX ZPW2fp+mpzJ5XdPjX5acDp5HZqIfJPDFlKdT7W3Ifzm5GpDP6Uzl9dbRzJlpqhHh pnQCS4GdMwMVuQxFnNKsfL4fsSY4EBCyKYZq7lJl4Wai3/wTYZdM= Received: (qmail 97807 invoked by alias); 26 Jun 2017 11:32:01 -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 97698 invoked by uid 89); 26 Jun 2017 11:32:00 -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= 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; Mon, 26 Jun 2017 11:31:58 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1dPSFI-0005Ts-WE from Tom_deVries@mentor.com ; Mon, 26 Jun 2017 04:31:57 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Mon, 26 Jun 2017 12:31:52 +0100 Subject: [PATCH, 1/4] Show value of GOMP_OPENACC_DIM in libgomp nvptx plugin From: Tom de Vries To: Jakub Jelinek CC: GCC Patches , Thomas Schwinge References: <2413b0f6-9cb2-243f-d805-08323a9c9a0a@mentor.com> Message-ID: <807cbe7f-c5b9-e02d-f74f-096fc0bf7cfb@mentor.com> Date: Mon, 26 Jun 2017 13:31:48 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <2413b0f6-9cb2-243f-d805-08323a9c9a0a@mentor.com> X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) On 06/26/2017 01:24 PM, Tom de Vries wrote: > Hi, > > I've written a patch series to facilitate debugging libgomp openacc > testcase failures on the nvptx accelerator. > > > When running an openacc test-case on an nvptx accelerator, the following > happens: > - the plugin obtains the ptx assembly for the acceleration kernels > - it calls the cuda jit to compile and link the ptx into a module > - it loads the module > - it starts an acceleration kernel > > The patch series adds these environment variables: > - GOMP_OPENACC_NVPTX_SAVE_TEMPS: a means to save the resulting module > such that it can be investigated using nvdisasm and cuobjdump. > - GOMP_OPENACC_NVPTX_DISASM: a means to see the resulting module in > the debug output, by writing it into a file and calling nvdisasm on > it > - GOMP_OPENACC_NVPTX_JIT: a means to set parameters of the > compilation/linking process, currently supporting: > * -O[0-4], mapping onto CU_JIT_OPTIMIZATION_LEVEL > * -ori, mapping onto CU_JIT_NEW_SM3X_OPT > > > The patch series consists of these patches: > > 1. Show value of GOMP_OPENACC_DIM in libgomp nvptx plugin This patch adds a debug message (for GOMP_DEBUG=1) about the value of the GOMP_OPENACC_DIM variable read from the environment. Thanks, - Tom Show value of GOMP_OPENACC_DIM in libgomp nvptx plugin 2017-06-26 Tom de Vries * plugin/plugin-nvptx.c (notify_var): New function. (nvptx_exec): Use notify_var for GOMP_OPENACC_DIM. --- libgomp/plugin/plugin-nvptx.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libgomp/plugin/plugin-nvptx.c b/libgomp/plugin/plugin-nvptx.c index 0e1b3e2..71630b5 100644 --- a/libgomp/plugin/plugin-nvptx.c +++ b/libgomp/plugin/plugin-nvptx.c @@ -867,6 +867,14 @@ nvptx_get_num_devices (void) return n; } +static void +notify_var (const char *var_name, const char *env_var) +{ + if (env_var == NULL) + GOMP_PLUGIN_debug (0, "%s: \n", var_name); + else + GOMP_PLUGIN_debug (0, "%s: '%s'\n", var_name, env_var); +} static bool link_ptx (CUmodule *module, const struct targ_ptx_obj *ptx_objs, @@ -1089,10 +1097,12 @@ nvptx_exec (void (*fn), size_t mapnum, void **hostaddrs, void **devaddrs, pthread_mutex_lock (&ptx_dev_lock); if (!default_dims[0]) { + const char *var_name = "GOMP_OPENACC_DIM"; /* We only read the environment variable once. You can't change it in the middle of execution. The syntax is the same as for the -fopenacc-dim compilation option. */ - const char *env_var = getenv ("GOMP_OPENACC_DIM"); + const char *env_var = getenv (var_name); + notify_var (var_name, env_var); if (env_var) { const char *pos = env_var;