public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thiago at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/99277] C++2a synchronisation is inefficient in GCC 11
Date: Mon, 08 May 2023 19:42:38 +0000	[thread overview]
Message-ID: <bug-99277-4-RUnpZx3VSA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99277-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99277

--- Comment #17 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Thomas Rodgers from comment #16)
> The original implementation came from Olvier Giroux and is part of libc++.
> The libc++ implementation also does not use a type that futex or
> ulock_wait/wake (uint64_t) can handle. I have discussed this in the past
> with Olivier, the choice of char was deliberate on his part. The
> implementation has been tested on a number of platforms (including time on
> ORNL's Summit). 

I remember our discussion on this. But libc++ isn't trying to be optimal and it
never supports direct futex. The fact that they chose this path does not mean
libstdc++ must too.


> The following comment, preserved from libc++ should be
> considered carefully before any change here -
> 
> " 2. A great deal of attention has been paid to avoid cache line thrashing
>     by flattening the tree structure into cache-line sized arrays, that
>     are indexed in an efficient way."
> 
> It is my opinion that the bar for making a change here is high. I would need
> to see benchmark numbers that illustrate the performance differences under
> various contention scenarios vs impact on caches by being able to fit the
> entire tree in a single cache line using char, vs four or eight cache lines
> using the type favored by futex or ulock_wait/wake.

Indeed. My other $DAYJOB involves a lot of cacheline thrashing up to and
including current 480-core machines, so I appreciate the thought there.

In any case, we can't change the design even if we turn up new data showing
that there's benefit or a bottleneck somewhere.

  parent reply	other threads:[~2023-05-08 19:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 23:27 [Bug libstdc++/99277] New: C++2a synchronisation is inefficient in GCC 11 and can't be fixed later thiago at kde dot org
2021-02-26  0:05 ` [Bug libstdc++/99277] " hjl.tools at gmail dot com
2021-02-26  7:22 ` [Bug libstdc++/99277] [11 Regression] " rguenth at gcc dot gnu.org
2021-02-26 12:18 ` jakub at gcc dot gnu.org
2021-02-26 12:52 ` [Bug libstdc++/99277] " redi at gcc dot gnu.org
2021-02-26 19:14 ` [Bug libstdc++/99277] C++2a synchronisation is inefficient in GCC 11 thiago at kde dot org
2021-02-27  2:22 ` ville.voutilainen at gmail dot com
2021-02-27  3:21 ` thiago at kde dot org
2021-04-27 11:40 ` jakub at gcc dot gnu.org
2021-04-27 14:38 ` thiago at kde dot org
2021-04-27 15:40 ` redi at gcc dot gnu.org
2022-05-06  8:30 ` jakub at gcc dot gnu.org
2023-05-08 12:21 ` rguenth at gcc dot gnu.org
2023-05-08 15:15 ` thiago at kde dot org
2023-05-08 16:39 ` redi at gcc dot gnu.org
2023-05-08 18:52 ` thiago at kde dot org
2023-05-08 19:16 ` rodgertq at gcc dot gnu.org
2023-05-08 19:42 ` thiago at kde dot org [this message]
2023-05-08 20:00 ` redi at gcc dot gnu.org
2023-05-08 20:28 ` thiago at kde dot org
2023-05-08 20:52 ` redi at gcc dot gnu.org
2023-05-08 20:55 ` thiago at kde dot org
2023-05-08 21:16 ` redi at gcc dot gnu.org
2023-05-08 23:06 ` rodgertq at gcc dot gnu.org

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=bug-99277-4-RUnpZx3VSA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).