From patchwork Fri Oct 24 18:29:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Verbin X-Patchwork-Id: 402935 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 EB661140096 for ; Sat, 25 Oct 2014 05:30:45 +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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=tdcpjUebRKdeS5Buj qCWgHc+atU9GPLwZWKmehHPCvJPbsvz1icPjYtNQZlPWT4OvM4dr/LXBQthiv857 RjrgWd576QNNtJQ6Zz61Uv47a0UeB0meoNCKEIr6fV85o6agHuDpw30o2aZRJwwc 3wOkefj+mFHgMuSXl3H1JnOTiY= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=hXk6ehi+O9+wz/SP9dqaY7y WgDQ=; b=FH19retEbDXKbrtXXbhzqx+Rojk9l6W54CVlHKj1bA8JjQDk+/YWfQU 00Vct5pfkVhIDtMZhtWvb246+i9CLixRUZRjIe4NSePzAmQegO0P8n89mEPNLKgV u3n8M1zyx5851FaUR4zuh1Fdb8Iwnby6VvIaLZQp8q2u5RK9jDJs= Received: (qmail 6023 invoked by alias); 24 Oct 2014 18:30:06 -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 5958 invoked by uid 89); 24 Oct 2014 18:30:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f181.google.com Received: from mail-ie0-f181.google.com (HELO mail-ie0-f181.google.com) (209.85.223.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 24 Oct 2014 18:30:04 +0000 Received: by mail-ie0-f181.google.com with SMTP id y20so2856594ier.40 for ; Fri, 24 Oct 2014 11:30:02 -0700 (PDT) X-Received: by 10.107.131.207 with SMTP id n76mr5896678ioi.34.1414175402286; Fri, 24 Oct 2014 11:30:02 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr04-ext.fm.intel.com. [192.55.55.39]) by mx.google.com with ESMTPSA id e77sm2598457iod.36.2014.10.24.11.29.58 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Oct 2014 11:30:01 -0700 (PDT) Date: Fri, 24 Oct 2014 22:29:50 +0400 From: Ilya Verbin To: Jakub Jelinek Cc: Bernd Schmidt , gcc-patches@gcc.gnu.org, Richard Biener , Thomas Schwinge , Kirill Yukhin , Andrey Turetskiy Subject: Re: [PATCH 6/n] OpenMP 4.0 offloading infrastructure: option handling Message-ID: <20141024182950.GA10017@msticlxl57.ims.intel.com> References: <20141011144900.GA16368@msticlxl57.ims.intel.com> <20141013101909.GT10376@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20141013101909.GT10376@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On 13 Oct 12:19, Jakub Jelinek wrote: > On Sat, Oct 11, 2014 at 06:49:00PM +0400, Ilya Verbin wrote: > > It introduces 2 new options: > > 1. -foffload== > > By default, GCC will build offload images for all offload targets specified > > in configure, with non-target-specific options passed to host compiler. > > This option is used to control offload targets and options for them. > > > > It can be used in a few ways: > > * -foffload=disable > > Tells GCC to disable offload support. > > OpenMP target regions will be run in host fallback mode. > > * -foffload= > > Tells GCC to build offload images for . > > They will be built with non-target-specific options passed to host compiler. > > * -foffload= > > Tells GCC to build offload images for all targets specified in configure. > > They will be built with non-target-specific options passed to host compiler > > plus . > > * -foffload== > > Tells GCC to build offload images for . > > They will be built with non-target-specific options passed to host compiler > > plus . > > > > Options specified by -foffload are appended to the end of option set, so in case > > of option conflicts they have more priority. > > This looks good to me. > > > 2. -foffload-abi=[lp64|ilp32] > > This option is supposed to tell mkoffload (and offload compiler) which ABI is > > used in streamed GIMPLE. This option is desirable, because host and offload > > compilers must have the same ABI. The option is generated by the host compiler > > automatically, it should not be specified by user. > > But I'd like to understand why is this one needed. > Why should the compilers care? Aggregates layout and alignment of > integral/floating types must match between host and offload compilers, sure, > but isn't that something streamed already in the LTO bytecode? > Or is LTO streamer not streaming some types like long_type_node? > I'd expect if host and offload compiler disagree on long type size that > you'd just use a different integral type with the same size as long on the > host. > Different sized pointers are of course a bigger problem, but can't you just > error out on that during reading of the LTO, or even handle it (just use > some integral type for when is the pointer stored in memory, and just > convert to pointer after reads from memory, and convert back before storing > to memory). Erroring out during LTO streaming in sounds just fine to me > though. Here is an additional check. Is the whole 'option handling' patch OK? Thanks, -- Ilya diff --git a/gcc/opts.c b/gcc/opts.c index 9b2e1af..d1a626c 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1732,6 +1732,13 @@ common_handle_option (struct gcc_options *opts, /* Deferred. */ break; +#ifndef ACCEL_COMPILER + case OPT_foffload_abi_: + error_at (loc, "-foffload-abi option can be specified only for " + "offload compiler"); + break; +#endif + case OPT_fpack_struct_: if (value <= 0 || (value & (value - 1)) || value > 16) error_at (loc,