From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Thiago Macieira <thiago.macieira@intel.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
Thomas Rodgers <trodgers@redhat.com>,
Jonathan Wakely <jwakely@redhat.com>
Subject: Re: C++2a synchronisation inefficient in GCC 11
Date: Fri, 26 Feb 2021 11:19:02 +0000 [thread overview]
Message-ID: <CAH6eHdRsci92G9s-DgxS7-x8MZMdPtK=eh76OENj8dGoaKE8Mw@mail.gmail.com> (raw)
In-Reply-To: <1968544.UC5HiB4uFJ@tjmaciei-mobl1>
On Thu, 25 Feb 2021 at 23:28, Thiago Macieira via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Hello all
>
> I was investigating the implementation of std::atomic<T>::wait to use inside
> my own code (Qt's QMutex and QSemaphore), when I realised that it has
> huge inefficiencies. Since everything in this implementation is inline and,
> once released, it will tie our hands until the next ABI break (libstdc++.so.
That's not true. By not committing to exporting these symbols from
libstdc++.so now, we can move them into the library later once the
design is stable.
C++20 support is experimental and not stable. If you compile it with
GCC 11 you can't expect to link it to C++20 code compiled with GCC 12.
So for GCC 12 (or a later version) we could replace the inline
functions with non-inline code in libstdc++.so and commit to that
being stable.
So actually this gives us more freedom to change it later.
> 7). And no, inline namespaces and ABI tags are no different than ABI breaks,
> they only make the ABI break more or less silent in the process.
>
> Here's a summary of the findings:
>
> 1) everything is inline
> 2) futex code is still behind a lot of code calling into std::_Hash_bytes
> 3) other int-sized (incl. enums) atomics don't use futex
Yup, including unsigned ints, and longs on ILP32 targets.
> 4) std::latch and std::counting_semaphore defaults preclude from using
> futex on Linux
Yes, I've suggested that we should use INT_MAX (or maybe UINT_MAX) as
the default, so they fit in the futex range.
I'm not working today, so I'll read the rest and respond to the test
another time.
tl;dr this code is experimental and expected to change, so is inline
for a reason.
next prev parent reply other threads:[~2021-02-26 11:19 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-25 22:50 Thiago Macieira
2021-02-26 11:19 ` Jonathan Wakely [this message]
2021-02-26 17:37 ` Thiago Macieira
2021-02-26 18:29 ` Jonathan Wakely
2021-02-26 19:30 ` Ville Voutilainen
2021-02-26 21:17 ` Jonathan Wakely
2021-02-26 21:18 ` Ville Voutilainen
2021-02-26 21:39 ` Jonathan Wakely
2021-02-26 18:47 ` Ville Voutilainen
2021-02-26 23:53 ` Thiago Macieira
2021-02-26 23:58 ` Ville Voutilainen
2021-02-27 0:11 ` Thiago Macieira
2021-02-27 0:18 ` Ville Voutilainen
2021-02-27 0:36 ` Thiago Macieira
2021-02-27 0:44 ` Ville Voutilainen
2021-02-27 0:53 ` Thiago Macieira
2021-02-27 1:03 ` Ville Voutilainen
2021-03-03 14:30 ` Jonathan Wakely
2021-03-03 17:07 ` Thiago Macieira
2021-03-03 17:14 ` Jonathan Wakely
2021-02-27 0:22 ` Marc Glisse
2021-02-27 0:30 ` Ville Voutilainen
2021-02-27 0:43 ` Thiago Macieira
2021-03-03 14:24 ` Jonathan Wakely
2021-03-03 17:12 ` Thiago Macieira
2021-02-26 15:59 ` [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int Thiago Macieira
2021-02-26 15:59 ` [PATCH 2/5] Atomic __platform_wait: accept any 32-bit type, not just int Thiago Macieira
2021-03-03 14:34 ` Jonathan Wakely
2021-03-03 16:21 ` Jonathan Wakely
2021-03-03 17:27 ` Thiago Macieira
2021-03-03 17:34 ` Ville Voutilainen
2021-03-03 17:41 ` Jonathan Wakely
2021-02-26 15:59 ` [PATCH 3/5] std::__atomic_wait: don't use __detail::__waiter with futex Thiago Macieira
2021-02-26 15:59 ` [PATCH 4/5] barrier: use int instead of unsigned char for the phase state Thiago Macieira
2021-02-28 15:05 ` Hans-Peter Nilsson
2021-03-01 16:28 ` Thomas Rodgers
2021-03-01 17:24 ` Thiago Macieira
2021-03-01 17:38 ` Thomas Rodgers
2021-03-01 17:40 ` Thomas Rodgers
2021-03-01 18:06 ` Thiago Macieira
2021-03-01 19:08 ` Thomas Rodgers
2021-03-01 18:12 ` Ville Voutilainen
2021-03-01 19:44 ` Thiago Macieira
2021-03-01 20:35 ` Ville Voutilainen
2021-03-01 21:54 ` Thiago Macieira
2021-03-01 22:04 ` Ville Voutilainen
2021-03-01 22:21 ` Thiago Macieira
2021-03-01 22:31 ` Ville Voutilainen
2021-03-01 22:40 ` Thiago Macieira
2021-02-26 15:59 ` [PATCH 5/5] barrier: optimise by not having the hasher in a loop Thiago Macieira
2021-03-03 14:36 ` Jonathan Wakely
2021-02-26 18:14 ` [PATCH 1/5] std::latch: reduce internal implementation from ptrdiff_t to int Andreas Schwab
2021-02-26 19:08 ` Thiago Macieira
2021-02-26 19:31 ` Andreas Schwab
2021-02-27 0:13 ` Thiago Macieira
2021-02-28 21:31 ` Hans-Peter Nilsson
2021-03-01 8:56 ` Richard Biener
2021-03-03 14:56 ` Jonathan Wakely
2021-03-03 15:02 ` Andreas Schwab
2021-03-03 15:10 ` Jonathan Wakely
2021-03-03 15:37 ` Hans-Peter Nilsson
2021-03-01 16:32 ` Thomas Rodgers
2021-03-03 14:34 ` Jonathan Wakely
2021-03-03 17:14 ` Thiago Macieira
2021-03-03 17:18 ` Jonathan Wakely
2021-02-27 1:13 ` C++2a synchronisation inefficient in GCC 11 Thomas Rodgers
2021-02-27 1:29 ` Thomas Rodgers
2021-02-27 3:01 ` Thomas Rodgers
2021-03-01 17:46 ` Thomas Rodgers
2021-03-01 18:00 ` Thiago Macieira
2021-03-01 18:34 ` Thomas Rodgers
2021-03-01 19:11 ` Thiago Macieira
2021-02-27 2:02 ` Ville Voutilainen
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='CAH6eHdRsci92G9s-DgxS7-x8MZMdPtK=eh76OENj8dGoaKE8Mw@mail.gmail.com' \
--to=jwakely.gcc@gmail.com \
--cc=jwakely@redhat.com \
--cc=libstdc++@gcc.gnu.org \
--cc=thiago.macieira@intel.com \
--cc=trodgers@redhat.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).