public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Julian Brown <julian@codesourcery.com>, <gcc-patches@gcc.gnu.org>
Cc: Tobias Burnus <tobias@codesourcery.com>,
	Kwok Cheung Yeung <kcy@codesourcery.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH 1/4] openacc: Middle-end worker-partitioning support
Date: Wed, 4 Aug 2021 15:13:30 +0200	[thread overview]
Message-ID: <87pmuts685.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <2ef7b2ebaf056858d6484a260c3897f844e2df4a.1614685766.git.julian@codesourcery.com>

Hi!

On 2021-03-02T04:20:11-0800, Julian Brown <julian@codesourcery.com> wrote:
> This patch implements worker-partitioning support in the middle end,
> by rewriting gimple.  [...]

Yay!

Given:

> --- /dev/null
> +++ b/gcc/oacc-neuter-bcast.c

> +/* A map from SSA names or var decls to record fields.  */
> +
> +typedef hash_map<tree, tree> field_map_t;
> +
> +/* For each propagation record type, this is a map from SSA names or var decls
> +   to propagate, to the field in the record type that should be used for
> +   transmission and reception.  */
> +
> +typedef hash_map<tree, field_map_t *> record_field_map_t;
> +
> +static GTY(()) record_field_map_t *field_map;

Per 'gcc/doc/gty.texi': "Whenever you [...] create a new source file
containing 'GTY' markers, [...] add the filename to the 'GTFILES'
variable in 'Makefile.in'.  [...] The generated header file should be
included after everything else in the source file."  Thus:

    --- gcc/Makefile.in
    +++ gcc/Makefile.in
    @@ -2720,2 +2720,3 @@ GTFILES = $(CPPLIB_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
       $(srcdir)/omp-general.h \
    +  $(srcdir)/oacc-neuter-bcast.c \
       @all_gtfiles@
    --- gcc/oacc-neuter-bcast.c
    +++ gcc/oacc-neuter-bcast.c
    @@ -1514 +1514,4 @@ make_pass_oacc_gimple_workers (gcc::context *ctxt)
     }
    +
    +
    +#include "gt-oacc-neuter-bcast.h"

That however results in:

    [...]
    build/gengtype  \
                        -r gtype.state
    warning: structure `field_map_t' used but not defined
    gengtype: Internal error: abort in error_at_line, at gengtype.c:111
    make[2]: *** [Makefile:2796: s-gtype] Error 1
    [...]

I shall try to figure out the right GC annotations to make the 'typedef's
known to the GC machinery (unless somebody can tell me off hand) -- but
actually is this really necessary to allocate as GC memory?

> +void
> +oacc_do_neutering (void)
> +{
> +  [...]
> +  field_map = record_field_map_t::create_ggc (40);
> +  [...]
> +  FOR_ALL_BB_FN (bb, cfun)
> +    {
> +      propagation_set *ws_prop = prop_set[bb->index];
> +      if (ws_prop)
> +     {
> +       tree record_type = lang_hooks.types.make_type (RECORD_TYPE);
> +       [...]
> +       field_map->put (record_type, field_map_t::create_ggc (17));
> +       [...]
> +    }
> +  [...]
> +}

'oacc_do_neutering' is the 'execute' function of the pass, so that means
every time this executes, a fresh 'field_map' is set up, no state
persists across runs (assuming I'm understanding that correctly).  Why
don't we simply use standard (non-GC) memory management for that?  "For
convenience" shall be fine as an answer ;-) -- but maybe instead of
figuring out the right GC annotations, changing the memory management
will be easier?  (Or, of course, maybe I completely misunderstood that?)


Grüße
 Thomas
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  parent reply	other threads:[~2021-08-04 13:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 12:20 [PATCH 0/4] openacc: Worker partitioning in the middle end Julian Brown
2021-03-02 12:20 ` [PATCH 1/4] openacc: Middle-end worker-partitioning support Julian Brown
2021-07-29  7:49   ` [OpenACC] Extract 'pass_oacc_loop_designation' out of 'pass_oacc_device_lower' (was: [PATCH 1/4] openacc: Middle-end worker-partitioning support) Thomas Schwinge
2021-08-06 10:20     ` Julian Brown
2021-08-04 13:13   ` Thomas Schwinge [this message]
2021-08-06  8:49     ` [PATCH 1/4] openacc: Middle-end worker-partitioning support Julian Brown
2021-08-16 10:34       ` Thomas Schwinge
2022-02-22 16:48         ` Further simplify 'gcc/omp-oacc-neuter-broadcast.cc:record_field_map_t' (was: [PATCH 1/4] openacc: Middle-end worker-partitioning support) Thomas Schwinge
2021-08-04 13:56   ` [PATCH 1/4] openacc: Middle-end worker-partitioning support Thomas Schwinge
2021-08-06  9:25     ` Julian Brown
2021-08-09 13:32       ` Thomas Schwinge
2021-08-09 13:21   ` Thomas Schwinge
2021-08-16 10:34   ` Thomas Schwinge
2021-08-16 10:34   ` Thomas Schwinge
2021-03-02 12:20 ` [PATCH 2/4] openacc: Fix async bugs in several OpenACC test cases Julian Brown
2021-03-02 12:20 ` [PATCH 3/4] amdgcn: Enable OpenACC worker partitioning for AMD GCN Julian Brown
2021-08-09 13:26   ` Thomas Schwinge
2021-03-02 12:20 ` [PATCH 4/4] openacc: Reference-typed reduction and private variable rewriting Julian Brown

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=87pmuts685.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=julian@codesourcery.com \
    --cc=kcy@codesourcery.com \
    --cc=tobias@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).