From patchwork Tue Sep 13 21:01:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 24 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp2528611wrt; Tue, 13 Sep 2022 14:03:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR569GOUDunJusEGN9Od0C5mrErCy2mCJumTFcB6lMpqS+UeRewpFFeHIJPuF3OEPZ8yy/Mo X-Received: by 2002:a17:906:c154:b0:733:197:a8c with SMTP id dp20-20020a170906c15400b0073301970a8cmr23671557ejc.483.1663103010956; Tue, 13 Sep 2022 14:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663103010; cv=none; d=google.com; s=arc-20160816; b=V/zk+NOWA/ZEe5NZj/tAYrHnSYtKYo7yUDVjDhc8ojadT9futI9DqAtxPgZG1Aa6HB GCX2pVtnebfFBOmmV5evfx3WEykIIlpM9LJgLMU0Bnkzx5/AljQTTr54slrhIwFyXM2m MITc13PIGedgPw093LnoUD81edxvQkCE1BMj17GWfLzFYu/Rl2OBzOlnseEttVLBPbJi hV5+Opor37XG3QFbLANVKwYBwwKET7uDH7uXv9//1fqpSnTLXdmqyncFvISz4Oj0LgIV rKIlIbFYAN9C2id/CUunc6BjSGN8hkdXNkVqseuPNyiFtiqAHpF4Q1N74KeVABi0PMA9 Y4Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:ironport-sdr :dmarc-filter:delivered-to; bh=1cc0pU1e1STI6GvASjKoTU/RGyOHSI+hLw9BE9wSItE=; b=gGsCdu5OjjJadqtq/Xj1pKD2IV9p/9vTUSdDWG26a6LE5TnGzazzqxahgCCCTp0QJS EWAYUuJcO8GWXc80AYbFEoY/+7qCuQiyd0b6CerdYahfOc5aLLppqTv/QLaz1TvvVevZ 45wjyHERIts+ki2MlusR39e5ldEWDfgG0tP2VeWoUnmHdsGDvZq5U0/xKnH/CjcDVa5k eNxgeRZM347+mVOSobe4AUY1YMnyc/WF1BzUgZX0ZGt3miqHEiLnQ3NYWLuwKq/ewa5L 9FMzTePzFrvXjJENMTzN0nji4tUJZ+/i7qhcjFib0FhsQqdN1SrvluQtXIRaDAmt3jPG S4eA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id f11-20020a170906494b00b00779c882a6casi8327855ejt.978.2022.09.13.14.03.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Sep 2022 14:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28721384BC18 for ; Tue, 13 Sep 2022 21:02:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 6EB9D385840A; Tue, 13 Sep 2022 21:02:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6EB9D385840A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,313,1654588800"; d="scan'208";a="82932909" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 13 Sep 2022 13:01:59 -0800 IronPort-SDR: qDajEh+fUATl5nwh1JfEW5kF49RZt+jZ2EeQ61r3QeEsXmaBNQDgzMQnzAp6gEmH5ZK6IX/cj5 s5rCmiJB3WKwP87TOXqFcl1GcOc7dYf4CWwHmQgsM6GcO8BLcTNAeisJLkXZTFDB8/35gPccSX 1UU7aCqEyao4K8P9ELN4DpmiXkXqH0D33ySp56rLAvh0nGZnYUefxcDkXNwvAqFoP3vMbJuBaT fbfQmhE/9aXiNv20JW9etXT4lHE0mpBJZBB/Iv5nWn3BAaNNxD1lT99qmZwIvulhqhENDFTXKe cGE= From: Julian Brown To: Subject: [PATCH v3 00/11] OpenMP 5.0: Struct & mapping clause expansion rework Date: Tue, 13 Sep 2022 14:01:41 -0700 Message-ID: X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Jakub Jelinek , tobias@codesourcery.com, fortran@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743889903112094685?= X-GMAIL-MSGID: =?utf-8?q?1743889903112094685?= This is a new version of the first few patches of the series (up to "Handle reference-typed struct members"): https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591973.html Relative to the previously-posted series, this version addresses several review comments, but more significantly it largely reworks how OpenMP/OpenACC mapping clause expansion works in the C and C++ front ends and in gimplify.cc, following discovery of some quite serious shortcomings in the existing & previous support for same. (For the new "baseptrs-4.C" test, approximately 135 out of 274 tests failed.) Revisions/rework have been completed up to the 8th patch in the series. The remaining patches address some previous review comments and are included to support the direction of the first eight patches, but are not ready for full re-review yet. Individual patches bootstrapped (except the "trivial" ones) and regression tested with offloading to NVPTX (up to "OpenMP/OpenACC: Rework clause expansion and nested struct handling"). Further commentary on individual patches. Julian Brown (11): OpenMP 5.0: Clause ordering for OpenMP 5.0 (topological sorting by base pointer) Remove omp_target_reorder_clauses OpenMP/OpenACC struct sibling list gimplification extension and rework OpenMP/OpenACC: mapping group list-handling improvements OpenMP: push attaches to end of clause list in "target" regions OpenMP: Pointers and member mappings OpenMP/OpenACC: Reindent TO/FROM/_CACHE_ stanza in {c_}finish_omp_clause OpenMP/OpenACC: Rework clause expansion and nested struct handling FYI/unfinished: OpenMP: lvalue parsing for map clauses (C++) Use OMP_ARRAY_SECTION instead of TREE_LIST in C++ FE FYI/unfinished: OpenMP 5.0 "declare mapper" support for C++ gcc/c-family/c-common.h | 68 + gcc/c-family/c-omp.cc | 780 +++- gcc/c/c-typeck.cc | 750 ++-- gcc/cp/cp-gimplify.cc | 6 + gcc/cp/cp-objcp-common.h | 2 + gcc/cp/cp-tree.h | 10 + gcc/cp/decl.cc | 18 +- gcc/cp/error.cc | 9 + gcc/cp/mangle.cc | 5 +- gcc/cp/name-lookup.cc | 3 +- gcc/cp/parser.cc | 543 ++- gcc/cp/parser.h | 3 + gcc/cp/pt.cc | 144 +- gcc/cp/semantics.cc | 1570 ++++--- gcc/fortran/parse.cc | 3 + gcc/fortran/trans-openmp.cc | 160 +- gcc/gimplify.cc | 3702 +++++++++++++---- gcc/langhooks-def.h | 3 + gcc/langhooks.cc | 9 + gcc/langhooks.h | 4 + gcc/omp-general.cc | 426 ++ gcc/omp-general.h | 109 + gcc/omp-low.cc | 26 +- gcc/testsuite/c-c++-common/goacc/mdc-2.c | 2 + gcc/testsuite/c-c++-common/gomp/clauses-2.c | 2 +- gcc/testsuite/c-c++-common/gomp/map-6.c | 10 +- gcc/testsuite/c-c++-common/gomp/target-50.c | 23 + .../c-c++-common/gomp/target-implicit-map-2.c | 2 +- gcc/testsuite/g++.dg/goacc/mdc.C | 2 + gcc/testsuite/g++.dg/goacc/member-array-acc.C | 13 + gcc/testsuite/g++.dg/gomp/declare-mapper-1.C | 58 + gcc/testsuite/g++.dg/gomp/declare-mapper-2.C | 30 + gcc/testsuite/g++.dg/gomp/declare-mapper-3.C | 27 + gcc/testsuite/g++.dg/gomp/declare-mapper-4.C | 74 + gcc/testsuite/g++.dg/gomp/ind-base-3.C | 37 + gcc/testsuite/g++.dg/gomp/map-assignment-1.C | 12 + gcc/testsuite/g++.dg/gomp/map-inc-1.C | 10 + gcc/testsuite/g++.dg/gomp/map-lvalue-ref-1.C | 19 + gcc/testsuite/g++.dg/gomp/map-ptrmem-1.C | 37 + gcc/testsuite/g++.dg/gomp/map-ptrmem-2.C | 40 + .../g++.dg/gomp/map-static-cast-lvalue-1.C | 17 + gcc/testsuite/g++.dg/gomp/map-ternary-1.C | 20 + gcc/testsuite/g++.dg/gomp/member-array-2.C | 91 + gcc/testsuite/g++.dg/gomp/member-array-omp.C | 13 + gcc/testsuite/g++.dg/gomp/pr67522.C | 2 +- .../g++.dg/gomp/static-component-1.C | 23 + gcc/testsuite/g++.dg/gomp/target-3.C | 4 +- gcc/testsuite/g++.dg/gomp/target-lambda-1.C | 6 +- gcc/testsuite/g++.dg/gomp/target-this-2.C | 2 +- gcc/testsuite/g++.dg/gomp/target-this-3.C | 4 +- gcc/testsuite/g++.dg/gomp/target-this-4.C | 4 +- gcc/testsuite/gcc.dg/gomp/target-3.c | 2 +- gcc/tree-core.h | 4 + gcc/tree-pretty-print.cc | 56 + gcc/tree.cc | 2 + gcc/tree.def | 10 + gcc/tree.h | 25 + include/gomp-constants.h | 8 +- libgomp/target.c | 31 +- libgomp/testsuite/libgomp.c++/baseptrs-3.C | 275 ++ libgomp/testsuite/libgomp.c++/baseptrs-4.C | 3148 ++++++++++++++ libgomp/testsuite/libgomp.c++/baseptrs-5.C | 62 + libgomp/testsuite/libgomp.c++/class-array-1.C | 59 + .../testsuite/libgomp.c++/declare-mapper-1.C | 87 + .../testsuite/libgomp.c++/declare-mapper-2.C | 55 + .../testsuite/libgomp.c++/declare-mapper-3.C | 63 + .../testsuite/libgomp.c++/declare-mapper-4.C | 63 + .../testsuite/libgomp.c++/declare-mapper-5.C | 52 + .../testsuite/libgomp.c++/declare-mapper-6.C | 37 + .../testsuite/libgomp.c++/declare-mapper-7.C | 48 + .../testsuite/libgomp.c++/declare-mapper-8.C | 61 + libgomp/testsuite/libgomp.c++/ind-base-1.C | 162 + libgomp/testsuite/libgomp.c++/ind-base-2.C | 49 + libgomp/testsuite/libgomp.c++/map-comma-1.C | 15 + .../testsuite/libgomp.c++/map-rvalue-ref-1.C | 22 + libgomp/testsuite/libgomp.c++/struct-ref-1.C | 97 + libgomp/testsuite/libgomp.c++/target-48.C | 32 + libgomp/testsuite/libgomp.c++/target-49.C | 37 + .../libgomp.c-c++-common/array-field-1.c | 35 + .../libgomp.c-c++-common/array-of-struct-1.c | 65 + .../libgomp.c-c++-common/array-of-struct-2.c | 65 + .../libgomp.c-c++-common/baseptrs-1.c | 50 + .../libgomp.c-c++-common/baseptrs-2.c | 70 + libgomp/testsuite/libgomp.c/target-22.c | 3 +- .../libgomp.fortran/map-subarray.f90 | 33 + .../libgomp.fortran/map-subcomponents.f90 | 32 + .../libgomp.fortran/struct-elem-map-1.f90 | 10 +- .../testsuite/libgomp.oacc-c++/deep-copy-17.C | 101 + .../libgomp.oacc-c-c++-common/deep-copy-15.c | 68 + .../libgomp.oacc-c-c++-common/deep-copy-16.c | 231 + .../deep-copy-arrayofstruct.c | 2 +- 91 files changed, 12350 insertions(+), 1914 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/target-50.c create mode 100644 gcc/testsuite/g++.dg/goacc/member-array-acc.C create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-2.C create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-3.C create mode 100644 gcc/testsuite/g++.dg/gomp/declare-mapper-4.C create mode 100644 gcc/testsuite/g++.dg/gomp/ind-base-3.C create mode 100644 gcc/testsuite/g++.dg/gomp/map-assignment-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/map-inc-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/map-lvalue-ref-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/map-ptrmem-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/map-ptrmem-2.C create mode 100644 gcc/testsuite/g++.dg/gomp/map-static-cast-lvalue-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/map-ternary-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/member-array-2.C create mode 100644 gcc/testsuite/g++.dg/gomp/member-array-omp.C create mode 100644 gcc/testsuite/g++.dg/gomp/static-component-1.C create mode 100644 libgomp/testsuite/libgomp.c++/baseptrs-3.C create mode 100644 libgomp/testsuite/libgomp.c++/baseptrs-4.C create mode 100644 libgomp/testsuite/libgomp.c++/baseptrs-5.C create mode 100644 libgomp/testsuite/libgomp.c++/class-array-1.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-1.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-2.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-3.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-4.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-5.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-6.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-7.C create mode 100644 libgomp/testsuite/libgomp.c++/declare-mapper-8.C create mode 100644 libgomp/testsuite/libgomp.c++/ind-base-1.C create mode 100644 libgomp/testsuite/libgomp.c++/ind-base-2.C create mode 100644 libgomp/testsuite/libgomp.c++/map-comma-1.C create mode 100644 libgomp/testsuite/libgomp.c++/map-rvalue-ref-1.C create mode 100644 libgomp/testsuite/libgomp.c++/struct-ref-1.C create mode 100644 libgomp/testsuite/libgomp.c++/target-48.C create mode 100644 libgomp/testsuite/libgomp.c++/target-49.C create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-field-1.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-of-struct-1.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/array-of-struct-2.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/baseptrs-1.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/baseptrs-2.c create mode 100644 libgomp/testsuite/libgomp.fortran/map-subarray.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/map-subcomponents.f90 create mode 100644 libgomp/testsuite/libgomp.oacc-c++/deep-copy-17.C create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-15.c create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/deep-copy-16.c rename {gcc/testsuite/c-c++-common/goacc => libgomp/testsuite/libgomp.oacc-c-c++-common}/deep-copy-arrayofstruct.c (98%)