From patchwork Fri Jun 13 11:35:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 359533 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 9F37D1400E8 for ; Fri, 13 Jun 2014 21:36:12 +1000 (EST) 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=RdiJieydaNOpEVQF DYPK+LR0gXEK4hNmFkCsLj5IjLOFJU+1zYyU1FEsUNps4M5p7DtMEPsnNW1GZruo WEy0RcgfpHmTIweGfGSnz3SfqTEqNizakiuXSongMelOSKOn7BSIzF/5nkeOLHvX hp4jXu4dfUbTx1fy6PiTb1YgdKY= 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=MvnNnqbywLVRlX1aKeiN4g ZcPw8=; b=faB5xPDZrQL+V/XA39fesp1kGdqq75q81XFF+aPRLEcee/mC8l2BHJ OVXhI2tTKAHcE7gsinUM27VrCxzI4GfNw2HZ34UhM6qoocFmKS/13yb8njSA0VKN dFD6lNf1pQQOvFH1u3TGPG8qT8yO/ShvCp8UJHfryyEU4h6wXvso0= Received: (qmail 29543 invoked by alias); 13 Jun 2014 11:36: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 29521 invoked by uid 89); 13 Jun 2014 11:36:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00 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; Fri, 13 Jun 2014 11:35:59 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WvPm0-0003VO-Cu from Thomas_Schwinge@mentor.com ; Fri, 13 Jun 2014 04:35:56 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Fri, 13 Jun 2014 04:35:55 -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.2.247.3; Fri, 13 Jun 2014 12:35:54 +0100 From: Thomas Schwinge To: Cesar Philippidis CC: , "gcc-patches@gcc.gnu.org" , , Jakub Jelinek , Subject: Re: [patch][gomp4] openacc loops In-Reply-To: <538FE718.9040400@codesourcery.com> References: <538E538E.9010304@codesourcery.com> <87sink315l.fsf@schwinge.name> <538FE718.9040400@codesourcery.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Fri, 13 Jun 2014 13:35:51 +0200 Message-ID: <874mzp11pk.fsf@schwinge.name> MIME-Version: 1.0 Hi Cesar! On Wed, 4 Jun 2014 20:42:16 -0700, Cesar Philippidis wrote: > The way that the loop clause > is handle in fortran is that all loops get lowered with the collapse > clause set. By default, for non-concurrent loops, collapse is set to 1. > And when collapse == 1, nothing special happens during the omp-lowering > phase. Ah, I see. > In this updated patch, I removed the c front end changes. Also, collapse > support in fortran is restricted to collapse(1) or else the do loop > clause will do nothing. Any collapse value != 1 will get caught by one > of the existing asserts. I checked in the following to gomp-4_0-branch, r211632: commit aec20f26f3a7410ba36a734ede85220b188d1e94 Author: tschwinge Date: Fri Jun 13 11:16:07 2014 +0000 For OpenACC directives, the collapse(1) clause is supported. gcc/ * omp-low.c (extract_omp_for_data, scan_sharing_clauses): For OpenACC directives, the collapse(1) clause is supported. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@211632 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 6 ++++++ gcc/omp-low.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) Grüße, Thomas diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 68f9370..75e47d0 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,9 @@ +2014-06-13 Thomas Schwinge + Cesar Philippidis + + * omp-low.c (extract_omp_for_data, scan_sharing_clauses): For + OpenACC directives, the collapse(1) clause is supported. + 2014-06-13 Cesar Philippidis * omp-low.c (scan_sharing_clauses): Preliminary support for diff --git gcc/omp-low.c gcc/omp-low.c index 454a293..bc6ca23 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -365,6 +365,9 @@ extract_omp_for_data (gimple for_stmt, struct omp_for_data *fd, case OMP_CLAUSE_COLLAPSE: if (fd->collapse > 1) { + if (is_gimple_omp_oacc_specifically (for_stmt)) + sorry ("collapse (>1) clause not supported yet"); + collapse_iter = &OMP_CLAUSE_COLLAPSE_ITERVAR (t); collapse_count = &OMP_CLAUSE_COLLAPSE_COUNT (t); } @@ -1779,7 +1782,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_NOWAIT: case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_COLLAPSE: case OMP_CLAUSE_UNTIED: case OMP_CLAUSE_MERGEABLE: case OMP_CLAUSE_PROC_BIND: @@ -1789,6 +1791,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) sorry ("clause not supported yet"); break; } + case OMP_CLAUSE_COLLAPSE: break; case OMP_CLAUSE_ALIGNED: @@ -1925,7 +1928,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_DIST_SCHEDULE: case OMP_CLAUSE_NOWAIT: case OMP_CLAUSE_ORDERED: - case OMP_CLAUSE_COLLAPSE: case OMP_CLAUSE_UNTIED: case OMP_CLAUSE_FINAL: case OMP_CLAUSE_MERGEABLE: @@ -1937,6 +1939,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_TO: case OMP_CLAUSE_FROM: gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)); + case OMP_CLAUSE_COLLAPSE: case OMP_CLAUSE_IF: case OMP_CLAUSE_NUM_GANGS: case OMP_CLAUSE_NUM_WORKERS: > On 06/04/2014 12:49 PM, Thomas Schwinge wrote: > > (Also, I'm not sure to > > which extent we're at all currently handling combined directives in > > gimplification and lowering?) > > Do you mean something like > > $!acc parallel loop > > ? That doesn't work yet. But it does work when you separate them. Right, that's what I meant. > > So, if this helps you to make progress, I'm OK for you to commit the > > preliminary support for OMP_CLAUSE_PRIVATE, and I'll then revisit this > > clause/code in the near future, for the correct OpenACC semantics. I checked in the following to gomp-4_0-branch, r211631: commit cb91bb0ec983ab19b0668de7246b7c75f275d523 Author: tschwinge Date: Fri Jun 13 11:15:02 2014 +0000 Preliminary support for OMP_CLAUSE_PRIVATE for OpenACC. gcc/ * omp-low.c (scan_sharing_clauses): Preliminary support for OMP_CLAUSE_PRIVATE for OpenACC. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@211631 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 3 +++ gcc/omp-low.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 6ab79c0..68f9370 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,5 +1,8 @@ 2014-06-13 Cesar Philippidis + * omp-low.c (scan_sharing_clauses): Preliminary support for + OMP_CLAUSE_PRIVATE for OpenACC. + * omp-low.c (scan_sharing_clauses): For clauses currently not supported with OpenACC directives, emit a sorry message instead of aborting. diff --git gcc/omp-low.c gcc/omp-low.c index d1ecd88..454a293 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -1534,7 +1534,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) switch (OMP_CLAUSE_CODE (c)) { case OMP_CLAUSE_PRIVATE: - gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)); decl = OMP_CLAUSE_DECL (c); if (OMP_CLAUSE_PRIVATE_OUTER_REF (c)) goto do_private; @@ -1833,7 +1832,6 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) break; /* FALLTHRU */ - case OMP_CLAUSE_PRIVATE: case OMP_CLAUSE_FIRSTPRIVATE: case OMP_CLAUSE_REDUCTION: if (is_gimple_omp_oacc_specifically (ctx->stmt)) @@ -1843,6 +1841,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) } case OMP_CLAUSE_LINEAR: gcc_assert (!is_gimple_omp_oacc_specifically (ctx->stmt)); + case OMP_CLAUSE_PRIVATE: decl = OMP_CLAUSE_DECL (c); if (is_variable_sized (decl)) install_var_local (decl, ctx);