From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E98D9385B804 for ; Wed, 4 May 2022 12:33:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E98D9385B804 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-C9IzGUCMM2ifG8ADZt-Fkw-1; Wed, 04 May 2022 08:33:17 -0400 X-MC-Unique: C9IzGUCMM2ifG8ADZt-Fkw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 516A81C05193; Wed, 4 May 2022 12:33:17 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A674468A70; Wed, 4 May 2022 12:33:16 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 244CXE8C1694530 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 4 May 2022 14:33:14 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 244CXDpZ1694529; Wed, 4 May 2022 14:33:13 +0200 Date: Wed, 4 May 2022 14:33:13 +0200 From: Jakub Jelinek To: Sandra Loosemore Cc: "fortran@gcc.gnu.org" , "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH, stage 1] Fortran: Add support for OMP non-rectangular loops Message-ID: Reply-To: Jakub Jelinek References: <09c4c519-3121-015c-0f22-894135506e21@codesourcery.com> MIME-Version: 1.0 In-Reply-To: <09c4c519-3121-015c-0f22-894135506e21@codesourcery.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2022 12:33:20 -0000 On Fri, Mar 25, 2022 at 08:03:38PM -0600, Sandra Loosemore wrote: > This patch adds support for OMP 5.1 "canonical loop nest form" to the > Fortran front end, marks non-rectangular loops for processing > by the middle end, and implements missing checks in the gimplifier > for additional prohibitions on non-rectangular loops. > > Note that the OMP spec also prohibits non-rectangular loops with the TILE > construct; that construct hasn't been implemented yet, so that error will > need to be filled in later. > > gcc/fortran/ > * gfortran.h (struct gfc_omp_clauses): Add non_rectangular bit. > * openmp.cc (is_outer_iteration_variable): New function. > (expr_is_invariant): New function. > (bound_expr_is_canonical): New function. > (resolve_omp_do): Replace existing non-rectangularity error with > check for canonical form and setting non_rectangular bit. > * trans-openmp.cc (gfc_trans_omp_do): Transfer non_rectangular > flag to generated tree structure. > > gcc/ > * gimplify.cc (gimplify_omp_for): Update messages for SCHEDULED > and ORDERED clause conflict errors. Add check for GRAINSIZE and > NUM_TASKS on TASKLOOP. > > gcc/testsuite/ > * c-c++-common/gomp/loop-6.c (f3): New function to test TASKLOOP > diagnostics. > * gfortran.dg/gomp/collapse1.f90: Update expected messages. > * gfortran.dg/gomp/pr85313.f90: Remove dg-error on non-rectangular > loops that are now accepted. > * gfortran.dg/gomp/non-rectangular-loop.f90: New file. > * gfortran.dg/gomp/canonical-loop-1.f90: New file. > * gfortran.dg/gomp/canonical-loop-2.f90: New file. > > --- a/gcc/gimplify.cc > +++ b/gcc/gimplify.cc > @@ -12468,11 +12468,11 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) > OMP_CLAUSE_SCHEDULE)) > error_at (EXPR_LOCATION (for_stmt), > "%qs clause may not appear on non-rectangular %qs", > - "schedule", "for"); > + "schedule", (lang_GNU_Fortran () ? "do" : "for")); > if (omp_find_clause (OMP_FOR_CLAUSES (for_stmt), OMP_CLAUSE_ORDERED)) > error_at (EXPR_LOCATION (for_stmt), > "%qs clause may not appear on non-rectangular %qs", > - "ordered", "for"); > + "ordered", (lang_GNU_Fortran () ? "do" : "for")); Please drop the superfluous ()s around the argument, just use "...", lang_GNU_Fortran () ? "do" : "for"); Ok for trunk with that nit fixed. And thanks for discovering the missing grainsize/num_tasks checks. Jakub