From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 7987E3858C54 for ; Tue, 17 Oct 2023 14:41:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7987E3858C54 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 7987E3858C54 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=1697553685; cv=none; b=U9trMB2piSJi1ArVpDclnZzdYJvYMTTZmx93Jx0DDaJqcSdiLfVLfzl1vNedYIIzpPP+ly4KpyBfG/fszSQbhAXQdsEvxvmy/OWWKMBxzgjGsXrwFyvRxXLahs/AOnnrZqHg3ngdNi843Tf62AAFUgnHY/JMG7EKo+XrTPoQyvc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697553685; c=relaxed/simple; bh=0FrzFTINli03Z2S18LF2vxdChMaEctE6b4meJD9wTH0=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=BDvOmg1Oc7u0YPmKaLXefk82xQNzD4W320h3wHUazt2jmu4ZoYDm0D6Sj0L3IdKtEcHtDWoIels2j/qvrFY8MkznD4okGDS/Ai4GJpHGH78g4mZlUFiv0MUaeQ06YAj30MS85w1Ft7qpGhy/u+7POpF+jHShyo5fWYyPMheHXyY= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: +CyiC8y6Qf6+otGDJtxKQg== X-CSE-MsgGUID: VV2IHNBsQou8EpfxJT/qTA== X-IronPort-AV: E=Sophos;i="6.03,232,1694764800"; d="scan'208";a="19872904" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 17 Oct 2023 06:41:22 -0800 IronPort-SDR: r7WGOIE5WnpVcUAiz5+4hbauhZWGSDq3I8K6RQMFVbyDkOH0sb35/De2SHi7w2lRj7WQhO77Xd ob7IaOhd+BCpnnv04ZgFhlH6imCuWFyK1ZJXjJrIhdULMFEd1ujThlOOeMrQyJlr9wlyc2VLnr Vwpp4TZx9vJ8preugyqHI7oypxjrztLZr6d9LxU8112d5eylzie3JbzqAHIRePrVFfuDLWdMfd POUaWiZJOx5DVNGV1LJCyY3XpNOD0HnFPqN3B8yYgSXePs3Sum2782GJ/5kVfmVQRfwmxV7ovL Kdw= Message-ID: <9e787677-97fb-48ee-97d1-c4b0d502a84f@codesourcery.com> Date: Tue, 17 Oct 2023 16:41:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] openmp: Add support for the 'indirect' clause in C/C++ Content-Language: en-US To: Jakub Jelinek , Tobias Burnus CC: Kwok Cheung Yeung , gcc-patches References: From: Tobias Burnus In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP 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: On 17.10.23 15:34, Jakub Jelinek wrote: > On Tue, Oct 17, 2023 at 03:12:46PM +0200, Tobias Burnus wrote: >> C++11 (and C23) attribute do not seem to be properly handled: >> >> [[omp::decl (declare target,indirect(1))]] >> int foo(void) { return 5; } >> [[omp::decl (declare target indirect)]] >> int bar(void) { return 8; } > Isn't that correct? No it isn't. Following your argument below, the following is violated: "If the directive has a clause, it must contain at least one enter clause, link clause, or local clause." (OpenMP before 5.2 had 'to' instead of 'enter' and 5.2 had 'enter' with 'to' as alias.) And the clause above does not have those. Alternatively permitted is: "If the extended-list argument is specified, no clauses may be specified." But that cannot be the case as the "indirect" clause has been specified. * * * > Declare target directive has the forms > declare target (list) > declare target > declare target clauses > The first form is essentially equivalent to declare target enter (list), > the second to begin declare target with no clauses. > Now, > [[omp::decl (declare target)]] int v; > matches the first form and so enter (v) clause is implied. > But say > [[omp::decl (declare target, device_type (any))]] int v; > is the third type and so nothing is implied, so it is equivalent to > int v; I have to admit that I failed to read 'omp::decl()' in the spec before trying it. The TR11 spec states: "A declarative directive that is declaration-associated may alternatively be expressed as an attribute specifier where directive-attr is dec( directive-specification "A declarative directive with an association of none that accepts a variable list or extended list as a directive argument or clause argument may alternatively be expressed with an attribute specifier that also uses thedeclattribute, applies to variable and/or function declarations, and omits the variable list or extended list argument. The effect is as if the omitted list argument is the list of declared variables and/or functions to which the attribute specifier applies." ('declare target' is a bit odd as it either accept a variable list or supports a form where a clause accepts a variable list, which is confusing.= ) > #pragma omp declare target device_type (any) > Don't remember if that is supposed to be an error or just not do anything > because there is no enter or to or link clause. That's invalid per the restriction above - well, except for the delimited form, which permits 'indirect' and 'device_type' as only clauses. But that does not apply here as the association with 'omp::decl' must be none (i.e. 'delimited' is not permitted). > So, I think if you want to make foo indirect, the above would have to be: > [[omp::decl (declare target,enter,indirect(1))]] > int foo(void) { return 5; } I concur - and admit that I missed the 'enter'. Still, there is an issue as the restriction is not checked for. Same with: #pragma omp declare target indirect (invalid but accepted) while #pragma omp declare target device_type(any) indirect fails with: "error: directive with only =E2=80=98device_type=E2=80=99 claus= e". The error due to 'device_type' is no longer completely correct as I would count 'indirect' as another directive. Tobias ----------------- 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