From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 83A613858D28; Tue, 20 Jun 2023 11:55:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 83A613858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687262159; bh=ybI8QuQYSaOR0tVpTmR/RtInSd5RHnZx5PJqQQCzstU=; h=From:To:Subject:Date:From; b=B6hDayrVg89SRAkJS20ZIHm/5EvDl3Um597mrbPBNYXKOoARSrTQGhyi6P3qDr8EQ AeTmd73jB9pWAE4t/D4xLOK9qAlvi6cXwJI1eo9jbePZ199GIwGRP0+GfsXJvIHz/g HZTyspLpzaeCJFHzzGw0FBcZiC91/fBuWwf/QWFk= From: "lorien.lopez at unizar dot es" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/110319] New: Performance slowdown using a pointer to perform a reduction vs. using a normal variable Date: Tue, 20 Jun 2023 11:55:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: 11.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lorien.lopez at unizar dot es X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: 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=3D110319 Bug ID: 110319 Summary: Performance slowdown using a pointer to perform a reduction vs. using a normal variable Product: gcc Version: 11.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: lorien.lopez at unizar dot es CC: jakub at gcc dot gnu.org Target Milestone: --- When performing an OpenMP sum reduction into a regular variable, GCC uses a "lock cmpxchg" instruction. In contrast, when the reduction is performed in= to a pointer, it uses an OpenMP atomic region. The second version is several tim= es slower in an Intel Skylake CPU.=20 The original report can be found in Stack Overflow: https://stackoverflow.com/questions/76480632/performance-slowdown-using-a-p= ointer-to-perform-a-reduction-vs-using-a-normal-v=