From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63582 invoked by alias); 8 Apr 2016 14:46:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 62909 invoked by uid 89); 8 Apr 2016 14:46:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 08 Apr 2016 14:46:21 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1aoXfv-000789-H0 from Cesar_Philippidis@mentor.com ; Fri, 08 Apr 2016 07:46:19 -0700 Received: from [127.0.0.1] (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.224.2; Fri, 8 Apr 2016 07:46:19 -0700 Subject: Re: openacc reference reductions To: Nathan Sidwell , Jakub Jelinek References: <56BA0257.6050607@codesourcery.com> <56BA06C3.90606@acm.org> <56BA10FC.90705@codesourcery.com> <56CB2A76.3090809@codesourcery.com> <57046C2B.6080002@codesourcery.com> <20160406142340.GZ19207@tucnak.redhat.com> <57056FCA.7040602@codesourcery.com> <20160407095657.GD19207@tucnak.redhat.com> <570734E3.7030601@codesourcery.com> <20160408074054.GN19207@tucnak.redhat.com> <5707BCB5.2050607@acm.org> CC: "gcc-patches@gcc.gnu.org" From: Cesar Philippidis Message-ID: <5707C43A.4050800@codesourcery.com> Date: Fri, 08 Apr 2016 14:46:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <5707BCB5.2050607@acm.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg00405.txt.bz2 On 04/08/2016 07:14 AM, Nathan Sidwell wrote: > On 04/08/16 00:40, Jakub Jelinek wrote: > >>> +/* OpenACC parallel reductions need a present_or_copy clause to ensure >>> + that the original variable used in the reduction gets updated on >>> + the host. Scan the list of clauses for reduction so that any >>> existing >>> + data clause can be adjusted if necessary. */ >>> + if (region_type == ORT_ACC_PARALLEL) >>> + { >>> + for (c = *list_p; c; c = OMP_CLAUSE_CHAIN (c)) >>> + { >>> + tree decl = NULL_TREE; >>> + >>> + if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_REDUCTION) >>> + continue; >>> + >>> + decl = OMP_CLAUSE_DECL (c); >>> + omp_add_variable (ctx, decl, GOVD_REDUCTION); >>> + } >>> + } >>> + >> >> And this looks also wrong, why? > > And besides, won't it break > #pragma acc parallel firstprivate (x) reduction(+:x) > {...} This would become an error. But we'd still allow stuff like #pragma acc parallel firstprivate(x) #pragma acc loop reduction(+:x) > which the openacc guys at GTC indicated they didn't want to disallow > (without further thinking). I'm not sure what the purpose of a firstprivate parallel reduction is anyway. By definition, the final result of a parallel reduction isn't available until the end of the parallel region. And if the value is firstprivate, the final result can never be utilized. That seems like a candidate for an error to me. > It seems to me the interaction of reduction and data copying at a > parallel is still not sufficiently well defined. Tom and I were pushing to make parallel reductions imply copy (or present_or_copy in openacc 2.0). Did that fall through? Cesar