From patchwork Mon Sep 20 15:01:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1530212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4HCnpN6l4Fz9sSn for ; Tue, 21 Sep 2021 01:02:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3F8E13857C48 for ; Mon, 20 Sep 2021 15:02:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 9BB003858D3C; Mon, 20 Sep 2021 15:01:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9BB003858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: nss/clW6Kqutl/F5/UH72vzPPu7A4o3Le7/JUC03a4B+CZI3KVwYId6MbYntVHjinX4ieDu45b QTQJ+eBK/+/IfrzFtMmfWrfhniCZsiXWbZ5oe5Z7YLHPVzwVzM5OGK/Dgm8S2eMH+HG8bGZzMX MDy9BQar1K0WbzaW72gB+hUZpeM9Bzdjj4ig0y5ZHUV8cPmoD2tjE2RB16k/zrts6Og/2EDFzS EEWEuDSy/0lmeXAlOCsCvJq1fL+fOz7rICncMON6QJ0V0ztdtX1cLuSz3KO5rtpEgrSv7R07fd sgSqeaUXxnIiu+9uFVGwncCl X-IronPort-AV: E=Sophos;i="5.85,308,1624348800"; d="diff'?scan'208";a="68569656" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 20 Sep 2021 07:01:40 -0800 IronPort-SDR: hkT3R6h+6Q1K/o+kXo1Ml7dvM5AUWV+ItBY6P2VU7wS6Dmd8ug1xlDVktL/LmasU1MmmNjB+Y5 oSP8opNRXQlzruJZ1zRSoavUOBGRzKqsBsNmXE3L3HkaijTmms8kT1RpKHPQjuN73vMW2cjo5n bviN0wAa84CUFEkiNFOPvqljL0vPtzydcUFT8jHpxarj/GZi7Sg5tNm5ukmkaR0qTJpk6oOvZa 0qQ2pj/BDGmwg/Zq6S2lN2xTC0K9ccLb/na71XgQRizD8w/+qNeJmNTGcldf7mcNqnOdf4OQXG WSA= Subject: [Patch]GCC11 - Fortran: combined directives - order(concurrent) not on distribute (was: Re: [Patch] Fortran/OpenMP: unconstrained/reproducible ordered modifier) To: Jakub Jelinek References: <68b73c25-9e9d-ad04-88cf-03891ddc8ab9@codesourcery.com> <20210920095544.GI304296@tucnak> From: Tobias Burnus Message-ID: Date: Mon, 20 Sep 2021 17:01:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210920095544.GI304296@tucnak> Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gcc-patches , fortran Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" On 20.09.21 11:55, Jakub Jelinek via Fortran wrote: > So the FE was splitting the order clause to distribute already before, > perhaps we should undo that for gcc 11 which doesn't claim any OpenMP 5.1 > support. > The difference is e.g. the distribute parallel do order(concurrent) copyin(thr) > case which used to be ok in 5.0 and is not in 5.1. Well, if I try with GCC 11: void f(int *a) { int i; static int thr; #pragma omp threadprivate (thr) #pragma omp distribute parallel for order(concurrent) copyin(thr) for (i = 0; i < 10; ++i) { thr = 5; a[i] = thr; } } I get with gcc (+ gfortran): error: threadprivate variable ‘thr’ used in a region with ‘order(concurrent)’ clause I might have misunderstood the example. * * * In any case, for GCC 11, I have now fixed the splitting and added a testcase which relies on -fdump-tree-original scanning and does not use threadprivate. OK for GCC 11, only? Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 GCC11 - Fortran: combined directives - order(concurrent) not on distribute While OpenMP 5.1 and GCC 12 permits 'order(concurrent)' on distribute, OpenMP 5.0 and GCC 11 don't. This patch for GCC 11 ensures the clause also does not end up on 'distribute' when splitting combined directives. gcc/fortran/ChangeLog: * trans-openmp.c (gfc_split_omp_clauses): Don't put 'order(concurrent)' on 'distribute' for combined directives, matching OpenMP 5.0 gcc/testsuite/ChangeLog: * gfortran.dg/gomp/distribute-order-concurrent.f90: New test. gcc/fortran/trans-openmp.c | 2 -- .../gomp/distribute-order-concurrent.f90 | 25 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 7e931bf4bc7..973d916b4a2 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -5176,8 +5176,6 @@ gfc_split_omp_clauses (gfc_code *code, /* Duplicate collapse. */ clausesa[GFC_OMP_SPLIT_DISTRIBUTE].collapse = code->ext.omp_clauses->collapse; - clausesa[GFC_OMP_SPLIT_DISTRIBUTE].order_concurrent - = code->ext.omp_clauses->order_concurrent; } if (mask & GFC_OMP_MASK_PARALLEL) { diff --git a/gcc/testsuite/gfortran.dg/gomp/distribute-order-concurrent.f90 b/gcc/testsuite/gfortran.dg/gomp/distribute-order-concurrent.f90 new file mode 100644 index 00000000000..9597d913684 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/distribute-order-concurrent.f90 @@ -0,0 +1,25 @@ +! { dg-additional-options "-fdump-tree-original" } +! +! In OpenMP 5.0, 'order(concurrent)' does not apply to distribute +! Ensure that it is rejected in GCC 11. +! +! Note: OpenMP 5.1 allows it; the GCC 12 testcase for it is gfortran.dg/gomp/order-5.f90 + +subroutine f(a) +implicit none +integer :: i, thr +!save :: thr +integer :: a(:) + +!$omp distribute parallel do order(concurrent) private(thr) + do i = 1, 10 + thr = 5 + a(i) = thr + end do +!$omp end distribute parallel do +end + +! { dg-final { scan-tree-dump-not "omp distribute\[^\n\r]*order" "original" } } +! { dg-final { scan-tree-dump "#pragma omp distribute\[\n\r\]" "original" } } +! { dg-final { scan-tree-dump "#pragma omp parallel private\\(thr\\)" "original" } } +! { dg-final { scan-tree-dump "#pragma omp for nowait order\\(concurrent\\)" "original" } }