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 48B543857C52 for ; Thu, 24 Sep 2020 09:41:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 48B543857C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: GfDlABRx0fpr7k6fAly84hqjNuDPtGzH5UcrQxw6w12ZwN7DqbzaGuDS/tPEWcuoM0W25mX+zg zpxFyh5zSslIE6gl35RNORbZRbYV7xJ4BRaAw8UElaV+uNymedORTDla9owkdOLA0A0xA2P5bC KFCLC5civieHiLIwh8aQFrDJ62oiBbQPP0uckMfiMZEzXysBYIU6+cV3RD50WFXqinozG10cmc DE4i7Va9WuIXwf2RAkK96yJEEttTR0p/Za6KY7hGIe5zjEef4Ic8c+nWuPiVTRouEGBmZNlWQX +Xk= X-IronPort-AV: E=Sophos;i="5.77,297,1596528000"; d="scan'208";a="55455948" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 24 Sep 2020 01:41:07 -0800 IronPort-SDR: EanHYMCi35cZToBqkCFHoplp8zibhB8IaVOYMtebiIowLAmu9oIAngz1MMzu+Fc2YHIF+s9N31 Vr0Ie17KGtxRzrUuhZeG2aUHWYmBQkk7ftbtE8GIWsFJK7wf5CGTSyXOzKCOvzwvEeTlC46Me2 H/TXibH7UF4SUpIX6H/FTjSSKSOGunUTR57z/ZXbbwxBO65tHBBOGGJj8XjtNmPOJi3oq6Ogbn dGDlKTfFUAtLlv4IFc85H7P7ajlV46MSaxZvna+LrNV4ghxLjNKPA2+MOKgkkpp2dP8vUo9vps M9s= Subject: Re: [Patch] LTO: Force externally_visible for offload_vars/funcs (PR97179) To: Richard Biener , Tobias Burnus CC: gcc-patches , Jakub Jelinek , Jan Hubicka References: <4250958d-f7bf-1a0a-31d2-63eff191b258@codesourcery.com> <0e22d8c5-1008-cad4-c131-57ee3950a73a@codesourcery.com> <26b07ad0-ba42-b2c6-2325-cad7360f8e2c@codesourcery.com> <54a8767f-3cfe-a3ca-6149-0a6d3ee0b6d9@codesourcery.com> From: Tobias Burnus Message-ID: <731ae3cb-847c-6813-0d07-af835a54149c@codesourcery.com> Date: Thu, 24 Sep 2020 11:41:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-08.mgc.mentorg.com (139.181.222.8) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Sep 2020 09:41:10 -0000 On 9/24/20 10:03 AM, Richard Biener wrote: >> The symbols are added to offload_vars + offload_funcs. >> In lto-cgraph.c's output_offload_tables there is the last chance >> to remove now unused nodes ? as once the tables are streamed >> for device usage, they cannot be changed. Hence, there one >> has >> node->force_output =3D 1; >> [Unrelated: this prevents later optimizations, which still >> could be done; cf. PR95622] >> >> >> The table itself is written in omp-offload.c's omp_finish_file. > But this is called at LTRANS time only, in particular we seem > to stream the offload_funcs/vars array, marking streamed nodes > as force_output but we do not make the offload table visible > to the partitioner. But force_output should make the > nodes not renamed. But then output_offload_tables is called at > the very end and we likely do not stream the altered > force_output state. > > So - can you try, in prune_offload_funcs, in addition to > setting DECL_PRESERVE_P, mark the cgraph node ->force_output > so this happens early? I guess the same is needed for > variables (there's no prune_offloar_vars ...). As it accesses global variables, I could do just the same with the variables =E2=80=93 but it did not seems to have an effect. Following Jakub's suggestion, I also added __attribute__((used)) to the tree belonging to both tables in omp-offload.c's omp_finish but that did not help, either. I think both the 'used' and 'force_output' are red herrings: after all, the tables and the referrenced funcs/vars are output; the problem is 'just' that they end up in different ltrans while not being public. =E2=80=93 Thus, some property ia wrong during building the cgraph or when it is partitioned into ltrans. Any additional suggestion to try? Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstra=C3=9Fe 201, 80634 M=C3=BCnch= en / Germany Registergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thomas = Heurung, Alexander Walter