From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEC66385771F; Mon, 8 May 2023 19:16:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEC66385771F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683573407; bh=b+rdncuRizwb2pLNXr56tN9UKJBw3FlARJYHlp9LSuw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xLwc3eir43kKOMu1PxWZKm8NGMaIzZzA4NwFlNmdaqn+hhS+dZL6XxqCFkCG1Fhkl 3RrlXjbaeIVyGrem0efDPVH4XYjHgtw7CykXLFxZgvSGa22+p47nyy0GHSbpTToAit NH+3hho7HjYAQ0940yqwzotkowlPWT0BaWJxm3mU= From: "rodgertq at gcc dot 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:16:47 +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: rodgertq at gcc dot gnu.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 #16 from Thomas Rodgers --- (In reply to Thiago Macieira from comment #15) > > > 5) std::barrier implementation also uses a type that futex(2) can't = handle >=20 > > barrier still uses a 1-byte enum for the atomic waits. >=20 > That can only now be fixed for libstdc++.so.7, then. 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 test= ed on a number of platforms (including time on ORNL's Summit). The following comment, preserved from libc++ should be considered carefully before any ch= ange 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 nee= d to see benchmark numbers that illustrate the performance differences under var= ious contention scenarios vs impact on caches by being able to fit the entire tr= ee in a single cache line using char, vs four or eight cache lines using the t= ype favored by futex or ulock_wait/wake.=