public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Questions about LTO infrastructure and pragma omp target
@ 2013-08-15 13:44 Ilya Verbin
  2013-08-15 15:00 ` Jakub Jelinek
  0 siblings, 1 reply; 25+ messages in thread
From: Ilya Verbin @ 2013-08-15 13:44 UTC (permalink / raw)
  To: jakub, hubicka, rth, kirill.yukhin; +Cc: gcc

Hi All,

I'm trying to figure out how LTO infrastructure works on a high level.
I want to make sure that I understand this correctly.  Could you please
help me with that?

1.  Execution flow.  As far as I understood, there are 2 modes of
operation - with/without LTO plugin.  Below are the execution flows
for each mode.

Without LTO plugin:

gcc -flto      # Call GCC driver
 |_ cc1        # Compile first source file into asm + intermediate language
 |_ as         # Assemble these asm + IL into temporary object file
 |_ ...        # Compile and assemble all remaining source files
 |_ collect2   # Call linker driver
     |_ lto-wrapper    # Call lto-wrapper directly from collect2
     |   |_ gcc        # Driver
     |   |   |_ lto1   # Perform WPA and split into partitions
     |   |_ gcc        # Driver
     |   |   |_ lto1   # Perform LTRANS for the first partition
     |   |   |_ as     # Assemble this partition into final object file
     |   |_ ...        # Perform LTRANS for each partition
     |_ collect-ld     # Simple wrapper over ld
         |_ ld         # Perform linking

Using LTO plugin:

gcc -flto      # Call GCC driver
 |_ cc1        # Compile first source file into asm + intermediate language
 |_ as         # Assemble these asm + IL into temporary object file
 |_ ...        # Compile and assemble all remaining source files
 |_ collect2   # Call linker driver
     |_ collect-ld   # Simple wrapper over ld
         |_ ld with liblto_plugin.so   # Perform LTO and linking
             |_ lto-wrapper    # Is called from liblto_plugin.so
                 |_ gcc        # Driver
                 |   |_ lto1   # Perform WPA and split into partitions
                 |_ gcc        # Driver
                 |   |_ lto1   # Perform LTRANS for the first partition
                 |   |_ as     # Assemble this partition into final object file
                 |_ ...        # Perform LTRANS for each partition

Are they correct?

2.  The second question, regarding #pragma omp target implementation.
I'm going to reuse LTO approach in a prototype, that will produce 2
binaries - for host and target architectures.  Target binary will contain
functions outlined from omp target region and some infrastructure to run
them.
To produce 2 binaries we need to run gcc and ld twice.  At the first run
gcc will generate object file, that contains optimized code for host and
GIMPLE for target.  At the second run gcc will read the GIMPLE and
generate optimized code for target.

So, the question is - what is the right place for the second run of gcc
and ld?  Should I insert them into liblto_plugin.so?  Or should I create
entirely new plugin, that will only call gcc and ld for target, without
performing any LTO optimizations for host?
Suggestions?

----
Thanks,
Ilya Verbin,
Software Engineer
Intel Corporation

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

end of thread, other threads:[~2013-09-19 10:50 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-15 13:44 Questions about LTO infrastructure and pragma omp target Ilya Verbin
2013-08-15 15:00 ` Jakub Jelinek
2013-08-15 19:19   ` Richard Biener
2013-08-23 13:15     ` Ilya Verbin
2013-08-23 14:38       ` Jakub Jelinek
2013-08-28  9:59         ` Basile Starynkevitch
2013-08-23 15:05       ` Richard Biener
2013-08-23 15:06         ` Jakub Jelinek
2013-08-25 22:36           ` Ilya Verbin
2013-08-26  7:32             ` Jakub Jelinek
2013-09-03 14:00               ` Michael V. Zolotukhin
2013-09-03 14:19                 ` Jakub Jelinek
2013-09-03 15:18                   ` Michael V. Zolotukhin
2013-09-03 17:39                     ` Thomas Schwinge
2013-09-03 18:30                       ` Michael V. Zolotukhin
2013-09-03 18:54                         ` Jakub Jelinek
2013-09-03 19:09                           ` Michael V. Zolotukhin
2013-09-16 17:14         ` Ilya Verbin
2013-09-17  8:12           ` Richard Biener
2013-09-17 11:31             ` Ilya Verbin
2013-09-17 11:54               ` Jakub Jelinek
2013-09-17 11:56               ` Richard Biener
2013-09-17 12:15                 ` Jakub Jelinek
2013-09-19 10:45                   ` Ilya Verbin
2013-09-19 10:50                     ` Jakub Jelinek

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