Hi!

On 2021-03-02T04:20:11-0800, Julian Brown <jul...@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

Reply via email to