public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Mohamed Atef <mohamedatef1698@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libgompd: Add OMPD support and global ICV functions
Date: Wed, 18 May 2022 09:34:59 +0200	[thread overview]
Message-ID: <YoSho7SYDaA6oH7t@tucnak> (raw)
In-Reply-To: <CAPFh8NLPf7tcgskDrVvR==wDzUA7g9bELfsSBDfqnH6Y+SuDDg@mail.gmail.com>

On Mon, May 16, 2022 at 07:35:17PM +0200, Mohamed Atef via Gcc-patches wrote:
> libgomp/ChangeLog
> 
> 2022-05-15 Mohamed Atef <mohamedatef1698@gmail.com>
> 
> *config/darwin/plugin-suffix.h (SONAME_SUFFIX): Remove ()s.
> *config/hpux/plugin-suffix.h (SONAME_SUFFIX): Remove ()s.
> *config/posix/plugin-suffix.h (SONAME_SUFFIX): Remove ()s.
> *configure: Regenerate.
> *Makefile.am (toolexeclib_LTLIBRARIES): Add libgompd.la.
> (libgompd_la_LDFLAGS, libgompd_la_DEPENDENCIES,
> libgompd_la_LINK,libgompd_la_SOURCES, libgompd_version_dep,
> libgompd_version_script, libgompd.ver-sun, libgompd.ver,
> libgompd_version_info): New.
> *Makefile.in: Regenerate.
> *aclocal.m4: Regenerate.
> *env.c: Include ompd-support.h.
> (parse_debug): New function.
> (gompd_enabled): New Variable.
> (initialize_env): Call gompd_load.
> (initialize_env): Call parse_debug.
> *team.c: Include ompd-support.h.
> (gomp_team_start): Call ompd_bp_parallel_begin.
> (gomp_team_end): Call ompd_bp_parallel_end.
> (gomp_thread_start): Call ompd_bp_thread_start.
> *libgomp.map: ADD OMP_5.0.3 symbol versions.

Add rather than ADD

> *libgompd.map: New.
> *omp-tools.h.in: New.
> *ompd-types.h.in: New.
> *ompd-support.h: New.
> *ompd-support.c: New.
> *ompd-helper.h: New.
> *ompd-helper.c: New.
> *ompd-init.c: New.
> *ompd-icv.c: New.
> *configure.ac (AC_CONFIG_FILES): Add omp-tools.h and ompd-types.h.

Almost ok, minor comments below.
As I said earlier, as this is just partial implementation of the
OMPD, I think it would be better to commit it to a git branch but
already in the upstream repository, say devel/omp/ompd branch.

Do you have a FSF Copyright assignment on file or do you want to
submit this under DCO (https://gcc.gnu.org/dco.html)?  If the latter,
we need Signed-off-by line in your final patch mail and also in the
commit message.
The commit message should include a one line summary, then
empty line, then explanation what the patch is, followed by properly
formatted ChangeLog entry (the above is badly mangled by your mailer),
there should be 2 spaces around the name etc. and after the ChangeLog
entry the Signed-of-by line if you use DCO.
More details in https://gcc.gnu.org/gitwrite.html
In Authenticated access there is a link to a form to request write
access to the repository, please file it and write me as the sponsor.
Then follow the rest of gitwrite to e.g. do contrib/gcc-git-customization.sh
and then you can git gcc-verify to verify whether the ChangeLog entry in
your commit log is ok before you push it.

> --- /dev/null
> +++ b/libgomp/libgompd.map
> @@ -0,0 +1,23 @@
> +OMPD_5.1 {

Shouldn't this be OMPD_5.0 ?
The functions were already in OpenMP 5.0, weren't they?

> +  global:
> +    ompd_initialize;
> +    ompd_get_api_version;
> +    ompd_get_version_string;
> +    ompd_process_initialize;
> +    ompd_device_initialize;
> +    ompd_rel_address_space_handle;
> +    ompd_finalize;
> +    ompd_enumerate_icvs;
> +    ompd_get_icv_from_scope;
> +    ompd_get_icv_string_from_scope;
> +    ompd_get_thread_handle;
> +    ompd_get_thread_in_parallel;
> +    ompd_rel_thread_handle;
> +    ompd_thread_handle_compare;
> +    ompd_get_thread_id;
> +    ompd_get_device_from_thread;
> +    ompd_bp_thread_begin;
> +    ompd_bp_thread_end;

Why is ompd_bp_thread_{begin,end} here?  I thought they were
in libgomp.so.*, not in libgompd.so.*

> +  local:
> +    *;
> +};

> +  /* NO cuda for now.  */

We support other kinds of offloading, so better just say
  /* No offloading support for now.  */
or so.

> +  if (device == OMPD_DEVICE_KIND_HOST)
> +    {
> +      switch (icv_id)
> +	{
> +	  case gompd_icv_cancellation_var:
> +	    return
> +	      gompd_get_cancellation ((ompd_address_space_handle_t *) handle,
> +				      icv_value);
> +	  case gompd_icv_max_task_priority_var:
> +	    return gompd_get_max_task_priority ((ompd_address_space_handle_t *)
> +						handle, icv_value);
> +	  case gompd_icv_stacksize_var:
> +	    return gompd_get_stacksize ((ompd_address_space_handle_t *) handle,
> +					icv_value);

You use that overly long (ompd_address_space_handle_t *) handle in all the
spots and it causes various formatting issues.  Wouldn't it be better
to add some temporary variable above the switch
      ompd_address_space_handle_t *whatever
	= (ompd_address_space_handle_t *) handle;
(for some good choice of name) and then just use it instead of
(ompd_address_space_handle_t *) handle which would allow always writing
	    return gompd_whatever (whatever, icv_value);
and not the uglier return with call on the next line, or even worse ( on
a different line from the function name?

> +ompd_rc_t
> +ompd_finalize ()

Please use (void) instead of ()

> +void
> +gompd_load ()

Likewise.

> +void __attribute__ ((noipa))
> +ompd_dll_locations_valid ()

Likewise (and several times more).

	Jakub


  reply	other threads:[~2022-05-18  7:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 17:35 Mohamed Atef
2022-05-18  7:34 ` Jakub Jelinek [this message]
2022-05-18 12:10   ` Mohamed Atef
2022-05-18 12:41     ` Mohamed Atef
2022-05-18 12:43     ` Jakub Jelinek
2022-05-18 12:55       ` Mohamed Atef
2022-05-18 13:06         ` Mohamed Atef

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=YoSho7SYDaA6oH7t@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mohamedatef1698@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).