This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 6/n] OpenMP 4.0 offloading infrastructure: option handling


On Sat, Oct 11, 2014 at 06:49:00PM +0400, Ilya Verbin wrote:
> This is the last common infrastructure patch in the series.
> (Next patches will contain tests for libgomp testsuite and MIC specific things)
> 
> It introduces 2 new options:
> 1. -foffload=<targets>=<options>
>    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=<targets>
>   Tells GCC to build offload images for <targets>.
>   They will be built with non-target-specific options passed to host compiler.
> * -foffload=<options>
>   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 <options>.
> * -foffload=<targets>=<options>
>   Tells GCC to build offload images for <targets>.
>   They will be built with non-target-specific options passed to host compiler
>   plus <options>.
> 
> 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.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]