public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Mohamed Sayed <mohamedsayed22198@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH]: libgompd add parallel handle functions
Date: Mon, 6 Jun 2022 19:34:23 +0200	[thread overview]
Message-ID: <Yp46n0MRb/SJMOXa@tucnak> (raw)
In-Reply-To: <CAKS6CCrNnQbfL-Pa=nAcQ9_mmhcwB93PdAirir3O45MRS8yyeQ@mail.gmail.com>

On Mon, Jun 06, 2022 at 05:13:24PM +0200, Mohamed Sayed via Gcc-patches wrote:
> > 2022-06-06  Mohamed Sayed  <mohamedsayed22198@gmail.com>
> >
> >
> > * Makefile.am: (libgompd_la_SOURCES): Add ompd-parallel.c.

The ChangeLog formatting is wrong.  The above line should be:
	* Makefile.am (libgompd_la_SOURCES): Add ompd-parallel.c.
i.e. tab, * space filename and if there is something in the
file that is being modified, followed by space ( name )
All this then followed by : and description.

> > * Makefile.in: Regenerate.
> > * libgompd.map: Add ompd_get_curr_parallel_handle,
> > ompd_get_enclosing_parallel_handle, ompd_rel_parallel_handle
> > and ompd_parallel_handle_compare symbol versions.

We aren't very consistent on the map files, either it should be
	* libgompd.map (ompd_get_curr_parallel_handle,
	ompd_get_enclosing_parallel_handle, ompd_rel_parallel_handle,
	ompd_parallel_handle_compare): Export at OMPD_5.1.
or
	* libgompd.map (OMPD_5.1): Export ompd_get_curr_parallel_handle,
	ompd_get_enclosing_parallel_handle, ompd_rel_parallel_handle and
	ompd_parallel_handle_compare.

> > * ompd-support.h:() : Add gompd_access (gomp_team_state, team) and
> > gompd_access (gomp_team, prev_ts).

This is totally wrong.
You are modifying the GOMPD_FOREACH_ACCESS macro I think.
So you should say
	* ompd-support.h (GOMPD_FOREACH_ACCESS): Add
	gompd_access (gomp_team_state, team) and
	gompd_access (gomp_team, prev_ts).

> +    return ompd_rc_stale_handle;
> +
> +  CHECK (parallel_handle->ah);
> +
> +  ompd_address_space_context_t *context = parallel_handle->ah->context;  
> +  ompd_address_t symbol_address = parallel_handle->th;
> +  ompd_address_t temp_symbol_address = {OMPD_SEGMENT_UNSPECIFIED, 0};
> +  ompd_word_t temp_offset;
> +  ompd_rc_t ret;
> +
> +  /* get prev_ts offset.  */
> +  GET_VALUE (context, NULL, "gompd_access_gomp_team_prev_ts",
> +  	     temp_offset, temp_offset, target_sizes.sizeof_long_long, 1, ret,
> +             temp_symbol_address);

Formatting.  You can see the two lines are badly indented, each one in
a different wrong way.  The indenting rule is that the lines after the first
one in this case should start aligned below context on the GET_VALUE
line, and each 8 spaces should be replaced by a tab.

> +
> +  symbol_address.address += temp_offset;
> +
> +  /* get team offset.  */
> +  GET_VALUE (context, NULL, "gompd_access_gomp_team_state_team",
> +  	     temp_offset, temp_offset, target_sizes.sizeof_long_long, 1, ret,
> +             temp_symbol_address);

Likewise.
> +
> +  symbol_address.address += temp_offset;
> +
> +  ret = callbacks->read_memory (context, NULL, &symbol_address,
> +                                target_sizes.sizeof_pointer,
> +                                &symbol_address.address);
> +  CHECK_RET (ret); 
> +  ret = callbacks->alloc_memory (sizeof (ompd_parallel_handle_t),
> +                                 (void **) (enc_par_handle));

Why the ()s around enc_par_handle?
Anyway, seems like an aliasing violation, if the callback stores
through void **, then you should just pass it address of a local
void * variable and *enc_par_handle = (ompd_parallel_handle_t) var;

> +ompd_rc_t
> +ompd_rel_parallel_handle (ompd_parallel_handle_t *parallel_handle)
> +{
> +  if (parallel_handle == NULL)
> +    return ompd_rc_stale_handle;
> +
> +  ompd_rc_t ret = callbacks->free_memory ((void *) (parallel_handle));

Likewise (both aliasing and the unnecessary ()s.
>  #define GOMPD_SIZES(gompd_size) \
>    gompd_size (gomp_thread) \
>    gompd_size (gomp_task_icv) \
> -  gompd_size (gomp_task)
> +  gompd_size (gomp_task) 
> +  

Why?

	Jakub


  reply	other threads:[~2022-06-06 17:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-05 23:48 Mohamed Sayed
2022-06-06 15:13 ` Mohamed Sayed
2022-06-06 17:34   ` Jakub Jelinek [this message]
2022-06-06 17:12 ` Jakub Jelinek
2022-06-06 17:32   ` Mohamed Atef
2022-06-06 17:59     ` Jakub Jelinek

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=Yp46n0MRb/SJMOXa@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mohamedsayed22198@gmail.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).