Let's check my understanding: 1) We can configure gcc with, say, --offload-target=mic,ptx. It means that after build and install we have 3 compilers: for host, for mic and for ptx. In general case, the number may be less, because one compiler may suit more than one target/host (e.g.when host and one of the targets both x86). All compilers are located together in 'prefix' directory, so host compiler will find target gcc there just by name. 2) Also, we can set option -foffload-target=hsail -B<path to gcc_hsail>. It tells gcc to create offload binary for hsail too, besides mic and ptx we've selected in configure. Hsail compiler should be installed separately and can be found by name in directory we set in '-B' option. If there is no right compiler there and in 'prefix' directory, gcc throws error.
The thing which is not quite clear for me is your way of compiler options ammending. For example, I want to use knc compiler for offload on mic, so target name is something like x86_64-k1om-linux. However, I don't want to select offload target during configuration, I just use compiler option: -foffload-target=x86_64-k1om-linux. How will gcc recognize option like -foffload-target-x86_64-k1om-linux=<set of options> if offload target hasn't been set during configuration? On Tue, Oct 29, 2013 at 1:49 PM, Jakub Jelinek <ja...@redhat.com> wrote: > On Tue, Oct 29, 2013 at 01:33:17PM +0400, Andrey Turetskiy wrote: >> I wonder how compiler is going to choose which target binaries should >> be created for offload? Will compiler make choice on its own or it is >> the user who should add specific options like --offload-target=... >> How does compiler know paths to target compilers? Will it use >> environment variables or paths will be set during compiler >> configuration? > > That needs to be designed. I'd say best would be to allow the default > set of target compilers (if any at all) to be specified during configure, > allow the user to override on the command line and look for the target > compilers using similar mechanism as we use for looking for libraries, > compiler binaries, ld, as etc. in the gcc driver, with possibility to > override it say through GCC specs or -B. Note that also there needs to be > a way to ammend compiler options for the individual targets (already talked > about this earlier in some offloading thread on the mailing list). So, > say if the corresponding host CU is compiled with -O3 -fopenmp -mavx > -mtune=core-avx2, likely you want by default to use -O3 -fopenmp for the > target compilation of the target portion of the CU, but not with the -m* > options, but instead you should be able to specify -mwhatever-else that > is appended after the options copied from the host compilation. > So, I'd like to see that at configure time you specify say that you don't > want any offloading support at all by default, or say mic + ptx (but leave > hsail out), etc., and be able to then say > -foffload-target=mic,hsail -foffload-target-mic=-mbar,-mbaz > -foffload-target-hsail=-mfroboz > (what exact strings to use instead of mic and hsail and ptx I guess depends > on what will be the configuration triplets for those). > > Jakub -- Best regards, Andrey Turetskiy