From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 87710384B13C for ; Thu, 24 Sep 2020 09:50:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 87710384B13C Received: by mail-ed1-x536.google.com with SMTP id b12so2686984edz.11 for ; Thu, 24 Sep 2020 02:50:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=mJabHhqpYWgu/geGFIraLIADgRz6CTsAZPCgc4qeAsU=; b=l4Ak0A/tJBmOj3lDGplzZEbjMmMlOMYJTj0IKnZTbq1MZq85mTarZ+0jK5LEROJ3Aa /8T/EwydlZ9VYa/hZIQpGsZengdyZJko+kETKwOT5ucKGebsUQo5QhYs5m//7kLwnDur zpj4kkabA0VU+wrE1jxDEgfqMTWGvzVtLUXyQUNpO7nF7HzGu4H75nyPwKry8zTJn5Ia A3SoAwQ98/RxYj0MXvx3mRbM339qjOj3iG1yRio9+PHyi4fD/ZXHcjxXsL07dyBbvmPM ep/VeOi08pnXMl6ZoiDpc+6PJ0rglGtMG/zepdajpPFMvApzuh5UpU0MkyU7jN6ky5gw ZPjA== X-Gm-Message-State: AOAM532i3wD0n944t+DU5aVjBvf3Z0ZwvYkpNG3qEuiDbToDp/E7hSNh zXnIAPjUV84L2E1hsQF3V+Gn0lgJa1MmRds1yI8= X-Google-Smtp-Source: ABdhPJwriNSJqFS/yfsrR2wzeixWZzv6Y9S5pE9nEP2KKjiT2wNVsoc0GRT3lM3e+kW6Xa0qMkrDoak91mqkjJ0cbjs= X-Received: by 2002:aa7:c308:: with SMTP id l8mr81453edq.361.1600941044597; Thu, 24 Sep 2020 02:50:44 -0700 (PDT) MIME-Version: 1.0 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> <731ae3cb-847c-6813-0d07-af835a54149c@codesourcery.com> In-Reply-To: <731ae3cb-847c-6813-0d07-af835a54149c@codesourcery.com> From: Richard Biener Date: Thu, 24 Sep 2020 11:50:33 +0200 Message-ID: Subject: Re: [Patch] LTO: Force externally_visible for offload_vars/funcs (PR97179) To: Tobias Burnus Cc: Richard Biener , Jakub Jelinek , gcc-patches , Jan Hubicka Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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:50:46 -0000 On Thu, Sep 24, 2020 at 11:41 AM Tobias Burnus wr= ote: > > 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? As I said the table itself is only created _after_ partitioning so LTO doesn't see they are referenced from outside of their LTRANS unit (in the unit that has the offload table). I think we need to create the offload table during WPA instead. Richard. > Tobias > > ----------------- > Mentor Graphics (Deutschland) GmbH, Arnulfstra=C3=9Fe 201, 80634 M=C3=BCn= chen / Germany > Registergericht M=C3=BCnchen HRB 106955, Gesch=C3=A4ftsf=C3=BChrer: Thoma= s Heurung, Alexander Walter