This is the mail archive of the gcc@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: [RFC] Target compilation for offloading


Let's suppose, we are going to run target gcc driver from lto-wrapper.
How could a list of offload targets be passed there from option
parser?
In my opinion, the simpliest way to do it is to use environment
variable. Would you agree with such approach?

On Fri, Nov 8, 2013 at 6:34 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Nov 08, 2013 at 06:26:53PM +0400, Andrey Turetskiy wrote:
>> Thanks.
>> And a few questions about compiler options:
>> 1) You've mentioned two options for offloading:
>>     -foffload-target=<set of targets> - to specify targets for offloading
>>     -foffload-target-<target name>=<set of options> - to specify
>> compiler options for different targets
>> Do we really need two options to set up offloading?
>> What do you think about, in my opinion, more compact way:
>>     -foffload-<target name> - if I want to offload for 'target name',
>> but I don't want to specify any options
>>     -foffload-<target-name>=<set of options> - enable offloading for
>> 'target name' and set options
>> And compilation for several targets would look like:
>> gcc -fopenmp -foffload-mic="-O3 -msse -m64" -foffload-ptx
>> -foffload-hsail="-O2 -m32" file.c
>
> I don't think it is a good idea to include the target name before =
> in the name of the option, but perhaps you can use two =s:
> -foffloat-target=x86_64-k1om-linux="-O2 -mtune=foobar' -foffloat-target=ptx-none
>
>> 2) If user doesn't specify target options directly, is target
>> compilation done without any option or compiler uses those host
>> options which are suitable for target?
>
> I think I've said that earlier, non-target specific options from original
> compilation should be copied over, target specific options discarded,
> and the command line supplied overrides appended to that.
>
>> 3) Am I understand right, that options for different targets should be
>> stored in different sections in fat object file, and than lto frontend
>> should read theese options and run target compilation with them?
>
> No, I'd store in the LTO target IL only the original host compilation
> options that weren't target specific (opt* has some flags what is target
> specific and what is not), so say -O2 -ftree-vrp would go there,
> but say -march=corei7-avx would not.  And the -foffload-target= options
> would only matter during linking.
>
>         Jakub



-- 
Best regards,
Andrey Turetskiy


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