From: "Zhang, Jun" <jun.zhang@intel.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
"ubizjak@gmail.com" <ubizjak@gmail.com>,
"Liu, Hongtao" <hongtao.liu@intel.com>
Subject: RE: [PATCH] x86: set spincount 1 for x86 hybrid platform [PR109812]
Date: Wed, 11 Oct 2023 02:47:56 +0000 [thread overview]
Message-ID: <DM4PR11MB609367F5B9DBD0F6A6B6FC53EACCA@DM4PR11MB6093.namprd11.prod.outlook.com> (raw)
In-Reply-To: <ZSUDysXnTI5nFX5m@tucnak>
> -----Original Message-----
> From: Jakub Jelinek <jakub@redhat.com>
> Sent: Tuesday, October 10, 2023 3:57 PM
> To: Zhang, Jun <jun.zhang@intel.com>
> Cc: gcc-patches@gcc.gnu.org; ubizjak@gmail.com; Liu, Hongtao
> <hongtao.liu@intel.com>
> Subject: Re: [PATCH] x86: set spincount 1 for x86 hybrid platform [PR109812]
>
> On Tue, Oct 10, 2023 at 12:59:52PM +0800, Jun Zhang wrote:
> > include/ChangeLog:
> >
> > * omphook.h: define RUNOMPHOOK macro.
>
> ChangeLog formatting. The description should start with capital letter. If you add
> a new file, you should just mention : New file. or something similar.
>
> But much more importantly, we don't do hooks like that in libgomp, it should be
> better a static inline function where the name shows what it is doing (e.g.
> do_adjust_default_spincount), best in some already existing header (e.g. wait.h),
Sorry, I don't know how to place wait.h. This patch is only for x86.
Wait.h is in libgomp/config/linux/.
if I directly place do_adjust_default_spincount in wait.h,
it maybe need #ifdef __x86_64__, and also need a wait.h in include/
for other os platform.
if I create a new wait.h in libgomp/config/linux/x86/,
It need copy whole wait.h from libgomp/config/linux/,
also need a wait.h in include/ for other os platform.
Could you help me?
> and best at the end of the if (!parse_spincount ("GOMP_SPINCOUNT",
> &gomp_spin_count_var)) block in env.c.
> >
> > libgomp/ChangeLog:
> >
> > * env.c (initialize_env): add RUNOMPHOOK macro.
> > * config/linux/x86/omphook.h: define RUNOMPHOOK macro.
> > ---
> > include/omphook.h | 1 +
> > libgomp/config/linux/x86/omphook.h | 19 +++++++++++++++++++
> > libgomp/env.c | 3 +++
> > 3 files changed, 23 insertions(+)
> > create mode 100644 include/omphook.h
> > create mode 100644 libgomp/config/linux/x86/omphook.h
> >
> > diff --git a/include/omphook.h b/include/omphook.h new file mode
> > 100644 index 00000000000..2ebe3ad57e6
> > --- /dev/null
> > +++ b/include/omphook.h
> > @@ -0,0 +1 @@
> > +#define RUNOMPHOOK()
> > diff --git a/libgomp/config/linux/x86/omphook.h
> > b/libgomp/config/linux/x86/omphook.h
> > new file mode 100644
> > index 00000000000..aefb311cc07
> > --- /dev/null
> > +++ b/libgomp/config/linux/x86/omphook.h
> > @@ -0,0 +1,19 @@
> > +#ifdef __x86_64__
> > +#include "cpuid.h"
> > +
> > +/* only for x86 hybrid platform */
>
> Comments should again start with capital letter and end with dot and 2 spaces
> before */
>
> > +#define RUNOMPHOOK() \
> > + do \
> > + { \
> > + unsigned int eax, ebx, ecx, edx; \
> > + if ((getenv ("GOMP_SPINCOUNT") == NULL) && (wait_policy < 0) \
>
> Spurious ()s around the subcondition, the first shouldn't be tested when placed
> right, if condition doesn't fit on one line, each subcondition should be on separate
> line.
>
> > + && __get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx) \
>
> If we don't have a macro for the CPUID.07H.0H:EDX[15] bit, there should be a
> comment which says what that bit is.
>
> > + && ((edx >> 15) & 1)) \
> > + gomp_spin_count_var = 1LL; \
> > + if (gomp_throttled_spin_count_var > gomp_spin_count_var) \
> > + gomp_throttled_spin_count_var = gomp_spin_count_var; \
>
> The above 2 lines won't be needed if placed right.
>
> Jakub
next prev parent reply other threads:[~2023-10-11 2:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 4:59 Jun Zhang
2023-10-10 7:56 ` Jakub Jelinek
2023-10-11 2:47 ` Zhang, Jun [this message]
2023-10-11 6:27 ` 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=DM4PR11MB609367F5B9DBD0F6A6B6FC53EACCA@DM4PR11MB6093.namprd11.prod.outlook.com \
--to=jun.zhang@intel.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hongtao.liu@intel.com \
--cc=jakub@redhat.com \
--cc=ubizjak@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).