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 15CD6385C338; Fri, 30 Sep 2022 14:43:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 15CD6385C338 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.93,358,1654588800"; d="scan'208,217";a="83805218" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 30 Sep 2022 06:42:59 -0800 IronPort-SDR: drVaCKVIeujX9QOrCTH+2zP5OMsF98xNEgXJOv4nI8gs22P82Vj62CnBmbH89xCJ77YiFfnP1c QNED2bAtka951oAijdS+FX5r9FksqweVqdWP89jCxHRa4Et0nX3NIolxt1XNEaleec95srjfWw M6BKuGnt5+V6E89nH/NeZMfmi1C/qV4QO+ZhV7dK8l+J/Sny9CHGTQIyq6u5L85tT8ZRF4jiMm VsnQHNi+LJY8VThGmoL6r2yuL0udHjxiC+H8fSd9sYlV2iuyc1a/qf7C2cM52sozmrFgrh7ean 5a8= Content-Type: multipart/alternative; boundary="------------2xHauHjXDGlpzhBsK0AwZ50h" Message-ID: <5f95da69-d667-a3df-7d26-45907900e1e0@codesourcery.com> Date: Fri, 30 Sep 2022 16:42:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v3 06/11] OpenMP: Pointers and member mappings Content-Language: en-US To: Julian Brown CC: Jakub Jelinek , , , References: <20220918201929.60a6282e@squid.athome> <20220923082946.321d55f0@squid.athome> <4cb8ef27-5cb0-42d5-2e66-5bf93bd11c48@codesourcery.com> <20220930143022.1cc80cbd@squid.athome> From: Tobias Burnus In-Reply-To: <20220930143022.1cc80cbd@squid.athome> X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,KAM_DMARC_STATUS,NICE_REPLY_A,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 List-Id: --------------2xHauHjXDGlpzhBsK0AwZ50h Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Hi Julian, On 30.09.22 15:30, Julian Brown wrote: i =3D 1; j =3D 2 map (foo(i)%dt_ptr(1:3), foo(j)%dt_ptr) Good catch! In that gfc_dep_resolver considers those terms to have a dependency, and that triggers the mapping node transformation. But I don't think OpenMP allows you to write this: IIUC if "foo" is an array, you're not allowed to separately map two parts of the array because of (OpenMP 5.2, "5.8.3 map Clause"): "Two list items of the map clauses on the same construct must not share original storage unless they are the same list item or unless one is the containing structure of the other." I was thinking of something like: type t integer, pointer :: p(:) end t type(t2) :: var(2) allocate (var(1)%p, source=3D[1,2,3,5]) allocate (var(2)%p, source=3D[2,3,5]) !$omp target map ( ) var(1)%p(1) =3D 5 var(2)%p(2) =3D 7 !$omp end target Similarly for C: struct st { int *p; }; struct st s[2]; s[0].p =3D (int*)__malloc(sizeof(int)*5); s[1].p =3D (int*)__malloc(sizeof(int)*3); #pragma omp target map( ) { s[0].p[0] =3D 5; s[1].p[1] =3D 7; } And now I somehow need to map "p" in both the C and the Fortran case. And I believe that should be possible... and my i =3D 1; j =3D 2 map (var(i)%p(1:3), var(j)%p) or map (s[0].p[:3], s[1].p[:7]) does not look to far fetched to get this result ... 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 --------------2xHauHjXDGlpzhBsK0AwZ50h--