Hi!

On 2020-11-25T15:44:56+0000, Richard Biener <rguent...@suse.de> wrote:
> On Wed, 25 Nov 2020, Jakub Jelinek wrote:
>
>> On Wed, Nov 25, 2020 at 04:30:44PM +0100, Richard Biener wrote:
>> > This fixes the search when configured with --libexecdir=lib64,

(I can't comment on that one specifically, not using this option.)

>> > I've adjusted the bin reference for consistency.
>> >
>> > Testing in progress.  Does this look sensible?
>> >
>> > 2020-11-25  Richard Biener  <rguent...@suse.de>
>> >
>> > libgomp/
>> >    * configure: Regenerate.
>> >    * plugin/configfrag.ac (offload_additional_options): Use
>> >    $(libexecdir) and $(bindir) instead of hard-coding them.
>>
>> LGTM.
>>
>>      Jakub.
>
> Hmm, but $(libexecdir) includes the prefix, thus expands to
> /usr/lib64 for me.

> So what's the tgt_dir used for besides
> populating offload_additional_options?

As far as I can tell, in addition to 'libgomp/plugin/' ('tgt_dir'), as
you've found, the 'path' argument to
'--enable-offload-targets=target=path' is only also used in
'liboffloadmic/plugin/' ('accel_search_dir') to populate search paths
(I'm not familiar with that one in detail).  At least in the libgomp
case, these search paths are (supposed to) only be used for build-tree
testing.

So, it seems this doesn't actually match the description in
'gcc/doc/install.texi':

    @item 
--enable-offload-targets=@var{target1}[=@var{path1}],@dots{},@var{targetN}[=@var{pathN}]
    Enable offloading to targets @var{target1}, @dots{}, @var{targetN}.
    Offload compilers are expected to be already installed.  Default search
    path for them is @file{@var{exec-prefix}}, but it can be changed by
    specifying paths @var{path1}, @dots{}, @var{pathN}.

... which (to me) sounds as if these search paths would apply not only
for build-tree testing, but also for installed usage?


> That said, in this
> very spot not specifying it would work for me I guess,
> historically I have used /usr/nvptx as path for reasons
> I do not remember :/ (newlib is installed in this location)

I too configure/install, for example, the offload compilers into their
own prefix, for example: '[install]/offload-nvptx-none/' instead of
'[install]/' (which would be '/usr' in your case, I suppose), because I
don't like the host and offloading compilers overwrite each others'
files.

For that to work, I then need to set up some symlinks so that the host
compiler can find the 'mkoffload's:

    lto-wrapper: fatal error: could not find accel/nvptx-none/mkoffload in 
[...]/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.0.1/:[...]/install/bin/../libexec/gcc/
 (consider using '-B')

    $ ls -l install/bin/../libexec/gcc/accel/*
    [...] install/bin/../libexec/gcc/accel/amdgcn-amdhsa -> 
../../../offload-amdgcn-amdhsa/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/accel/amdgcn-amdhsa
    [...] install/bin/../libexec/gcc/accel/nvptx-none -> 
../../../offload-nvptx-none/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/accel/nvptx-none
    [...] install/bin/../libexec/gcc/accel/x86_64-intelmicemul-linux-gnu -> 
../../../offload-x86_64-intelmicemul-linux-gnu/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/accel/x86_64-intelmicemul-linux-gnu

(Normally these are found via
'install/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.0.1/' etc., but I want
to avoid the changing version tag ('10.0.1').)

..., and some symlinks so that the 'mkoffload's can find the offload
compilers:

    mkoffload: fatal error: offload compiler 
x86_64-pc-linux-gnu-accel-nvptx-none-gcc not found (consider using '-B')

    $ ls -l install/bin/*-accel-*-gcc
    [...] install/bin/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc -> 
../offload-amdgcn-amdhsa/bin/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc
    [...] install/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc -> 
../offload-nvptx-none/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc
    [...] 
install/bin/x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc -> 
../offload-x86_64-intelmicemul-linux-gnu/bin/x86_64-pc-linux-gnu-accel-x86_64-intelmicemul-linux-gnu-gcc

This is not quite polished, but I still like it better than installing
everying into the same prefix.  (This way, we only add to the host
compiler installation tree the few symlinks cited above; everything else
of the offload compiler installations is separated in
'[install]/offload-[target]'.)

I didn't get around yet to proposing changing GCC to make that the
default mode of installation/operation.  (Why do you/others think?)
(Also, I have not looked up how other distributors are handling this.)


Grüße
 Thomas
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander 
Walter

Reply via email to