From patchwork Thu Nov 20 12:27:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 412674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2FC00140142 for ; Thu, 20 Nov 2014 23:27:19 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=AktT0iO+JTicw1RTI ixvJp6EjvltYXDAGSFDhZjXnh4Z3ZESFJ5HnLJfeYLzerxEILXJnbJVMDQl6etzI FlNfkgo8rJoru19UqqEHG0bFx60lSo7EGff2BvA6a9CEKJ5sgb3Lz0SbFodzKxUN mx83dydEE7+DwwENFi9Bmn5+TU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=G1I5Ah5rN/e1nYma1TKDQuJ SwmM=; b=n7viXQ3drMSWa9PKPZntEwRPA4O4honIYGhdBHxFWVz9luuK3xTjrsb dRPtHty9ZV2SWKADvM2gPjjVndCe58v8+I3chwQowyImlvksNcnceF8jcE/W7vUO PAaILW3GG/ZThExO1swCMs8PIogFEWagWC0QERBBP7pVpKMKxqno= Received: (qmail 13402 invoked by alias); 20 Nov 2014 12:27:11 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 13382 invoked by uid 89); 20 Nov 2014 12:27:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout02.t-online.de Received: from mailout02.t-online.de (HELO mailout02.t-online.de) (194.25.134.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 20 Nov 2014 12:27:08 +0000 Received: from fwd23.aul.t-online.de (fwd23.aul.t-online.de [172.20.26.128]) by mailout02.t-online.de (Postfix) with SMTP id B726D60ACB8; Thu, 20 Nov 2014 13:27:03 +0100 (CET) Received: from [192.168.2.104] (Gh+P-UZp8hUwOdWsV42ikMq5pOnfN2ye90AmlZ8OERNHF1-gNHi9XfA+BbeMa5oQjT@[91.52.10.27]) by fwd23.t-online.de with (TLSv1:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1XrQpC-1woWEi0; Thu, 20 Nov 2014 13:27:02 +0100 Message-ID: <546DDE1C.6060203@t-online.de> Date: Thu, 20 Nov 2014 13:27:08 +0100 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.8.0 MIME-Version: 1.0 To: Jan Hubicka , gcc-patches@gcc.gnu.org, rguenther@suse.de, neil@daikokuya.co.uk, joseph@codesourcery.com, Thomas Schwinge , Julian Brown , Cesar Philippidis Subject: Re: LTO streaming of TARGET_OPTIMIZE_NODE References: <20141113040652.GB1984@kam.mff.cuni.cz> In-Reply-To: <20141113040652.GB1984@kam.mff.cuni.cz> X-IsSubscribed: yes On 11/13/2014 05:06 AM, Jan Hubicka wrote: > this patch adds infrastructure for proper streaming and merging of > TREE_TARGET_OPTION. This breaks the offloading path via LTO since it introduces an incompatibility in LTO format between host and offload machine. A very quick patch to fix it is below - the OpenACC testcase I was using seems to be working again with this. Thoughts, suggestions? Bernd diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index be041e9..3c4b8c9 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -65,7 +65,7 @@ along with GCC; see the file COPYING3. If not see #include "streamer-hooks.h" #include "cfgloop.h" #include "builtins.h" - +#include "lto-section-names.h" static void lto_write_tree (struct output_block*, tree, bool); @@ -944,7 +944,9 @@ hash_tree (struct streamer_tree_cache_d *cache, hash_map *map, hstate.add (TRANSLATION_UNIT_LANGUAGE (t), strlen (TRANSLATION_UNIT_LANGUAGE (t))); - if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)) + if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION) + /* We don't stream these when passing things to a different target. */ + && strcmp (section_name_prefix, LTO_SECTION_NAME_PREFIX) == 0) hstate.add_wide_int (cl_target_option_hash (TREE_TARGET_OPTION (t))); if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION)) diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index a2a2382..88d36d3 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -514,8 +514,10 @@ unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr) vec_safe_grow (CONSTRUCTOR_ELTS (expr), length); } +#ifndef ACCEL_COMPILER if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)) cl_target_option_stream_in (data_in, bp, TREE_TARGET_OPTION (expr)); +#endif if (code == OMP_CLAUSE) unpack_ts_omp_clause_value_fields (data_in, bp, expr); @@ -779,7 +781,9 @@ lto_input_ts_function_decl_tree_pointers (struct lto_input_block *ib, DECL_VINDEX (expr) = stream_read_tree (ib, data_in); /* DECL_STRUCT_FUNCTION is loaded on demand by cgraph_get_body. */ DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in); +#ifndef ACCEL_COMPILER DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in); +#endif DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = stream_read_tree (ib, data_in); /* If the file contains a function with an EH personality set, diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c index b959454..fca101e 100644 --- a/gcc/tree-streamer-out.c +++ b/gcc/tree-streamer-out.c @@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-streamer.h" #include "data-streamer.h" #include "streamer-hooks.h" +#include "lto-section-names.h" /* Output the STRING constant to the string table in OB. Then put the index onto the INDEX_STREAM. */ @@ -463,7 +464,9 @@ streamer_pack_tree_bitfields (struct output_block *ob, if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)) bp_pack_var_len_unsigned (bp, CONSTRUCTOR_NELTS (expr)); - if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)) + if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION) + /* Don't stream these when passing things to a different target. */ + && strcmp (section_name_prefix, LTO_SECTION_NAME_PREFIX) == 0) cl_target_option_stream_out (ob, bp, TREE_TARGET_OPTION (expr)); if (code == OMP_CLAUSE) @@ -678,7 +681,9 @@ write_ts_function_decl_tree_pointers (struct output_block *ob, tree expr, stream_write_tree (ob, DECL_VINDEX (expr), ref_p); /* DECL_STRUCT_FUNCTION is handled by lto_output_function. */ stream_write_tree (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p); - stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p); + /* Don't stream these when passing things to a different target. */ + if (strcmp (section_name_prefix, LTO_SECTION_NAME_PREFIX) == 0) + stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p); stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr), ref_p); }