From patchwork Wed Oct 25 09:44:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 157976 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2479467vqx; Wed, 25 Oct 2023 02:45:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbyYr8J42T1w9zJS24pEi4Fszn5KPZMDWVr9AJgOFnNkDugG2B3HuXsjMzFM7VsijRNdmi X-Received: by 2002:a05:6214:1c44:b0:66d:3474:a93b with SMTP id if4-20020a0562141c4400b0066d3474a93bmr15704635qvb.59.1698227115942; Wed, 25 Oct 2023 02:45:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698227115; cv=pass; d=google.com; s=arc-20160816; b=r0i7NoAWa0vLa/RqWmJ/qwBwJ3d0QTqmuPZMyLMzGYMOE43LNVeA5CRrV8LJCXWeub wt6/NvPRfAkF4FSBRsMS7CuYK4iIC6YkfxL5Y3LZAr3ZjIeWeHzJbvHpooA9gk6UUD0r ZVuIXJLfzRlcQTLWkyePkh94CIdfKA+f+VHbPVEnofeGm3WjXnRH7ZkAEese3XhXJLtP ny7KKgBNnPpEGuC2sgU9xL5K81xwKpWFKfuTKFXRndjb39NHZVETZ9F4B7EMGWfZsx3i 2ZgXl5iRxnEqishSh77Y8ESKAckfnW5lSpOEoPZKFU2M7GUtulpYqSSoBIXMUZDTMiRQ mXeQ== 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:mime-version:message-id:date :user-agent:references:in-reply-to:subject:cc:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=fLgRtWVbrkHWtKM/h3SOB8apcHARSepTLBUuPuXZSSM=; fh=Co5wug9QDAoRxkPUv9YyCzVatkVXssKJqWIIO02Ar28=; b=N5jT//4iSkI+lMsaku1cZLDoKru6bYQ6hoVV/vX0ehSrySt8+VKU5eNv7pl/nuYRCL S7MafQF2s5+3th4mPNDcSFNc1IlbnAq1TKnJAKyTCWGo1d+1TiAPcplb/HpgYx02REiA 14fF+3QbU9I8ck7hGSxstF7UR21GLQNYgfwHgfTnCrbBHWfKrgLsE4Qn5TZTFnnz8Vsz CJ1ReR0KrxcOT8JAFkuINW7sZQtLXRqc19EdN5jhINhar3TSN9k8uEDr+hCaucy5aVfE +p/paFXfba3lHOIVmUmBlSAsIXqpW1AnhTiNx5k1GtuTbdk6lBGMa8EFLA/sHv/qhUh8 DHfg== 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 e20-20020ad44434000000b0066d1ffebcc7si8170168qvt.470.2023.10.25.02.45.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 02:45:15 -0700 (PDT) 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 AF0DD3857B9B for ; Wed, 25 Oct 2023 09:45:15 +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 ABCD53858D33; Wed, 25 Oct 2023 09:44:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ABCD53858D33 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 ABCD53858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.252 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698227092; cv=none; b=wCFjRedOcNaK+dwr4IzHs665IFZdBIdwkjAn8ksifiuV9YI2EOGgi41XolAlnaVOP5gvE6Di6lQR0wtZH8xgG+BkvC6tidOHQvfUE3mBxNY5dgM4Oa3yD8Mxh477tGqwOQWhmbvCGaILMUPCPgPs2WBHABECavpMefE81OPjjw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698227092; c=relaxed/simple; bh=N+Knh9WYcda8Effl71qRoFjQsLqo93Bc8c/7rNBTofs=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Wbkbb8XsjU8oxgsUp6HHwOK5iEOGHEMgqdB8fjhS6apaab7NLEHZUgs6dkGJNr+8Yin6JdmfjSeDw/d7QN1ftZREUtQH0yORU4vZ7MW8msD3dOSwisxHfTzF5ogYsViH9H7TipR6MR0fMXJAErq04SqnH2LB978uXf/aToZ3UhQ= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: i5FfSJJgTVC3HU3oFYAAew== X-CSE-MsgGUID: c795115zSNuzKY/2RKTyXA== X-IronPort-AV: E=Sophos;i="6.03,250,1694764800"; d="scan'208,223";a="20693682" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 25 Oct 2023 01:44:47 -0800 IronPort-SDR: bIaRFuBPJWSX+5fQINGIpLRyhoZX+p+5GLXX0Nl6yd4vJDBMK8yHIg6OBI9OrTUkI51xM1XWfY yHyStPZxv3JevoGiYtH35sPOtyDnXZ4gJdfRPutywgtZP0hInliVcG5opAaJAM5waORtVBuRI4 ycnhamOZ2uHLIsiLU+TuYz5IrXKw0/QqDL6Ld/C3ZEtTLVe2j8jY8ys5vH5coSLKWMhdSZOvXm 8H2rzjpjOWVXbjp7K4r5qULLPx3GHbnuCFc7Gsbhw/1rEQ5r3X3rvIbYvH3j/sD+klkN4rTIrL ELE= From: Thomas Schwinge To: Chung-Lin Tang , , , Tobias Burnus CC: Catherine Moore Subject: Minor fixes for OpenACC/Fortran 'self' clause for compute constructs (was: [PATCH, OpenACC 2.7] Implement self clause for compute constructs) In-Reply-To: <87pm13w04d.fsf@euler.schwinge.homeip.net> References: <87pm13w04d.fsf@euler.schwinge.homeip.net> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Wed, 25 Oct 2023 11:44:38 +0200 Message-ID: <878r7rvxx5.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780720195904621495 X-GMAIL-MSGID: 1780720195904621495 Hi! On 2023-10-25T10:57:06+0200, I wrote: > With minor textual conflicts resolved, I've pushed this to master branch > in commit 3a3596389c2e539cb8fd5dc5784a4e2afe193a2a > "OpenACC 2.7: Implement self clause for compute constructs", see > attached. > > > I'll then apply/submit a number of follow-on commits. Regarding the Fortran front end changes: > From 3a3596389c2e539cb8fd5dc5784a4e2afe193a2a Mon Sep 17 00:00:00 2001 > From: Chung-Lin Tang > Date: Tue, 13 Jun 2023 08:44:31 -0700 > Subject: [PATCH] OpenACC 2.7: Implement self clause for compute constructs > --- a/gcc/fortran/gfortran.h > +++ b/gcc/fortran/gfortran.h > @@ -1546,6 +1546,7 @@ typedef struct gfc_omp_clauses > gfc_omp_namelist *lists[OMP_LIST_NUM]; > struct gfc_expr *if_expr; > struct gfc_expr *if_exprs[OMP_IF_LAST]; > + struct gfc_expr *self_expr; > struct gfc_expr *final_expr; > struct gfc_expr *num_threads; > struct gfc_expr *chunk_size; ..., this needs to be handled in a few more places, I think... > --- a/gcc/fortran/trans-openmp.cc > +++ b/gcc/fortran/trans-openmp.cc > @@ -6615,6 +6631,8 @@ gfc_split_omp_clauses (gfc_code *code, > /* And this is copied to all. */ > clausesa[GFC_OMP_SPLIT_TARGET].if_expr > = code->ext.omp_clauses->if_expr; > + clausesa[GFC_OMP_SPLIT_TARGET].self_expr > + = code->ext.omp_clauses->self_expr; > clausesa[GFC_OMP_SPLIT_TARGET].nowait > = code->ext.omp_clauses->nowait; > } ..., but this change isn't necessary: that function is for OpenMP only, and generally doesn't (have to) care about OpenACC-only clauses. OK to push the attached "Minor fixes for OpenACC/Fortran 'self' clause for compute constructs", or is anything more needed? Also, I've filed "Missing OpenACC/Fortran handling in 'gcc/fortran/frontend-passes.c'", which applies generally, not just to the OpenACC 'self' clause on compute constructs. Grüße Thomas ----------------- 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 From 943de6d5f1498aabfc343bf5e9dd6c2b63fc55ed Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 20 Oct 2023 15:49:35 +0200 Subject: [PATCH] Minor fixes for OpenACC/Fortran 'self' clause for compute constructs ... to fix up recent commit 3a3596389c2e539cb8fd5dc5784a4e2afe193a2a "OpenACC 2.7: Implement self clause for compute constructs". gcc/fortran/ * dump-parse-tree.cc (show_omp_clauses): Handle 'self_expr'. * openmp.cc (gfc_free_omp_clauses): Likewise. * trans-openmp.cc (gfc_split_omp_clauses): Don't handle 'self_expr'. --- gcc/fortran/dump-parse-tree.cc | 6 ++++++ gcc/fortran/openmp.cc | 1 + gcc/fortran/trans-openmp.cc | 2 -- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc index cc4846e5d74..26391df46e6 100644 --- a/gcc/fortran/dump-parse-tree.cc +++ b/gcc/fortran/dump-parse-tree.cc @@ -1614,6 +1614,12 @@ show_omp_clauses (gfc_omp_clauses *omp_clauses) show_expr (omp_clauses->if_exprs[i]); fputc (')', dumpfile); } + if (omp_clauses->self_expr) + { + fputs (" SELF(", dumpfile); + show_expr (omp_clauses->self_expr); + fputc (')', dumpfile); + } if (omp_clauses->final_expr) { fputs (" FINAL(", dumpfile); diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 2e2e23d567b..5e3cd0570bb 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -163,6 +163,7 @@ gfc_free_omp_clauses (gfc_omp_clauses *c) gfc_free_expr (c->if_expr); for (i = 0; i < OMP_IF_LAST; i++) gfc_free_expr (c->if_exprs[i]); + gfc_free_expr (c->self_expr); gfc_free_expr (c->final_expr); gfc_free_expr (c->num_threads); gfc_free_expr (c->chunk_size); diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 82bbc41b388..00782ee1716 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -6631,8 +6631,6 @@ gfc_split_omp_clauses (gfc_code *code, /* And this is copied to all. */ clausesa[GFC_OMP_SPLIT_TARGET].if_expr = code->ext.omp_clauses->if_expr; - clausesa[GFC_OMP_SPLIT_TARGET].self_expr - = code->ext.omp_clauses->self_expr; clausesa[GFC_OMP_SPLIT_TARGET].nowait = code->ext.omp_clauses->nowait; } -- 2.34.1