From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 096D53854E4B for ; Fri, 16 Jun 2023 09:13:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 096D53854E4B 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="6.00,247,1681200000"; d="scan'208";a="8993805" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 16 Jun 2023 01:13:27 -0800 IronPort-SDR: BGC1CwwvKqQSOIrZnbQ3NIV7yQo2GA3gS1rNPTDawwJE1aATWxdJT9kZVE3o9WipZE1IHHOi0B drZkhizQRx15lHN2jKyxIbDOmX3+f+QkzJEtnGby5IOgJPKb16Y5MUjnwRQmvzjqwkDfbjNsYe R2WrM0521igqSpbUuLKCnfWkAnpzEzjFPYCAVgrLe6j7UN0RCqsp9QrpmOHudA0OnG/BLU27Y/ X5976ThSpTtl0g3JWzl91WUEgtabSMICLmLOObNhog8WII5Y2wsagMxC2YaPLG6uzTe4lwj3HH apA= From: Thomas Schwinge To: Chung-Lin Tang CC: , Catherine Moore Subject: Re: [PATCH, OpenACC 2.7] Implement host_data must have use_device clause requirement In-Reply-To: <3be2222f-48ae-12a1-a83b-415360e0a506@siemens.com> References: <3be2222f-48ae-12a1-a83b-415360e0a506@siemens.com> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/28.2 (x86_64-pc-linux-gnu) Date: Fri, 16 Jun 2023 11:13:22 +0200 Message-ID: <87legjepn1.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,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 List-Id: Hi Chung-Lin! On 2023-06-06T23:10:37+0800, Chung-Lin Tang wro= te: > this patch implements the OpenACC 2.7 change requiring the host_data cons= truct > to have at least one use_device clause. Thanks! > This patch started out with a simple check during gimplify (much smaller = patch), Heh, thanks for the explanation -- would've been my first question otherweise. ;-) > but turned out that front-ends removed use_device clauses when they have = error, > and the gimplify check started to echo a "no use_device clause" message i= n such > cases, which seem confusing for the user. So ended up adding the check in= each > front-end instead. I presume that's also the reason why you're doing this check before 'c_finish_omp_clauses' etc.? I'll clarify with the OpenACC Technical Committee whether really those diagnostics are intended as "error" or should instead just be "warning". After all, there's no actual problem with an OpenACC 'host_data' without 'use_device' clause (or no data clause on OpenACC 'data', 'enter data', 'exit data', 'update', etc.) -- it's just likely that the user missed something. That is, the OpenACC 2.7: "At least one 'use_device' clause must appear" is addressing the user, not at the implementation (in my current interpretation). Depending on the outcome of that, we can easily adjust GCC. Note for later, independently of your work here: 'c_parser_oacc_enter_exit_data' etc. for its corresponding "has no data movement clause" diagnostic actually does 'c_finish_omp_clauses' etc. first -- maybe that should be changed accordingly. (Actually, I note that it's only OpenACC 3.0 that "Required at least one data clause on a 'data' construct, an 'enter data' directive, or an 'exit data' directive", heh... Per his internal 2014-10-17 email, Cesar implemented the code of 'c_parser_oacc_enter_exit_data' etc. "similar to that of acc update", which indeed already back then did require "At least one 'self', 'host', or 'device' clause". Fortran does have the diagnostic for OpenACC 'update', but it's missing for OpenACC 'enter data', 'exit data' without data clause (have not checked other constructs with similar requirements).) > Tested on powerpc64le-linux/nvptx, x86_64-linux/amdgcn tests in progress = (expect > no surprises). Is this okay for trunk? OK with one small change, please -- unless there's a reason for doing it this way: > --- a/gcc/fortran/trans-openmp.cc > +++ b/gcc/fortran/trans-openmp.cc > @@ -4677,6 +4677,12 @@ gfc_trans_oacc_construct (gfc_code *code) > break; > case EXEC_OACC_HOST_DATA: > construct_code =3D OACC_HOST_DATA; > + if (code->ext.omp_clauses->lists[OMP_LIST_USE_DEVICE] =3D=3D NULL) > + { > + error_at (gfc_get_location (&code->loc), > + "% construct requires % clau= se"); > + return NULL_TREE; > + } > break; > default: > gcc_unreachable (); The OpenMP "must contain at least one [...] clause" checks are done in 'gcc/fortran/openmp.cc:resolve_omp_clauses'. For consistency (or, to let 'gcc/fortran/trans-openmp.cc' continue to just deal with "directive translation"), do similar for OpenACC 'host_data'? (..., and we later accordingly adjust 'gcc/fortran/openmp.cc:gfc_match_oacc_update', too?) Gr=C3=BC=C3=9Fe Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955