Message ID | 20240106185257.126445-1-sandra@codesourcery.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp241365dyq; Sat, 6 Jan 2024 10:54:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWf0YP6hMBpK6wonEk3RpGZylMxD5saypAeZuTY2KB7pdWMqqqqcDdmKnqOvO2udg1X1oa X-Received: by 2002:ac8:5d89:0:b0:428:a4a:80bf with SMTP id d9-20020ac85d89000000b004280a4a80bfmr2186493qtx.132.1704567262661; Sat, 06 Jan 2024 10:54:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704567262; cv=pass; d=google.com; s=arc-20160816; b=hfW1kUcQlq0H8go1DnwuA+f5CgATSqMJY7u3ohFfGCP3fCG7fkd52TcB62tRFRMPEh XD+iSi+RDkXgfWHgJFmW1T4NXltF50C5Ye0LKt30rY7dWAfxVJ1Kr9fRaZAOS91DqlQo zt7bWZc5HOBvqQuaSVjSpKXXSq8RdcB7BKVVewObkrTBUYBPu2NlqYH0fYxo1kvPM8zd MPijwen3l+GiC1IkZCOB7omYrCkKFFeZZchq1UfFRu9e53875S3vqSTbQLF/lMxcAAB7 2jXfYJUnXCAWYer/0bdHxBa4PZFiN83hiDUNyWfpqze9tW0o3eI3eOuoSK78/ZBD7DtQ IgkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=3Qqm9kcgO5lBxzUg02kTaJkHzaMoOl14PF07mSn12iY=; fh=X+nSTPFNQ2l0Vz57AMowt+EsMLNEFoDMJGlcKDMF1vs=; b=GPfADjNLDdOLKJBqxIIYh6+mKzIeOGxGaPVMLnNFwa+ql0BNPys6Jq40T5vNV8hfVK JsAJjpmQP2kkm6J1Z1B8s6EJ/hImprr7Y7gUpR41DjUrofw5VrQcK716gGYNKcKgY6Bj tK/L3lHcIA3JRglNn0RaPAPdPsgBLfknhdVSumUe3fMgkRr0wYOpKI09rEhs/NchldCI JGIz9VdxuThIEEuO/LehS0bf2R+11F3l+t/vyOTrO3gLLaWhaxA30TbtQgpK3/WOyPz0 9gX5HUH4UInU3S6Egrf7nDLcIBiQ+5LPx0/OzWYm7Qhp5x9spbZm/gu2pOm9/5dc2kWx pKZg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y12-20020ac85f4c000000b00427ec45e1e8si4578395qta.700.2024.01.06.10.54.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 10:54:22 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 5EB8A3858C29 for <ouuuleilei@gmail.com>; Sat, 6 Jan 2024 18:54:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id A6CFD3858D32 for <gcc-patches@gcc.gnu.org>; Sat, 6 Jan 2024 18:53:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6CFD3858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A6CFD3858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.180 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704567195; cv=none; b=beoSygeJ+CXtOUoJpuYyFgRqJhLUvELc2zdkqAkTl5E2KZki7fIec/WnBLbaA9Hw4OHiuXSy+2qVwx/qfcQw2twp14YIElEZ4uckF2SP/HYa/2miFz/ioCkdBVPomil20+AYJJy4jhmCxn1ICCPqm9TuAudCyogDcYIa/GH7gV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704567195; c=relaxed/simple; bh=AUxkvqY+YFr7ZarpcKLcBvSbt9L8r6qA3wzhrlctZ4A=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=QJ7p6U30MDYXTQ/wjcSYJV7GwP9hCPuo2EBqaccqoFnQDIe/vM6KY7dMIqCmRGWgjuZV1hl1OMcc5RcgDtrsonCh+I7lC3bT5pJe/qj/1EZZ2H6s5GCDCyB4zH94JdOsyuBpYhogC3Qx4QydbV6+Y6sPeTnAJ0cuYyzSlG+CU/k= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: IQZ2G2QlTRq3UVZyfN55CQ== X-CSE-MsgGUID: /Br+6QK8TW+i2PmXNa9Klw== X-IronPort-AV: E=Sophos;i="6.04,337,1695715200"; d="scan'208";a="27342982" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 06 Jan 2024 10:53:11 -0800 IronPort-SDR: AfgVzRV2mFNdc2kRkYs8mmjMvtQQGNI5BApneLbgh9BuSc0FJKuQxPlEDLpYKYqU6qA4AOSJpd w5AfkwAcKYV4/+V+PtbeUA6UM1wIaw7Yqidmt4m6EC4VIaMske/DlK7OKXQe1YqPvMllc6vpmy 85yAS5TRJ3lpsAilfnLnRrFYZyD1j25/3QQRsp0eYWNPvMPPpVz8kxtpttxRnZriQLnZmFi3S/ shXxGVGoGVUhYVm+A5fSr10zg7qBnX1PhMzhv7VGxWkFp7/94oWZyFVwMpz0NmaKxcqt8PJ5SO ZQk= From: Sandra Loosemore <sandra@codesourcery.com> To: <gcc-patches@gcc.gnu.org> CC: <kcy@codesourcery.com>, <tobias@codesourcery.com>, <jakub@redhat.com> Subject: [PATCH 0/8] OpenMP: Implement metadirective support Date: Sat, 6 Jan 2024 11:52:48 -0700 Message-ID: <20240106185257.126445-1-sandra@codesourcery.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: svr-orw-mbx-15.mgc.mentorg.com (147.34.90.215) To svr-orw-mbx-13.mgc.mentorg.com (147.34.90.213) X-Spam-Status: No, score=-4.0 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787368321911523951 X-GMAIL-MSGID: 1787368321911523951 |
Series |
OpenMP: Implement metadirective support
|
|
Message
Sandra Loosemore
Jan. 6, 2024, 6:52 p.m. UTC
This patch set adds support for metadirectives and dynamic selectors in metadirectives. To give credit where it's due, this is primarily Kwok's work, originally posted 2+ years ago (and WIP for some time before that): https://gcc.gnu.org/pipermail/gcc-patches/2021-December/586600.html There's also currently an improved version of those patches on the OG13 branch, along with several followup bug fixes contributed by others. My contributions have been collecting, rebasing, and refactoring all the patches, adding the missing attribute syntax and template support to the C++ front end, fixing more bugs, adding documentation, and making some improvements to the internal engineering aspect of the code. Although the original patches were posted long ago, I suspect it is now too late in the release cycle for this feature to make it into GCC 14, although it would certainly make users happy if it could be squeezed in. Another concern is that I'm facing some short-term disruptions in my ability to continue work on this and I need to at least publish the current patches so they don't get lost in the shuffle. Plus, if this patch set doesn't make it into GCC 14, it will still be useful as a better starting point for OG14 than the patch set currently on OG13. In terms of what is still missing: - Dynamic context selectors are currently supported only by metadirective and not declare variant. - The C and C++ front ends attempt to do early resolution of metadirectives at parse time, but the Fortran front end does not do that yet. - IIUC the construct selector set is supposed to allow you to specify the name of any OpenMP construct, but it only recognizes a small subset. - Needs more test cases. (Everything always needs more test cases.) - Other unimplemented features beyond what was specified in OpenMP 5.1??? BTW, I'm aware that there are some open Bugzilla issues relating to the OG13 implementation of metadirectives, at least PRs 112779, 107067, and 106730, although I haven't investigated or worked on any of those directly. I do know that at least items (a) and (h) from PR 112779 have been fixed in this patch set, though. Anyway, I think it would be reasonable to do the missing features and bug fixes and follow-up patches rather than continuing to sit on the entire patch set until it's complete and perfect in every way. :-) -Sandra Kwok Cheung Yeung (7): OpenMP: metadirective tree data structures and front-end interfaces OpenMP: middle-end support for metadirectives libgomp: runtime support for target_device selector OpenMP: C front end support for metadirectives OpenMP: C++ front-end support for metadirectives OpenMP: common c/c++ testcases for metadirectives OpenMP: Fortran front-end support for metadirectives. Sandra Loosemore (1): OpenMP: Update documentation of metadirective implementation status. gcc/Makefile.in | 2 +- gcc/builtin-types.def | 2 + gcc/c-family/c-common.h | 4 +- gcc/c-family/c-gimplify.cc | 27 + gcc/c-family/c-omp.cc | 60 +- gcc/c-family/c-pragma.cc | 1 + gcc/c-family/c-pragma.h | 1 + gcc/c/c-parser.cc | 493 ++++++++++++++- gcc/cgraph.h | 3 + gcc/cgraphclones.cc | 1 + gcc/cp/decl.cc | 2 +- gcc/cp/parser.cc | 526 +++++++++++++++- gcc/cp/parser.h | 7 + gcc/cp/pt.cc | 118 ++++ gcc/doc/generic.texi | 32 + gcc/fortran/decl.cc | 29 + gcc/fortran/dump-parse-tree.cc | 21 + gcc/fortran/gfortran.h | 24 +- gcc/fortran/io.cc | 2 +- gcc/fortran/match.h | 2 + gcc/fortran/openmp.cc | 265 +++++++- gcc/fortran/parse.cc | 571 +++++++++++------- gcc/fortran/parse.h | 8 +- gcc/fortran/resolve.cc | 6 + gcc/fortran/st.cc | 4 + gcc/fortran/symbol.cc | 25 +- gcc/fortran/trans-decl.cc | 5 +- gcc/fortran/trans-openmp.cc | 243 +++++--- gcc/fortran/trans-stmt.h | 1 + gcc/fortran/trans.cc | 1 + gcc/fortran/types.def | 2 + gcc/gimple-low.cc | 36 ++ gcc/gimple-pretty-print.cc | 64 ++ gcc/gimple-streamer-in.cc | 10 + gcc/gimple-streamer-out.cc | 6 + gcc/gimple-walk.cc | 28 + gcc/gimple.cc | 35 ++ gcc/gimple.def | 7 + gcc/gimple.h | 100 ++- gcc/gimplify.cc | 184 ++++++ gcc/gsstruct.def | 2 + gcc/lto-cgraph.cc | 2 + gcc/omp-builtins.def | 3 + gcc/omp-expand.cc | 30 + gcc/omp-general.cc | 359 ++++++++++- gcc/omp-general.h | 32 +- gcc/omp-low.cc | 80 +++ gcc/omp-offload.cc | 105 +++- gcc/omp-simd-clone.cc | 1 + .../c-c++-common/gomp/metadirective-1.c | 52 ++ .../c-c++-common/gomp/metadirective-2.c | 74 +++ .../c-c++-common/gomp/metadirective-3.c | 31 + .../c-c++-common/gomp/metadirective-4.c | 40 ++ .../c-c++-common/gomp/metadirective-5.c | 24 + .../c-c++-common/gomp/metadirective-6.c | 31 + .../c-c++-common/gomp/metadirective-7.c | 31 + .../c-c++-common/gomp/metadirective-8.c | 16 + .../gomp/metadirective-construct.c | 177 ++++++ .../c-c++-common/gomp/metadirective-device.c | 147 +++++ .../gomp/metadirective-no-score.c | 95 +++ .../gomp/metadirective-target-device.c | 147 +++++ .../g++.dg/gomp/attrs-metadirective-1.C | 40 ++ .../g++.dg/gomp/attrs-metadirective-2.C | 74 +++ .../g++.dg/gomp/attrs-metadirective-3.C | 31 + .../g++.dg/gomp/attrs-metadirective-4.C | 41 ++ .../g++.dg/gomp/attrs-metadirective-5.C | 24 + .../g++.dg/gomp/attrs-metadirective-6.C | 31 + .../g++.dg/gomp/attrs-metadirective-7.C | 31 + .../g++.dg/gomp/attrs-metadirective-8.C | 16 + gcc/testsuite/gcc.dg/gomp/metadirective-1.c | 15 + .../gfortran.dg/gomp/metadirective-1.f90 | 55 ++ .../gfortran.dg/gomp/metadirective-10.f90 | 40 ++ .../gfortran.dg/gomp/metadirective-11.f90 | 33 + .../gfortran.dg/gomp/metadirective-2.f90 | 62 ++ .../gfortran.dg/gomp/metadirective-3.f90 | 34 ++ .../gfortran.dg/gomp/metadirective-4.f90 | 39 ++ .../gfortran.dg/gomp/metadirective-5.f90 | 30 + .../gfortran.dg/gomp/metadirective-6.f90 | 31 + .../gfortran.dg/gomp/metadirective-7.f90 | 36 ++ .../gfortran.dg/gomp/metadirective-8.f90 | 22 + .../gfortran.dg/gomp/metadirective-9.f90 | 30 + .../gomp/metadirective-construct.f90 | 260 ++++++++ .../gomp/metadirective-no-score.f90 | 122 ++++ gcc/testsuite/gfortran.dg/gomp/pure-1.f90 | 7 + gcc/testsuite/gfortran.dg/gomp/pure-2.f90 | 8 - gcc/tree-cfg.cc | 24 + gcc/tree-inline.cc | 39 ++ gcc/tree-pretty-print.cc | 36 +- gcc/tree-pretty-print.h | 2 + gcc/tree-ssa-operands.cc | 17 + gcc/tree.def | 6 + gcc/tree.h | 3 + include/cuda/cuda.h | 2 + libgomp/Makefile.am | 2 +- libgomp/Makefile.in | 5 +- libgomp/config/gcn/selector.c | 57 ++ libgomp/config/linux/selector.c | 43 ++ libgomp/config/linux/x86/selector.c | 325 ++++++++++ libgomp/config/nvptx/selector.c | 65 ++ libgomp/libgomp-plugin.h | 2 + libgomp/libgomp.h | 1 + libgomp/libgomp.map | 1 + libgomp/libgomp.texi | 15 +- libgomp/libgomp_g.h | 8 + libgomp/oacc-host.c | 11 + libgomp/plugin/plugin-gcn.c | 14 + libgomp/plugin/plugin-nvptx.c | 45 ++ libgomp/selector.c | 36 ++ libgomp/target.c | 38 ++ .../libgomp.c++/metadirective-template-1.C | 37 ++ .../libgomp.c++/metadirective-template-2.C | 41 ++ .../libgomp.c++/metadirective-template-3.C | 41 ++ .../libgomp.c-c++-common/metadirective-1.c | 35 ++ .../libgomp.c-c++-common/metadirective-2.c | 41 ++ .../libgomp.c-c++-common/metadirective-3.c | 34 ++ .../libgomp.c-c++-common/metadirective-4.c | 52 ++ .../libgomp.c-c++-common/metadirective-5.c | 46 ++ .../libgomp.fortran/metadirective-1.f90 | 61 ++ .../libgomp.fortran/metadirective-2.f90 | 40 ++ .../libgomp.fortran/metadirective-3.f90 | 29 + .../libgomp.fortran/metadirective-4.f90 | 46 ++ .../libgomp.fortran/metadirective-5.f90 | 44 ++ .../libgomp.fortran/metadirective-6.f90 | 58 ++ 123 files changed, 6528 insertions(+), 423 deletions(-) create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-1.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-2.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-3.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-4.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-5.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-6.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-7.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-8.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-construct.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-device.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-no-score.c create mode 100644 gcc/testsuite/c-c++-common/gomp/metadirective-target-device.c create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-1.C create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-2.C create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-3.C create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-4.C create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-5.C create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-6.C create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-7.C create mode 100644 gcc/testsuite/g++.dg/gomp/attrs-metadirective-8.C create mode 100644 gcc/testsuite/gcc.dg/gomp/metadirective-1.c create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-1.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-10.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-11.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-2.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-3.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-4.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-5.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-6.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-7.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-8.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-9.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-construct.f90 create mode 100644 gcc/testsuite/gfortran.dg/gomp/metadirective-no-score.f90 create mode 100644 libgomp/config/gcn/selector.c create mode 100644 libgomp/config/linux/selector.c create mode 100644 libgomp/config/linux/x86/selector.c create mode 100644 libgomp/config/nvptx/selector.c create mode 100644 libgomp/selector.c create mode 100644 libgomp/testsuite/libgomp.c++/metadirective-template-1.C create mode 100644 libgomp/testsuite/libgomp.c++/metadirective-template-2.C create mode 100644 libgomp/testsuite/libgomp.c++/metadirective-template-3.C create mode 100644 libgomp/testsuite/libgomp.c-c++-common/metadirective-1.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/metadirective-2.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/metadirective-3.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/metadirective-4.c create mode 100644 libgomp/testsuite/libgomp.c-c++-common/metadirective-5.c create mode 100644 libgomp/testsuite/libgomp.fortran/metadirective-1.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/metadirective-2.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/metadirective-3.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/metadirective-4.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/metadirective-5.f90 create mode 100644 libgomp/testsuite/libgomp.fortran/metadirective-6.f90