public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/109819] New: [OpenMP][OpenACC] -fno-lto effectively disables offloading
@ 2023-05-11 21:17 burnus at gcc dot gnu.org
  2023-05-11 21:52 ` [Bug middle-end/109819] " jakub at gcc dot gnu.org
  2023-05-11 21:59 ` burnus at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-05-11 21:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109819

            Bug ID: 109819
           Summary: [OpenMP][OpenACC] -fno-lto effectively disables
                    offloading
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: openacc, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

In terms of LTO, the idea is for the link time:
If there is -flto → we know that we should do LTO and, hence, need to check
whether there is some. Without -flto, it might be that there is LTO and with
slim LTO, we may have to handle it.

For that reason, we have the following code in collect2.cc:

#ifdef ENABLE_LTO
static enum lto_mode_d lto_mode = LTO_MODE_WHOPR;
#else
static enum lto_mode_d lto_mode = LTO_MODE_NONE;
#endif
...
        else if (startswith (argv[i], "-fno-lto"))
          lto_mode = LTO_MODE_NONE;
...
    if (use_plugin)
      lto_mode = LTO_MODE_NONE;
    if (no_partition && lto_mode == LTO_MODE_WHOPR)
      lto_mode = LTO_MODE_LTO;


However, this has the unintended side effect that "-fno-lto" also disables
handling the device side of offloading.

* * *

The question is how to handle this. Maybe something along the lines of the
following:


 if (ENABLE_OFFLOADING && lto_mode == LTO_MODE_NONE
     && (-fopenmp || -fopenacc) && !-foffload=disable)
   lto_mode = LTO_MODE_WHOPR;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/109819] [OpenMP][OpenACC] -fno-lto effectively disables offloading
  2023-05-11 21:17 [Bug middle-end/109819] New: [OpenMP][OpenACC] -fno-lto effectively disables offloading burnus at gcc dot gnu.org
@ 2023-05-11 21:52 ` jakub at gcc dot gnu.org
  2023-05-11 21:59 ` burnus at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-11 21:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109819

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, we have to ensure that with -fno-lto linking, even if some or all
compilation units were compiled with -flto we don't actually use the
(non-offloading) LTO sections for the linking.
All we want is if there are any offloading LTO sections to use them regardless
of whether -flto was used or not (and let mkoffload decide whether to actually
compile it and for which offloading targets).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/109819] [OpenMP][OpenACC] -fno-lto effectively disables offloading
  2023-05-11 21:17 [Bug middle-end/109819] New: [OpenMP][OpenACC] -fno-lto effectively disables offloading burnus at gcc dot gnu.org
  2023-05-11 21:52 ` [Bug middle-end/109819] " jakub at gcc dot gnu.org
@ 2023-05-11 21:59 ` burnus at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-05-11 21:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109819

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The not-doing LTO sounds as if we want to handle this by passing some arg that
gets processed in
   lto-plugin/lto-plugin.c's process_option
possibly besides other places that need to be updated.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-11 21:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-11 21:17 [Bug middle-end/109819] New: [OpenMP][OpenACC] -fno-lto effectively disables offloading burnus at gcc dot gnu.org
2023-05-11 21:52 ` [Bug middle-end/109819] " jakub at gcc dot gnu.org
2023-05-11 21:59 ` burnus at gcc dot gnu.org

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).