From patchwork Wed Apr 18 09:00:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 899977 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-476534-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mentor.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="KxQYEMV6"; dkim-atps=neutral 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 40Qx0z21cCz9s3Z for ; Wed, 18 Apr 2018 19:00:51 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=g0g9GGI21dftPjSS6 VexDAfrdYHkG4rHjlN/TNifnX8/b5r8Ux4ra+gUGX4azKMYxuGOf48w7Mgy3Onw0 jWYrRdBRfQ7oYdd/n68xZSe0jml6/BVS0MhkQDAPACG52oanknk06f9HCecqKzSY wV3AkDdC3TJP4Fwealo0Z0LIzI= 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:to:references:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=uUg0p9jJuQp7eDfcoJTKRiM QDyE=; b=KxQYEMV6NSDGpVfYnsLQX6qv8/l3smezTJRwkVIjUFG5kbRAvQH8EOn jSec/z3DibGy+MjwYRzdKhGaGl9cxmoP2JpW+v8mrUcvncdiVhNWC1kq0wB6U3sE VTGZ36E4CD7DkrUWXTxGCFxXFRvFtQiySYbOszrMeih6s+KXXCvs= Received: (qmail 124902 invoked by alias); 18 Apr 2018 09:00:43 -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 91773 invoked by uid 89); 18 Apr 2018 09:00:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, TIME_LIMIT_EXCEEDED, URIBL_RED autolearn=unavailable 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; Wed, 18 Apr 2018 09:00:12 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=svr-ies-mbx-01.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1f8iwl-0006Hx-Eg from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Wed, 18 Apr 2018 02:00:11 -0700 Received: from [172.30.72.2] (137.202.0.87) by svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Wed, 18 Apr 2018 10:00:06 +0100 Subject: [og7, openacc, libgomp, testsuite] Fix asserts in non-scalar-data.C To: Cesar Philippidis , "gcc-patches@gcc.gnu.org" References: <56A0548E.5040600@codesourcery.com> <56A054E7.30301@codesourcery.com> From: Tom de Vries Message-ID: Date: Wed, 18 Apr 2018 11:00:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <56A054E7.30301@codesourcery.com> X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) [ was: Re: [gomp4] fix c++ reference mappings in openacc ] On 01/21/2016 04:47 AM, Cesar Philippidis wrote: > diff --git a/libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C b/libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C > new file mode 100644 > index 0000000..180e86f > --- /dev/null > +++ b/libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C > @@ -0,0 +1,109 @@ > +// Ensure that a non-scalar dummy arguments which are implicitly used inside > +// offloaded regions are properly mapped using present_or_copy. > + > +// { dg-do run } > + > +#include > + > +const int n = 100; > + > +struct data { > + int v; > +}; > + > +void > +kernels_present (data &d, int &x) > +{ > +#pragma acc kernels present (d, x) default (none) > + { > + d.v = x; > + } > +} > + > +void > +parallel_present (data &d, int &x) > +{ > +#pragma acc parallel present (d, x) default (none) > + { > + d.v = x; > + } > +} > + > +void > +kernels_implicit (data &d, int &x) > +{ > +#pragma acc kernels > + { > + d.v = x; > + } > +} > + > +void > +parallel_implicit (data &d, int &x) > +{ > +#pragma acc parallel > + { > + d.v = x; > + } > +} > + > +void > +reference_data (data &d, int &x) > +{ > +#pragma acc data copy(d, x) > + { > + kernels_present (d, x); > + > +#pragma acc update host(d) > + assert (d.v == x); > + > + x = 200; > +#pragma acc update device(x) > + > + parallel_present (d, x); > + } > + > + assert (d.v = x); > + > + x = 300; > + kernels_implicit (d, x); > + assert (d.v = x); > + > + x = 400; > + parallel_implicit (d, x); > + assert (d.v = x); > +} > + > +int > +main () > +{ > + data d; > + int x = 100; > + > +#pragma acc data copy(d, x) > + { > + kernels_present (d, x); > + > +#pragma acc update host(d) > + assert (d.v == x); > + > + x = 200; > +#pragma acc update device(x) > + > + parallel_present (d, x); > + } > + > + assert (d.v = x); > + > + x = 300; > + kernels_implicit (d, x); > + assert (d.v = x); > + > + x = 400; > + parallel_implicit (d, x); > + assert (d.v = x); > + > + reference_data (d, x); > + > + return 0; > +} > Some of these assert have assigns in them. Fixed in attached patch, committed. Thanks, - Tom [openacc, libgomp, testsuite] Fix asserts in non-scalar-data.C 2018-04-18 Tom de Vries * testsuite/libgomp.oacc-c++/non-scalar-data.C (reference_data, main): Fix asserts. --- libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C b/libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C index f24e31e..8143533 100644 --- a/libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C +++ b/libgomp/testsuite/libgomp.oacc-c++/non-scalar-data.C @@ -69,15 +69,15 @@ reference_data (data &d, int &x) parallel_present (d, x); } - assert (d.v = x); + assert (d.v == x); x = 300; kernels_implicit (d, x); - assert (d.v = x); + assert (d.v == x); x = 400; parallel_implicit (d, x); - assert (d.v = x); + assert (d.v == x); } int @@ -99,15 +99,15 @@ main () parallel_present (d, x); } - assert (d.v = x); + assert (d.v == x); x = 300; kernels_implicit (d, x); - assert (d.v = x); + assert (d.v == x); x = 400; parallel_implicit (d, x); - assert (d.v = x); + assert (d.v == x); reference_data (d, x);