From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id CFC0A385625C; Mon, 23 May 2022 09:01:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CFC0A385625C 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.91,246,1647331200"; d="scan'208";a="78889397" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 23 May 2022 01:01:05 -0800 IronPort-SDR: ranT/zfxSqDOHnXmUerI2G2mn2F2AqV5lVJgJjiqt1mVbnJydFua2wZm3sBhCRa9x34LdQ7jpU tREYuhQ2a8mqQxqqELarKOqF792FmrSgBb6hNfo0II2VgFvjnBj3SnRRiOImn0ZC58y63JCFOz kHO6c3XNVj5UYMS5SIxqhYsBsvFk2CIfPys86ss3Z8Rhb6glYHTYl246xIZaW+CaN7wdvP7Drn FZW282k9PjdsJkKdkBmaFdbUM1E6KaqYJP/bMgyME8kqPMtKgUNrkIyJpBXtPlRYKuPvKmh7x3 wx8= Message-ID: Date: Mon, 23 May 2022 11:00:54 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [Patch] OpenMP: Handle descriptors in target's firstprivate [PR104949] Content-Language: en-US To: Jakub Jelinek CC: gcc-patches , fortran 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-09.mgc.mentorg.com (139.181.222.9) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2022 09:01:09 -0000 Hi Jakub, On 19.05.22 15:59, Jakub Jelinek wrote: > I guess ok like this for now, but handling the further deep copy cases > (allocatable members of derived types) wouldn't be very nice, I think > generally we need a target hook to handle the stuff that is target specif= ic > and express it say in further clauses or their modified copies (perhaps s= ome > flags on them, or new clause types) which will allow the pointer attachme= nts > to be done. I concur =E2=80=93 although, the question is how to to it best =E2=80=93 i.= e. what is statically known vs. only known at run time. The current patch requires some in-depth knowledge both of the internal structure (array size) and also the handling= of what is passed to libgomp. But it can be done statically. Thus, I think it is okay to handle this case of firstprivate differently fr= om: For the Fortran patch regarding deep-copying of derived types, it is differ= ent: it is a complicated deeply nested structure and with polymorphic types or recursive types =E2=80=93 or array derived types with allocatable derived c= omponents. In this case, omp-low.cc only calls a three lang hooks and defers most to t= he language hooks. Namely: Has deep copying, how many (run-time determined) - = do a malloc - and last hook: fill the three arrays (data, sizes, kinds). I think that patch can be extended to handle deep firstprivate as well. As = the FE lang hook code controls the data/sizes/kinds array handling, it can also handle the firstprivate bits. (I need at some point to cleanup the patch and submit it piecewise, startin= g with some generic Fortran patches.) (Cross ref: See omp-low.cc changes at https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593562.html) > But eventually it would be nice to have a target hook that emulates the > cross-device copy construction. And we probably need also something to > emulate destruction... Yes =E2=80=93 we also need something for map as OpenMP 5.x (x=3D1 or 2, I f= orgot; to be extended in 6.0) permits more with regards to dynamic types and calling vir= tual functions. (Likewise, but not relevant to mapping: Also dereferencing funct= ion pointers.) The submitted patch was now committed as https://gcc.gnu.org/r13-706-g49d1a2f91325fa8cc011149e27e5093a988b3a49. Thanks for the comments! 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