From patchwork Wed Nov 5 16:44:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 407084 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 4DA9814003E for ; Thu, 6 Nov 2014 03:45:23 +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=PWukm2HQ/HUHXfvq oUiIl39Xk5OwntLDN+bzGaNghj8x5yuBZy07DIY0vKJQqR33ypers+fmcYMcF0km uglP1QVVWdZ6qSrh3aKJg+QoSz5bFA7YnN7YoyKnfoxxeaJl4q9oB0f/1X1nh3nh 7rpS217HHcIlyPwhTnhi7QrsoN4= 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=fLF2TJSErFvQ2aTcnYMarB 1Uusc=; b=MCQzpO0JYZB1/PRhBdsjXkfFtus/6BdqVsATc1fsWM/CMgaoJotkLx Fn2ZCumRm9qhL9eI+iCHi+v+BQqSmsjIloCIllDfob2qnhq7KhGFZjEJg67MjTRB mIJtPGdGkvv1etcqymH0wMZDh9EWn0CCpohF2cVD8mOrWoB+k30Ag= Received: (qmail 23510 invoked by alias); 5 Nov 2014 16:45:09 -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 23492 invoked by uid 89); 5 Nov 2014 16:45:08 -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; Wed, 05 Nov 2014 16:45:07 +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 1Xm3he-0005r7-IA from Thomas_Schwinge@mentor.com ; Wed, 05 Nov 2014 08:45:03 -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; Wed, 5 Nov 2014 16:45:01 +0000 From: Thomas Schwinge To: Cesar Philippidis , CC: James Norris , Subject: Re: [gomp4] OpenACC cache directive maintenance In-Reply-To: <87a945eh9d.fsf@kepler.schwinge.homeip.net> References: <52E158EF.9050009@samsung.com> <52E1595D.9000007@samsung.com> <52E1597E.8070809@samsung.com> <52E15999.6010505@samsung.com> <52E159BD.9040407@samsung.com> <874n4tqink.fsf@schwinge.name> <87d291ehls.fsf@kepler.schwinge.homeip.net> <87a945eh9d.fsf@kepler.schwinge.homeip.net> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/24.3.1 (i586-pc-linux-gnu) Date: Wed, 5 Nov 2014 17:44:58 +0100 Message-ID: <87389xegvp.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi Cesar! On Wed, 05 Nov 2014 17:36:46 +0100, I wrote: > In r217146, I applied the following to gomp-4_0-branch: > > commit e8e44b733808997d06c0cdf9bf5756ce03530f42 > Author: tschwinge > Date: Wed Nov 5 16:35:30 2014 +0000 > > OpenACC cache directive maintenance. > > gcc/c/ > * c-parser.c (c_parser_oacc_cache): Generate OACC_CACHE. > * c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_. > gcc/cp/ > * parser.c (cp_parser_oacc_cache): Generate OACC_CACHE. > * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE__CACHE_. > gcc/ > * gimplify.c (gimplify_oacc_cache): New function. > (gimplify_expr): Use it for OACC_CACHE. > (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle > OMP_CLAUSE__CACHE_. > --- gcc/c/c-parser.c > +++ gcc/c/c-parser.c > static tree > -c_parser_oacc_cache (location_t loc __attribute__((unused)), c_parser *parser) > +c_parser_oacc_cache (location_t loc, c_parser *parser) > { > - c_parser_omp_var_list_parens (parser, OMP_NO_CLAUSE_CACHE, NULL); > + tree stmt, clauses; > + > + clauses = c_parser_omp_var_list_parens (parser, OMP_CLAUSE__CACHE_, NULL); > + clauses = c_finish_omp_clauses (clauses); > + > c_parser_skip_to_pragma_eol (parser); > > - return NULL_TREE; > + stmt = make_node (OACC_CACHE); > + TREE_TYPE (stmt) = void_type_node; > + OACC_CACHE_CLAUSES (stmt) = clauses; > + SET_EXPR_LOCATION (stmt, loc); > + add_stmt (stmt); > + > + return stmt; > } > --- gcc/c/c-typeck.c > +++ gcc/c/c-typeck.c > @@ -12204,6 +12204,7 @@ c_finish_omp_clauses (tree clauses) > case OMP_CLAUSE_MAP: > case OMP_CLAUSE_TO: > case OMP_CLAUSE_FROM: > + case OMP_CLAUSE__CACHE_: > t = OMP_CLAUSE_DECL (c); > if (TREE_CODE (t) == TREE_LIST) > { [The "same" for C++.] I also tried to make this work for Fortran, but didn't manage to (in a reasonable amount of time, which has not been a lot that I allocated) ;-) -- would you please have a look at this (but it's not urgent). commit 7cf14ddb307a5b271e098f3a3fdb0452f6036f91 Author: Thomas Schwinge Date: Wed Nov 5 09:16:12 2014 +0100 cache: Fortran experimenting. --- gcc/fortran/frontend-passes.c | 3 ++- gcc/fortran/openmp.c | 12 ++---------- gcc/fortran/trans-openmp.c | 18 ++++++++++++------ gcc/testsuite/gfortran.dg/goacc/cache-1.f95 | 1 - gcc/testsuite/gfortran.dg/goacc/coarray.f95 | 1 - gcc/testsuite/gfortran.dg/goacc/cray.f95 | 2 -- gcc/testsuite/gfortran.dg/goacc/loop-1.f95 | 1 - gcc/testsuite/gfortran.dg/goacc/parameter.f95 | 1 - 8 files changed, 16 insertions(+), 23 deletions(-) Grüße, Thomas diff --git gcc/fortran/frontend-passes.c gcc/fortran/frontend-passes.c index 97a9164..729629e 100644 --- gcc/fortran/frontend-passes.c +++ gcc/fortran/frontend-passes.c @@ -2190,7 +2190,8 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn, gfc_omp_namelist *n; static int list_types[] = { OMP_LIST_ALIGNED, OMP_LIST_LINEAR, OMP_LIST_DEPEND, - OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM }; + OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM, + OMP_LIST_CACHE }; size_t idx; WALK_SUBEXPR (co->ext.omp_clauses->if_expr); WALK_SUBEXPR (co->ext.omp_clauses->final_expr); diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c index 959798a..167331a 100644 --- gcc/fortran/openmp.c +++ gcc/fortran/openmp.c @@ -3102,6 +3102,7 @@ resolve_omp_clauses (gfc_code *code, locus *where, case OMP_LIST_MAP: case OMP_LIST_TO: case OMP_LIST_FROM: + case OMP_LIST_CACHE: for (; n != NULL; n = n->next) { if (n->expr) @@ -4594,13 +4595,6 @@ resolve_oacc_loop(gfc_code *code) } -static void -resolve_oacc_cache (gfc_code *code) -{ - gfc_error ("Sorry, !$ACC cache unimplemented yet at %L", &code->loc); -} - - void gfc_resolve_oacc_declare (gfc_namespace *ns) { @@ -4675,6 +4669,7 @@ gfc_resolve_oacc_directive (gfc_code *code, gfc_namespace *ns ATTRIBUTE_UNUSED) case EXEC_OACC_ENTER_DATA: case EXEC_OACC_EXIT_DATA: case EXEC_OACC_WAIT: + case EXEC_OACC_CACHE: resolve_omp_clauses (code, &code->loc, code->ext.omp_clauses, NULL, true); break; @@ -4683,9 +4678,6 @@ gfc_resolve_oacc_directive (gfc_code *code, gfc_namespace *ns ATTRIBUTE_UNUSED) case EXEC_OACC_LOOP: resolve_oacc_loop (code); break; - case EXEC_OACC_CACHE: - resolve_oacc_cache (code); - break; default: break; } diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c index 7dd4498..e39e903 100644 --- gcc/fortran/trans-openmp.c +++ gcc/fortran/trans-openmp.c @@ -1806,9 +1806,9 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, case OMP_LIST_DEVICE_RESIDENT: clause_code = OMP_CLAUSE_DEVICE_RESIDENT; goto add_clause; - case OMP_LIST_CACHE: - clause_code = OMP_CLAUSE__CACHE_; - goto add_clause; +// case OMP_LIST_CACHE: +// clause_code = OMP_CLAUSE__CACHE_; +// goto add_clause; add_clause: omp_clauses @@ -2178,14 +2178,20 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, break; case OMP_LIST_TO: case OMP_LIST_FROM: + case OMP_LIST_CACHE: for (; n != NULL; n = n->next) { if (!n->sym->attr.referenced) continue; - tree node = build_omp_clause (input_location, - list == OMP_LIST_TO - ? OMP_CLAUSE_TO : OMP_CLAUSE_FROM); + switch (list) + { + case OMP_LIST_TO: clause_code = OMP_CLAUSE_TO; break; + case OMP_LIST_FROM: clause_code = OMP_CLAUSE_FROM; break; + case OMP_LIST_CACHE: clause_code = OMP_CLAUSE__CACHE_; break; + default: gcc_unreachable (); + } + tree node = build_omp_clause (input_location, clause_code); if (n->expr == NULL || n->expr->ref->u.ar.type == AR_FULL) { tree decl = gfc_get_symbol_decl (n->sym); diff --git gcc/testsuite/gfortran.dg/goacc/cache-1.f95 gcc/testsuite/gfortran.dg/goacc/cache-1.f95 index 746cf02..74ab332 100644 --- gcc/testsuite/gfortran.dg/goacc/cache-1.f95 +++ gcc/testsuite/gfortran.dg/goacc/cache-1.f95 @@ -9,4 +9,3 @@ program test !$acc cache (d) enddo end -! { dg-prune-output "unimplemented" } diff --git gcc/testsuite/gfortran.dg/goacc/coarray.f95 gcc/testsuite/gfortran.dg/goacc/coarray.f95 index 4f1224e..f0adac6 100644 --- gcc/testsuite/gfortran.dg/goacc/coarray.f95 +++ gcc/testsuite/gfortran.dg/goacc/coarray.f95 @@ -32,4 +32,3 @@ contains !$acc update self (a) end subroutine oacc1 end module test -! { dg-prune-output "ACC cache unimplemented" } diff --git gcc/testsuite/gfortran.dg/goacc/cray.f95 gcc/testsuite/gfortran.dg/goacc/cray.f95 index 8f2c077..1ed40fd 100644 --- gcc/testsuite/gfortran.dg/goacc/cray.f95 +++ gcc/testsuite/gfortran.dg/goacc/cray.f95 @@ -24,7 +24,6 @@ contains !$acc end parallel loop !$acc parallel loop do i = 1,5 - ! Subarrays are not implemented yet !$acc cache (pointee) ! TODO: This must fail, as in openacc-1_0-branch enddo !$acc end parallel loop @@ -53,4 +52,3 @@ contains !$acc update self (ptr) end subroutine oacc1 end module test -! { dg-prune-output "unimplemented" } diff --git gcc/testsuite/gfortran.dg/goacc/loop-1.f95 gcc/testsuite/gfortran.dg/goacc/loop-1.f95 index e1b2dfd..817039f 100644 --- gcc/testsuite/gfortran.dg/goacc/loop-1.f95 +++ gcc/testsuite/gfortran.dg/goacc/loop-1.f95 @@ -168,4 +168,3 @@ subroutine test1 end subroutine test1 end module test ! { dg-prune-output "Deleted" } -! { dg-prune-output "ACC cache unimplemented" } diff --git gcc/testsuite/gfortran.dg/goacc/parameter.f95 gcc/testsuite/gfortran.dg/goacc/parameter.f95 index 1364181..82c25ba 100644 --- gcc/testsuite/gfortran.dg/goacc/parameter.f95 +++ gcc/testsuite/gfortran.dg/goacc/parameter.f95 @@ -29,4 +29,3 @@ contains !$acc update self (a) ! { dg-error "not a variable" } end subroutine oacc1 end module test -! { dg-prune-output "unimplemented" }