public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Giuliano Belinassi <giuliano.belinassi@usp.br>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Refactor tree-loop-distribution for thread safety
Date: Wed, 13 Nov 2019 14:16:00 -0000	[thread overview]
Message-ID: <CAFiYyc074a3qLYz8AgUmK96r4Arm4+nvy7KnNesT7JOHvBNGxQ@mail.gmail.com> (raw)
In-Reply-To: <20191112133102.rral4n7sg4jsfjl2@smtp.gmail.com>

On Tue, Nov 12, 2019 at 2:31 PM Giuliano Belinassi
<giuliano.belinassi@usp.br> wrote:
>
> Hi, Richard.
>
> On 11/12, Richard Biener wrote:
> > On Sat, Nov 9, 2019 at 3:26 PM Giuliano Belinassi
> > <giuliano.belinassi@usp.br> wrote:
> > >
> > > Hi all,
> > >
> > > This patch refactors tree-loop-distribution.c for thread safety without
> > > use of C11 __thread feature. All global variables were moved to a struct
> > > which is initialized at ::execute time.
> >
> > Thanks for working on this.  I've been thinking on how to make this
> > nicer which naturally leads to the use of C++ classes and member
> > functions which get 'this' for free.  This means all functions that
> > make use of 'priv' in your patch would need to become member
> > functions of the class and pass_loop_distribution::execute would
> > wrap it like
>
> Wouldn't it require that we have one instance of the
> `pass_loop_distribution` class for each thread? I don't know how
> the pass manager would handle this at the current state, but probably
> I will need to patch it in my branch.

I don't mean to re-use pass_loop_distribution itself, just move all
functions as methods into a new separate class you instantiate
at pass_loop_distribution::execute time, so much like your patch
but use 'this' instead of the explicit passing of the structure pointer.

> >
> > unsigned int
> > pass_loop_distribution::execute (function *fun)
> > {
> >   return priv_pass_vars().execute (fun);
> > }
>
>
> >
> > please find a better name for 'priv_pass_vars' since you can't
> > reuse that name for other passes due to C++ ODR rules.
> > I would suggest 'loop_distribution'.
> >
> > Can you try if going this route works well?
>
> Of course :)
>
> >
> > Thanks,
> > Richard.
> >
> > > I can install this patch myself in trunk if it's OK.
> > >
> > > gcc/ChangeLog
> > > 2019-11-09  Giuliano Belinassi  <giuliano.belinassi@usp.br>
> > >
> > >         * cfgloop.c (get_loop_body_in_custom_order): New.
> > >         * cfgloop.h (get_loop_body_in_custom_order): New prototype.
> > >         * tree-loop-distribution.c (struct priv_pass_vars): New.
> > >         (bb_top_order_cmp_r): New.
> > >         (create_rdg_vertices): Update prototype.
> > >         (stmts_from_loop): Same as above.
> > >         (update_for_merge): Same as above.
> > >         (partition_merge_into): Same as above.
> > >         (get_data_dependence): Same as above.
> > >         (data_dep_in_cycle_p): Same as above.
> > >         (update_type_for_merge): Same as above.
> > >         (build_rdg_partition_for-vertex): Same as above.
> > >         (classify_builtin_ldst): Same as above.
> > >         (classify_partition): Same as above.
> > >         (share_memory_accesses): Same as above.
> > >         (rdg_build_partitions): Same as above.
> > >         (pg_add_dependence_edges): Same as above.
> > >         (build_partition_graph): Same as above.
> > >         (merge_dep_scc_partitions): Same as above.
> > >         (break_alias_scc_partitions): Same as above.
> > >         (finalize_partitions): Same as above.
> > >         (distribute_loop): Same as above.
> > >         (bb_top_order_init): New function.
> > >         (bb_top_order_destroy): New function.
> > >         (pass_loop_distribution::execute): Initialize struct priv.
> > >
> > > Thank you,
> > > Giuliano.
>
> Thank you,
> Giuliano.

      reply	other threads:[~2019-11-13 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-09 14:57 Giuliano Belinassi
2019-11-12  9:16 ` Richard Biener
2019-11-12  9:23   ` Andrew Pinski
2019-11-14 22:15     ` [PATCH V2] " Giuliano Belinassi
2019-11-15  9:47       ` Richard Biener
2019-11-18 20:35         ` Giuliano Belinassi
2019-11-12 13:39   ` [PATCH] " Giuliano Belinassi
2019-11-13 14:16     ` Richard Biener [this message]

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=CAFiYyc074a3qLYz8AgUmK96r4Arm4+nvy7KnNesT7JOHvBNGxQ@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=giuliano.belinassi@usp.br \
    /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).