public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Jakub Jelinek <jakub@redhat.com>,
	Sandra Loosemore <sandra@codesourcery.com>
Cc: Richard Biener <rguenther@suse.de>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	 Thomas Schwinge <thomas@codesourcery.com>
Subject: Re: [Patch] Add 'default' to -foffload=; document that flag [PR67300]
Date: Thu, 17 Jun 2021 21:28:00 +0200	[thread overview]
Message-ID: <07d9e298-55d0-0e80-84f5-5d5d75c9e341@codesourcery.com> (raw)
In-Reply-To: <20210617175054.GI7746@tucnak>

On 17.06.21 19:50, Jakub Jelinek wrote:

> On Thu, Jun 17, 2021 at 11:41:39AM -0600, Sandra Loosemore wrote:
>> I think it would useful to add an example with a target list and
>> multiple options since I think the syntax looks pretty hairy.

I fully concur that -foffload= is a mess trying to achieve too many
things at the same time. [Hence, I kept rephrasing the description
without reaching a good wording.]

In terms of real-world usage, I think something like the following
covers all real-world needs:

-foffload=disable
-foffload=-latomic -foffload=-lm
-foffload="-lgfortran -lm" -foffload=nvptx-none=-latomic
-foffload=-lm -foffload=nvptx-none=-latomic -foffload=amdgcn-amdhsa=-march=gfx906
-foffload=-fdump-tree-all

Possibly with -foffload=default added to item 3 + 4, but cf. below.

>> Hmmm, I had started to put together some comments on
>> grammar/punctuation/markup on the first version before the second iteration
>> showed up in my mailbox, but more critically I could not figure out whether
>> -foffload=default is supposed to be exactly identical to the default
>> behavior; if it isn't, it should be, or -foffload=default ought to be
>> renamed.  So let's get that sorted out first.  I suggest reorganizing the
> Yeah.  If we want for --enable-offload-default also all configured targets,
> we could add another keyword for it (all), but I'm not sure it would be
> useful, because whenever it would be different from default it would mean
> the linking would fail because one or more offloading targets that were
> configured isn't supported (installed).

I am not sure whether I fully agree with this or not. However:

Let's propose something radical, which probably won't break any real-world
code, avoids the need to add a new -foffload=<something> keyword and is
also intuitive to the user:

* -foffload=<target triplet list>=-option

Suggestion: This no longer affects the list of enabled targets. As by default
all targets are enabled, this one will (kept) be(en) enabled (but might
silently fail if the target lto1 is not installed).

* -foffload=disable  and -foffload=<triplet-list>

This is the only way to modify the list of supported offload devices to those
specified. By adding a triplet explicitly, it will give an error via lto1.

That will solve all issues, possibly except for
   -foffload=-lm -foffload=nxpt-none=-latomic -foffload=amdgcn-amdhsa
some might find it surprising that nvptx offloading will be disabled,
but others might find it natural.


Hence: Do you think this change makes sense? It looks somewhat consistent,
avoids a new -foffload=<something> flag etc.?
It also would solve the testsuite issue without needing to add
a new flag and a comment explaining why the flag is needed.


What do you think? It breaks backward compatibility, but I am not
sure anyone way relying on the current behavior.

   * * *

Compared to the current version, I would also give an error if
  -foffload=<list>
contains 'disable' and any other target entry (including 'disable')
and for '-foffload=disable=<options> – as both does not make any sense.

This does not really change the semantic but avoids odd code.


-foffload=<triplet list> will then restrict it to certain
targets & by specifying them explicitly, lto1 will still give
an error when not available.

> And similarly figure out what happens with the optional flags, if they are
> gathered from all the -foffload= options that refer to a particular target,
> or taken from the last -foffload option that mentions that target, something
> else.

Currently,
   -foffload=-lm -foffload=nvptx-none=-latomic -foffload=-lgfortran
works, taking the arguments "-lm -lgfortran" for all but nvptx-none
and "-lm -latomic -lgfortran" for nvptx-none. I think this really needs
to continue to work.

Tobias

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf

  reply	other threads:[~2021-06-17 19:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 12:08 Tobias Burnus
2021-06-17 12:27 ` Jakub Jelinek
2021-06-17 16:03   ` Tobias Burnus
2021-06-17 17:41     ` Sandra Loosemore
2021-06-17 17:50       ` Jakub Jelinek
2021-06-17 19:28         ` Tobias Burnus [this message]
2021-06-17 19:40           ` Jakub Jelinek
2021-06-17 21:57             ` Sandra Loosemore
2021-06-17 23:05               ` Tobias Burnus
2021-06-18 22:47                 ` Sandra Loosemore
2021-06-28 11:28                   ` Tobias Burnus
2021-06-28 15:51                     ` Tobias Burnus
2021-06-28 22:34                       ` Sandra Loosemore
2021-06-29 11:58                       ` Jakub Jelinek
2021-06-29 13:47                         ` Tobias Burnus
2021-06-29 13:51                           ` Jakub Jelinek
2021-06-29 20:47                           ` Rainer Orth
2021-06-29 21:02                             ` Christophe Lyon
2021-06-30 20:12                             ` Rainer Orth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07d9e298-55d0-0e80-84f5-5d5d75c9e341@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    --cc=sandra@codesourcery.com \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).