> 2016-01-13  Martin Liska  <mli...@suse.cz>
>           Martin Jambor  <mjam...@suse.cz>
> 
>       * ipa-hsa.c: New file.
>       * lto-section-in.c (lto_section_name): Add hsa section name.
>       * lto-streamer.h (lto_section_type): Add hsa section.
>       * lto-partition.c: Include "hsa.h"
>       (add_symbol_to_partition_1): Put hsa implementations into the
>       same partition as host implementations.
>       * timevar.def (TV_IPA_HSA): New.
> 
> diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
> index 81a63a5..0a56170 100644
> --- a/gcc/lto/lto-partition.c
> +++ b/gcc/lto/lto-partition.c
> @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3.  If not see
>  #include "ipa-prop.h"
>  #include "ipa-inline.h"
>  #include "lto-partition.h"
> +#include "hsa.h"
>  
>  vec<ltrans_partition> ltrans_partitions;
>  
> @@ -170,6 +171,24 @@ add_symbol_to_partition_1 (ltrans_partition part, 
> symtab_node *node)
>        Therefore put it into the same partition.  */
>        if (cnode->instrumented_version)
>       add_symbol_to_partition_1 (part, cnode->instrumented_version);
> +
> +      /* Add an HSA associated with the symbol.  */
> +      if (hsa_summaries != NULL)
> +     {
> +       hsa_function_summary *s = hsa_summaries->get (cnode);
> +       if (s->m_kind == HSA_KERNEL)
> +         {
> +           /* Add binded function.  */
> +           bool added = add_symbol_to_partition_1 (part,
> +                                                   s->m_binded_function);
> +           gcc_assert (added);
> +           if (symtab->dump_file)
> +             fprintf (symtab->dump_file,
> +                      "adding an HSA function (host/gpu) to the "
> +                      "partition: %s\n",
> +                      s->m_binded_function->name ());
> +         }
> +     }

Do we really need to look that up in the hsa summary? Why these can not be 
partitioned the
usual way?

The patch looks OK for me modulo Jakub's comments.

Honza
>      }
>  
>    add_references_to_partition (part, node);
> diff --git a/gcc/timevar.def b/gcc/timevar.def
> index 2765179..d9a5066 100644
> --- a/gcc/timevar.def
> +++ b/gcc/timevar.def
> @@ -97,6 +97,7 @@ DEFTIMEVAR (TV_WHOPR_WPA_IO          , "whopr wpa I/O")
>  DEFTIMEVAR (TV_WHOPR_PARTITIONING    , "whopr partitioning")
>  DEFTIMEVAR (TV_WHOPR_LTRANS          , "whopr ltrans")
>  DEFTIMEVAR (TV_IPA_REFERENCE         , "ipa reference")
> +DEFTIMEVAR (TV_IPA_HSA                    , "ipa HSA")
>  DEFTIMEVAR (TV_IPA_PROFILE           , "ipa profile")
>  DEFTIMEVAR (TV_IPA_AUTOFDO           , "auto profile")
>  DEFTIMEVAR (TV_IPA_PURE_CONST        , "ipa pure const")

Reply via email to