From patchwork Tue Jun 2 11:52:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 479428 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 21171140E1E for ; Tue, 2 Jun 2015 21:52:46 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=hlvuDJ4y; 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; q=dns; s=default; b=gtZ+gjYW2/V73IW2 Uqj7ivFnu1GEVljyp7Z8luRdrFOMmOOQJJ/1svTrnHtP2XMfRsdUkuoTeE30j+Y1 s7lnpqRlOGNbpSIFBzkh9Xl9m2NevItuTaWztdpa1Z7KHq93Qg+rkJD/BBODDZqD 8pMP0KGHOno/JezVex1HaFLlsn8= 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=eUE2C2uQqFhL4cDU3e4PYB IkFBg=; b=hlvuDJ4yB7MtTVwlrgxom0M9ULIgylwLyBp1Nt32+j3xmkhAmpttCy v1wsAXqWkDayhte9eqMTtUJoQJPjhAzwFLGR66wP6JLneAb9WHyYJfcMogiHK/6y JCBB3pG3pdcVJcgq9t9DWltF5Cx+CM0SEz9RHyXL2z8aPiB9e/Qpo= Received: (qmail 117723 invoked by alias); 2 Jun 2015 11:52:38 -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 117701 invoked by uid 89); 2 Jun 2015 11:52:36 -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-Spam-User: qpsmtpd, 2 recipients 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; Tue, 02 Jun 2015 11:52:35 +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 1Yzkk9-0001Id-TB from Thomas_Schwinge@mentor.com ; Tue, 02 Jun 2015 04:52:30 -0700 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; Tue, 2 Jun 2015 12:52:28 +0100 From: Thomas Schwinge To: , Julian Brown CC: , , , Jakub Jelinek Subject: [PR libgomp/65742, PR middle-end/66332] XFAIL acc_on_device compile-time evaluation (was: acc_on_device for device_type_host_nonshm) In-Reply-To: <20150507193226.6aee40c5@octopus> References: <20150331235328.GC623@msticlxl57.ims.intel.com> <20150401052147.GG19273@tucnak.redhat.com> <20150401131405.GD623@msticlxl57.ims.intel.com> <20150401132025.GM19273@tucnak.redhat.com> <20150406124557.GA5541@msticlxl57.ims.intel.com> <20150407152645.GJ19273@tucnak.redhat.com> <20150408153142.128b97b9@octopus> <20150408145856.GA19410@msticlxl57.ims.intel.com> <20150414151502.5ca882a4@octopus> <87pp76zpep.fsf@schwinge.name> <20150417131619.GP1725@tucnak.redhat.com> <20150507193226.6aee40c5@octopus> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) Date: Tue, 2 Jun 2015 13:52:19 +0200 Message-ID: <87twuqjpjg.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! On Thu, 7 May 2015 19:32:26 +0100, Julian Brown wrote: > On Fri, 17 Apr 2015 15:16:19 +0200 > Jakub Jelinek wrote: > > > On Tue, Apr 14, 2015 at 05:43:26PM +0200, Thomas Schwinge wrote: > > > Really, acc_on_device is implemented as a compiler builtin (which > > > is just disabled for a few libgomp test cases, in order to test the > > > acc_on_device library function in libgomp), and I never understood > > > why the "fallback" implementation in libgomp (cited above) should > > > be doing anything different from the GCC builtin. Is the "problem" > > > actually, that some > > > > The question is if the builtin expansion isn't wrong, at least as > > long as the host_nonshm device is meant to be supported. The > > #ifdef ACCEL_COMPILER > > case is easier, at least as long as ACCEL_COMPILER compiled code is > > not meant to be able to offload to other devices (or host again), but > > the non-ACCEL_COMPILER case means the code is either on the host, or > > host_nonshm, or e.g. with Intel MIC you could have some shared > > library be compiled by the host compiler, but then actuall linked > > into the MIC offloaded path. In all those cases, I think it is just > > the library that can determine the return value. > > > > E.g. OpenMP omp_is_initial_device function is also only implemented > > in the library, perhaps at some point I could expand it for #ifdef > > ACCEL_COMPILER as builtin, but not for the host code, at least not > > due to the host-nonshm plugin. > > Here's a new version of the patch that doesn't use the open-coded > expansion for acc_on_device for the host compiler at all. This means > that the host and the host_nonshm plugin should DTRT without any > special compiler options (which have thus been removed from the libgomp > tests that set them or refer to them). > > So now, for the host, acc_on_device returns: > > acc_on_device (acc_device_none): true > acc_on_device (acc_device_host): true > otherwise: false > > When the host_nonshm plugin is active, acc_on_device returns: > > acc_on_device (acc_device_host_nonshm): true (except when "host > fallback" is in effect, i.e. because of a false "if" clause). > acc_on_device (acc_device_not_host): likewise. > otherwise: false > > In particular, the host_nonshm plugin doesn't consider itself to be > running code "on the host". > PR libgomp/65742 > > gcc/ > * builtins.c (expand_builtin_acc_on_device): Don't use open-coded > sequence for !ACCEL_COMPILER. As reported in , this caused the following regression (C testing): PASS: c-c++-common/goacc/acc_on_device-2.c (test for excess errors) [-PASS:-]{+FAIL:+} c-c++-common/goacc/acc_on_device-2.c scan-rtl-dump-times expand "\\(call [^\\n]* acc_on_device" 0 Committed to trunk in r224028: commit 1c2d9da9cee04516151b3894edb107e3cdf2c8b9 Author: tschwinge Date: Tue Jun 2 11:48:56 2015 +0000 [PR libgomp/65742, PR middle-end/66332] XFAIL acc_on_device compile-time evaluation The OpenACC 2.0a specification mandates differently, but we currently do get a library call in the host code. PR libgomp/65742 PR middle-end/66332 gcc/testsuite/ * c-c++-common/goacc/acc_on_device-2.c: XFAIL for C, too. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224028 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) Grüße, Thomas diff --git gcc/testsuite/ChangeLog gcc/testsuite/ChangeLog index d91cf7c..3f51b10 100644 --- gcc/testsuite/ChangeLog +++ gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-06-02 Thomas Schwinge + + PR libgomp/65742 + PR middle-end/66332 + * c-c++-common/goacc/acc_on_device-2.c: XFAIL for C, too. + 2015-06-02 Uros Bizjak * g++.dg/abi/mangle-regparm.C (dg-do): Fix x86_32 target selector. diff --git gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c index 8db0a66..6e3d292 100644 --- gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c +++ gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c @@ -20,9 +20,17 @@ f (void) } /* With -fopenacc, we're expecting the builtin to be expanded, so no calls. + TODO: in C++, even under extern "C", the use of enum for acc_device_t perturbs expansion as a builtin, which expects an int parameter. It's fine when changing acc_device_t to plain int, but that's not what we're doing in . - { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail c++ } } } */ + + TODO: given that we can't expand acc_on_device in + gcc/builtins.c:expand_builtin_acc_on_device for in the !ACCEL_COMPILER case + (because at that point we don't know whether we're acc_device_host or + acc_device_host_nonshm), we'll (erroneously) get a library call in the host + code. + + { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail { c || c++ } } } } */