From patchwork Tue Nov 11 14:55:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 409496 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 D4DB5140142 for ; Wed, 12 Nov 2014 01:56:52 +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=WuXdg8DG+sLL2hOG i9w/BQ0+ZFILwntV9ZMPMadhWk6ISUg28nwABU3J1r17ud74HbO/kfsDR9vxFZ4H Z+9qLdsEI1VVszmqGZbLmD4d+6/eV/7FpYnTldpLwXecf68cIGnG+1dvnlBZwxgp nWi76sGtv8HbiJlD9nSIPnyrvqY= 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=3sY7W7SnVV5Ll1XiG2swYi j5mGc=; b=XNoPfPNvyKC9otDQwHladScTQBd8zwYsmQao2uTgcyY5smpwuQ0uUO EzthkGYM2rBGicLI0kz22rGjxJ/oEm7jtzS6GxAlFaTkuTV/26Q9Kxu6uSPtOTqA Tjd2svUtT5Ha5AUTwR0ziCnFhxZdqKZm/itNAydalBKdFfqK+mS0k= Received: (qmail 2042 invoked by alias); 11 Nov 2014 14:56:35 -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 1918 invoked by uid 89); 11 Nov 2014 14:56:34 -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, RCVD_IN_DNSWL_NONE 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, 11 Nov 2014 14:56:31 +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 1XoCrr-000157-DC from Thomas_Schwinge@mentor.com ; Tue, 11 Nov 2014 06:56:27 -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.181.6; Tue, 11 Nov 2014 14:56:26 +0000 From: Thomas Schwinge To: , CC: Cesar Philippidis , Ilmir Usmanov , Ilmir Usmanov , Jakub Jelinek , Tobias Burnus Subject: [gomp4] Re: FWD: Re: OpenACC subarray specifications in the GCC Fortran front end In-Reply-To: <87a97yrjf7.fsf@schwinge.name> References: <87ha4p92qj.fsf@schwinge.name> <53763254.1000402@samsung.com> <537DA7CD.4050407@samsung.com> <87fvi8p5mp.fsf@schwinge.name> <20140711102920.GR31640@tucnak.redhat.com> <53D05678.3080501@codesourcery.com> <87a97yrjf7.fsf@schwinge.name> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu) Date: Tue, 11 Nov 2014 15:55:49 +0100 Message-ID: <87ioilpz0q.fsf@schwinge.name> MIME-Version: 1.0 Hi! On Thu, 24 Jul 2014 15:11:08 +0200, I wrote: > On Wed, 23 Jul 2014 17:42:32 -0700, Cesar Philippidis wrote: > > On 07/11/2014 03:29 AM, Jakub Jelinek wrote: > > > On Fri, Jul 11, 2014 at 12:11:10PM +0200, Thomas Schwinge wrote: > > >> To avoid duplication of work: with Jakub's Fortran OpenMP 4 target > > >> changes recently committed to trunk, and now merged into gomp-4_0-branch, > > >> I have trimmed down Ilmir's patch to just the OpenACC bits, OpenMP 4 > > >> target changes removed, and TODO markers added to integrate into that. > > > > > > Resolving the TODO markers would be nice, indeed. > > > > This patch has the openacc data clauses use the new openmp maps. In the > > process of doing so, I removed a lot of the old OMP_LIST_ enums and > > added a few OMP_MAP enums to match what the c frontend currently supports. > > Thanks! > OMP_LIST_DEVICEPTR remains to be converted, which can be done as a later > follow-up patch. I have now committed the following to gomp-4_0-branch in r217352: commit 779291a1fe21b3c0b0c0c615a0557f070f495d14 Author: tschwinge Date: Tue Nov 11 14:52:04 2014 +0000 OpenACC deviceptr clause: Fix handling in Fortran. With two gcc_asserts restored, and not handling OpenACC deviceptr clauses in the same data paths as other OpenACC data clauses, we'd run into an internal compiler error, when the deviceptr clause is used with (non-offloaded) OpenACC data regions: FAIL: gfortran.dg/goacc/data-tree.f95 -O (internal compiler error) FAIL: gfortran.dg/goacc/data-tree.f95 -O (test for excess errors) gcc/fortran/ * gfortran.h (OMP_LIST_DEVICEPTR): Remove, and instead... (enum gfc_omp_map_op): ... add OMP_MAP_FORCE_DEVICEPTR here. * dump-parse-tree.c (show_omp_clauses): Update. * openmp.c (gfc_match_omp_clauses, resolve_omp_clauses) (gfc_resolve_oacc_declare): Likewise. * trans-openmp.c (gfc_trans_omp_clauses): Likewise. gcc/ * omp-low.c (lower_omp_target): Restore two gcc_asserts. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@217352 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 4 ++++ gcc/fortran/ChangeLog.gomp | 9 +++++++++ gcc/fortran/dump-parse-tree.c | 1 - gcc/fortran/gfortran.h | 6 +++--- gcc/fortran/openmp.c | 38 ++++++++++++++++++++++---------------- gcc/fortran/trans-openmp.c | 6 +++--- gcc/omp-low.c | 2 ++ 7 files changed, 43 insertions(+), 23 deletions(-) Grüße, Thomas diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index 9c997ce..dacfad8 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,7 @@ +2014-11-11 Thomas Schwinge + + * omp-low.c (lower_omp_target): Restore two gcc_asserts. + 2014-11-06 Thomas Schwinge * gimple.h (is_gimple_omp_oacc_specifically): Return true for diff --git gcc/fortran/ChangeLog.gomp gcc/fortran/ChangeLog.gomp index d10560e..1ae1d31 100644 --- gcc/fortran/ChangeLog.gomp +++ gcc/fortran/ChangeLog.gomp @@ -1,3 +1,12 @@ +2014-11-11 Thomas Schwinge + + * gfortran.h (OMP_LIST_DEVICEPTR): Remove, and instead... + (enum gfc_omp_map_op): ... add OMP_MAP_FORCE_DEVICEPTR here. + * dump-parse-tree.c (show_omp_clauses): Update. + * openmp.c (gfc_match_omp_clauses, resolve_omp_clauses) + (gfc_resolve_oacc_declare): Likewise. + * trans-openmp.c (gfc_trans_omp_clauses): Likewise. + 2014-11-05 Thomas Schwinge * openmp.c (OMP_CLAUSE_HOST, OMP_CLAUSE_SELF): Merge into the new diff --git gcc/fortran/dump-parse-tree.c gcc/fortran/dump-parse-tree.c index 57af730..e7aff22 100644 --- gcc/fortran/dump-parse-tree.c +++ gcc/fortran/dump-parse-tree.c @@ -1252,7 +1252,6 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses) switch (list_type) { case OMP_LIST_COPY: type = "COPY"; break; - case OMP_LIST_DEVICEPTR: type = "DEVICEPTR"; break; case OMP_LIST_USE_DEVICE: type = "USE_DEVICE"; break; case OMP_LIST_DEVICE_RESIDENT: type = "USE_DEVICE"; break; case OMP_LIST_CACHE: type = ""; break; diff --git gcc/fortran/gfortran.h gcc/fortran/gfortran.h index 6bd131c..18adbee 100644 --- gcc/fortran/gfortran.h +++ gcc/fortran/gfortran.h @@ -1141,7 +1141,8 @@ typedef enum OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, - OMP_MAP_FORCE_PRESENT + OMP_MAP_FORCE_PRESENT, + OMP_MAP_FORCE_DEVICEPTR } gfc_omp_map_op; @@ -1184,8 +1185,7 @@ enum OMP_LIST_REDUCTION, OMP_LIST_COPY, OMP_LIST_DATA_CLAUSE_FIRST = OMP_LIST_COPY, - OMP_LIST_DEVICEPTR, - OMP_LIST_DATA_CLAUSE_LAST = OMP_LIST_DEVICEPTR, + OMP_LIST_DATA_CLAUSE_LAST = OMP_LIST_DATA_CLAUSE_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE, OMP_LIST_CACHE, diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c index 959798a..82726b8 100644 --- gcc/fortran/openmp.c +++ gcc/fortran/openmp.c @@ -666,10 +666,19 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, unsigned long long mask, OMP_MAP_ALLOC)) continue; if ((mask & OMP_CLAUSE_DEVICEPTR) - && gfc_match_omp_variable_list ("deviceptr (", - &c->lists[OMP_LIST_DEVICEPTR], true) - == MATCH_YES) - continue; + && gfc_match ("deviceptr ( ") == MATCH_YES) + { + gfc_omp_namelist **list = &c->lists[OMP_LIST_MAP]; + gfc_omp_namelist **head = NULL; + if (gfc_match_omp_variable_list ("", list, true, NULL, &head, false) + == MATCH_YES) + { + gfc_omp_namelist *n; + for (n = *head; n; n = n->next) + n->u.map_op = OMP_MAP_FORCE_DEVICEPTR; + continue; + } + } if ((mask & OMP_CLAUSE_USE_DEVICE) && gfc_match_omp_variable_list ("use_device (", &c->lists[OMP_LIST_USE_DEVICE], true) @@ -2864,7 +2873,7 @@ resolve_omp_clauses (gfc_code *code, locus *where, "TO", "FROM", "REDUCTION", "COPY", "COPYIN", "COPYOUT", "CREATE", "DELETE", "PRESENT", "PRESENT_OR_COPY", "PRESENT_OR_COPYIN", "PRESENT_OR_COPYOUT", - "PRESENT_OR_CREATE", "DEVICEPTR", "DEVICE_RESIDENT", "USE_DEVICE", + "PRESENT_OR_CREATE", "DEVICE_RESIDENT", "USE_DEVICE", "HOST", "DEVICE", "CACHE" }; if (omp_clauses == NULL) @@ -3152,8 +3161,13 @@ resolve_omp_clauses (gfc_code *code, locus *where, } } else if (openacc) - resolve_oacc_data_clauses (n->sym, *where, - clause_names[list]); + { + if (list == OMP_LIST_MAP + && n->u.map_op == OMP_MAP_FORCE_DEVICEPTR) + resolve_oacc_deviceptr_clause (n->sym, *where, name); + else + resolve_oacc_data_clauses (n->sym, *where, name); + } } if (list != OMP_LIST_DEPEND) @@ -3360,9 +3374,6 @@ resolve_omp_clauses (gfc_code *code, locus *where, case OMP_LIST_PRIVATE: gcc_assert (code && code->op != EXEC_NOP); break; - case OMP_LIST_DEVICEPTR: - resolve_oacc_deviceptr_clause (n->sym, *where, name); - break; case OMP_LIST_USE_DEVICE: if (n->sym->attr.allocatable || (n->sym->ts.type == BT_CLASS && CLASS_DATA (n->sym) @@ -4609,7 +4620,7 @@ gfc_resolve_oacc_declare (gfc_namespace *ns) locus loc; static const char *clause_names[] = {"COPY", "COPYIN", "COPYOUT", "CREATE", "DELETE", "PRESENT", "PRESENT_OR_COPY", "PRESENT_OR_COPYIN", - "PRESENT_OR_COPYOUT", "PRESENT_OR_CREATE", "DEVICEPTR", + "PRESENT_OR_COPYOUT", "PRESENT_OR_CREATE", "DEVICE_RESIDENT"}; if (ns->oacc_declare_clauses == NULL) @@ -4647,11 +4658,6 @@ gfc_resolve_oacc_declare (gfc_namespace *ns) resolve_oacc_data_clauses (n->sym, loc, name); } - for (n = ns->oacc_declare_clauses->lists[OMP_LIST_DEVICEPTR]; n; n = n->next) - resolve_oacc_deviceptr_clause (n->sym, loc, - clause_names[OMP_LIST_DEVICEPTR - - OMP_LIST_DATA_CLAUSE_FIRST]); - for (n = ns->oacc_declare_clauses->lists[OMP_LIST_DEVICE_RESIDENT]; n; n = n->next) check_array_not_assumed (n->sym, loc, diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c index 7dd4498..c1cf5a9 100644 --- gcc/fortran/trans-openmp.c +++ gcc/fortran/trans-openmp.c @@ -1765,9 +1765,6 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, enum omp_clause_map_kind kind; switch (list) { - case OMP_LIST_DEVICEPTR: - kind = OMP_CLAUSE_MAP_FORCE_DEVICEPTR; - break; default: gcc_unreachable (); } @@ -2164,6 +2161,9 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, case OMP_MAP_FORCE_PRESENT: OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_PRESENT; break; + case OMP_MAP_FORCE_DEVICEPTR: + OMP_CLAUSE_MAP_KIND (node) = OMP_CLAUSE_MAP_FORCE_DEVICEPTR; + break; default: gcc_unreachable (); } diff --git gcc/omp-low.c gcc/omp-low.c index 23d9f5a8..c63ec4e 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -12044,6 +12044,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) && !OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION (c) && TREE_CODE (TREE_TYPE (ovar)) == ARRAY_TYPE) { + gcc_assert (kind == GF_OMP_TARGET_KIND_REGION); tree avar = create_tmp_var (TREE_TYPE (TREE_TYPE (x)), NULL); mark_addressable (avar); @@ -12054,6 +12055,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) } else if (is_gimple_reg (var)) { + gcc_assert (kind == GF_OMP_TARGET_KIND_REGION); tree avar = create_tmp_var (TREE_TYPE (var), NULL); mark_addressable (avar); enum omp_clause_map_kind map_kind