From patchwork Wed Feb 11 14:18:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 438791 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 22ADD1400D5 for ; Thu, 12 Feb 2015 01:22:27 +1100 (AEDT) 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; q=dns; s=default; b=CfY5mrCjEjxCIia2 iEIEigY2x04MEjdqZhYp7Ms+8p171Efkc4Q/P8CvwW6PTSeqqd0pZttHm6x5wW+A zFJZVkHtPP3IFGwvr+/WfVb8MK+rLYAwNkTUwOmUVNtWP3GAFiMZvWhWNHKqQ+Rn 9pF/KnFKld0FXhViIKxv/mwaKOA= 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; s=default; bh=f4ns+ZMfmn0CnMUbjGSnb1 QgpYk=; b=TFpzYxKKJ8+cy8ORTpmFCQpa/iox/mJVRKVGPrZmnr4jrdjAdCCkCm uUBcViozQMP0N0l4VGktiRoOcEN5dZ7FNVdMAAJ8RL/uHRClgqkGzNpYDaDllpjg iTq1ginQwtMoly2ilJe7hHoNlYOd2ax5fE4kqRfttLyXzyyvcB53w= Received: (qmail 12773 invoked by alias); 11 Feb 2015 14:20:23 -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 12761 invoked by uid 89); 11 Feb 2015 14:20:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 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; Wed, 11 Feb 2015 14:20:22 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YLY9K-0003JB-JI from Thomas_Schwinge@mentor.com ; Wed, 11 Feb 2015 06:20:18 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 11 Feb 2015 14:18:33 +0000 From: Thomas Schwinge To: Ilya Verbin CC: GCC Patches , Bernd Schmidt Subject: Re: nvptx offloading patches [4/n] In-Reply-To: <20150128175945.GD12176@msticlxl57.ims.intel.com> References: <5454CDF1.3070307@codesourcery.com> <87zj92vnsa.fsf@kepler.schwinge.homeip.net> <20150128175945.GD12176@msticlxl57.ims.intel.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Wed, 11 Feb 2015 15:18:23 +0100 Message-ID: <87siech6q8.fsf@schwinge.name> MIME-Version: 1.0 Hi! On Wed, 28 Jan 2015 20:59:45 +0300, Ilya Verbin wrote: > On 28 Jan 18:05, Thomas Schwinge wrote: > > + fprintf (out, "#define PTX_ID 1\n"); > > + fprintf (out, "static __attribute__((constructor)) void init (void)\n{\n"); > > + fprintf (out, " GOMP_offload_register (__OPENMP_TARGET__, PTX_ID,\n"); > > The file include/gomp-constants.h already contains: > #define GOMP_DEVICE_NVIDIA_PTX 5 > > I guess it would be better to include gomp-constants.h into mkoffload and to use > this define. Thanks! You're right indeed -- I mistakenly committed an older version of this file. Committed to trunk in r220619: commit ab0e6fbc36cacaa619dfacec41e17a681a28562a Author: tschwinge Date: Wed Feb 11 14:15:28 2015 +0000 nvptx mkoffload: Don't hard-code GOMP_DEVICE_NVIDIA_PTX. gcc/ * config/nvptx/mkoffload.c: Include "gomp-constants.h". (process): Use its GOMP_DEVICE_NVIDIA_PTX instead of (wrongly) hard-coding PTX_ID. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220619 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/nvptx/mkoffload.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) Grüße, Thomas diff --git gcc/ChangeLog gcc/ChangeLog index 2fa7ff2..1479dcb 100644 --- gcc/ChangeLog +++ gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-02-11 Thomas Schwinge + + * config/nvptx/mkoffload.c: Include "gomp-constants.h". + (process): Use its GOMP_DEVICE_NVIDIA_PTX instead of (wrongly) + hard-coding PTX_ID. + 2015-02-11 H.J. Lu * doc/sourcebuild.texi (pie_enabled): Document. diff --git gcc/config/nvptx/mkoffload.c gcc/config/nvptx/mkoffload.c index 38ccdba..8f359cf 100644 --- gcc/config/nvptx/mkoffload.c +++ gcc/config/nvptx/mkoffload.c @@ -35,6 +35,7 @@ #include "obstack.h" #include "diagnostic-core.h" #include "collect-utils.h" +#include "gomp-constants.h" const char tool_name[] = "nvptx mkoffload"; @@ -791,9 +792,9 @@ process (FILE *in, FILE *out) fprintf (out, "extern void GOMP_offload_register (const void *, int, void *);\n"); fprintf (out, "extern void *__OPENMP_TARGET__[];\n\n"); - fprintf (out, "#define PTX_ID 1\n"); fprintf (out, "static __attribute__((constructor)) void init (void)\n{\n"); - fprintf (out, " GOMP_offload_register (__OPENMP_TARGET__, PTX_ID,\n"); + fprintf (out, " GOMP_offload_register (__OPENMP_TARGET__, %d,\n", + GOMP_DEVICE_NVIDIA_PTX); fprintf (out, " &target_data);\n"); fprintf (out, "};\n"); }