From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8A2393858C36; Mon, 8 May 2023 19:42:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8A2393858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683574958; bh=HYeWPkX8/0GqnPbpziqbNI86bO2kqv7YEc4nU7CpmiQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hIeVRN6qyVfkQICVNwg+Gbpf0Dc+DWiR95D94TB6pomyilzsT/CtbllkDuCtZOnOo SsRU6ZSV3g/Ytbd1AwQd8x2qg4j6ncUykPqLVhcyIXwmeqrGHUoPyadAwGlGcgd5ER P1nLCeRKRLurJXRhmLMh+NFQdqRkrKjPBZRKoEbw= From: "thiago at kde dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ABI X-Bugzilla-Severity: normal X-Bugzilla-Who: thiago at kde dot org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99277 --- Comment #17 from Thiago Macieira --- (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).=20 I remember our discussion on this. But libc++ isn't trying to be optimal an= d it never supports direct futex. The fact that they chose this path does not me= an libstdc++ must too. > The following comment, preserved from libc++ should be > considered carefully before any change here - >=20 > " 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." >=20 > It is my opinion that the bar for making a change here is high. I would n= eed > 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 lin= es > 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.=