public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chung-Lin Tang <chunglin.tang@siemens.com>
To: Chung-Lin Tang <cltang@codesourcery.com>,
	Chung-Lin Tang <chunglin.tang@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	Tom de Vries <tdevries@suse.de>,
	Catherine Moore <clm@codesourcery.com>
Subject: [Ping x4] Re: [PATCH, nvptx, 1/2] Reimplement libgomp barriers for nvptx
Date: Tue, 22 Nov 2022 00:24:14 +0800	[thread overview]
Message-ID: <a83d3de6-73b0-efd4-26af-cf6b708e1a0f@siemens.com> (raw)
In-Reply-To: <0d3cfa3f-8d63-e2bb-ea31-2f39753d6dd1@siemens.com>

Ping x4

On 2022/11/8 12:34 AM, Chung-Lin Tang wrote:
> Ping x3.
> 
> On 2022/10/31 10:18 PM, Chung-Lin Tang wrote:
>> Ping x2.
>>
>> On 2022/10/17 10:29 PM, Chung-Lin Tang wrote:
>>> Ping.
>>>
>>> On 2022/9/21 3:45 PM, Chung-Lin Tang via Gcc-patches wrote:
>>>> Hi Tom,
>>>> I had a patch submitted earlier, where I reported that the current way of implementing
>>>> barriers in libgomp on nvptx created a quite significant performance drop on some SPEChpc2021
>>>> benchmarks:
>>>> https://gcc.gnu.org/pipermail/gcc-patches/2022-September/600818.html>>>>>
>>>> That previous patch wasn't accepted well (admittedly, it was kind of a hack).
>>>> So in this patch, I tried to (mostly) re-implement team-barriers for NVPTX.
>>>>
>>>> Basically, instead of trying to have the GPU do CPU-with-OS-like things that it isn't suited for,
>>>> barriers are implemented simplistically with bar.* synchronization instructions.
>>>> Tasks are processed after threads have joined, and only if team->task_count != 0
>>>>
>>>> (arguably, there might be a little bit of performance forfeited where earlier arriving threads
>>>> could've been used to process tasks ahead of other threads. But that again falls into requiring
>>>> implementing complex futex-wait/wake like behavior. Really, that kind of tasking is not what target
>>>> offloading is usually used for)
>>>>
>>>> Implementation highlight notes:
>>>> 1. gomp_team_barrier_wake() is now an empty function (threads never "wake" in the usual manner)
>>>> 2. gomp_team_barrier_cancel() now uses the "exit" PTX instruction.
>>>> 3. gomp_barrier_wait_last() now is implemented using "bar.arrive"
>>>>
>>>> 4. gomp_team_barrier_wait_end()/gomp_team_barrier_wait_cancel_end():
>>>>     The main synchronization is done using a 'bar.red' instruction. This reduces across all threads
>>>>     the condition (team->task_count != 0), to enable the task processing down below if any thread
>>>>     created a task. (this bar.red usage required the need of the second GCC patch in this series)
>>>>
>>>> This patch has been tested on x86_64/powerpc64le with nvptx offloading, using libgomp, ovo, omptests,
>>>> and sollve_vv testsuites, all without regressions. Also verified that the SPEChpc 2021 521.miniswp_t
>>>> and 534.hpgmgfv_t performance regressions that occurred in the GCC12 cycle has been restored to
>>>> devel/omp/gcc-11 (OG11) branch levels. Is this okay for trunk?
>>>>
>>>> (also suggest backporting to GCC12 branch, if performance regression can be considered a defect)
>>>>
>>>> Thanks,
>>>> Chung-Lin
>>>>
>>>> libgomp/ChangeLog:
>>>>
>>>> 2022-09-21  Chung-Lin Tang  <cltang@codesourcery.com>
>>>>
>>>> 	* config/nvptx/bar.c (generation_to_barrier): Remove.
>>>> 	(futex_wait,futex_wake,do_spin,do_wait): Remove.
>>>> 	(GOMP_WAIT_H): Remove.
>>>> 	(#include "../linux/bar.c"): Remove.
>>>> 	(gomp_barrier_wait_end): New function.
>>>> 	(gomp_barrier_wait): Likewise.
>>>> 	(gomp_barrier_wait_last): Likewise.
>>>> 	(gomp_team_barrier_wait_end): Likewise.
>>>> 	(gomp_team_barrier_wait): Likewise.
>>>> 	(gomp_team_barrier_wait_final): Likewise.
>>>> 	(gomp_team_barrier_wait_cancel_end): Likewise.
>>>> 	(gomp_team_barrier_wait_cancel): Likewise.
>>>> 	(gomp_team_barrier_cancel): Likewise.
>>>> 	* config/nvptx/bar.h (gomp_team_barrier_wake): Remove
>>>> 	prototype, add new static inline function.
> 


  reply	other threads:[~2022-11-21 16:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21  7:45 Chung-Lin Tang
2022-09-21  9:01 ` Jakub Jelinek
2022-09-21 10:02   ` Chung-Lin Tang
2022-10-17 14:29 ` Chung-Lin Tang
2022-10-31 14:18   ` [Ping x2] " Chung-Lin Tang
2022-11-07 16:34     ` [Ping x3] " Chung-Lin Tang
2022-11-21 16:24       ` Chung-Lin Tang [this message]
2022-12-05 16:21         ` [Ping x5] " Chung-Lin Tang
2022-12-12 11:13           ` [Ping x6] " Chung-Lin Tang
2022-12-16 14:51 ` Tom de Vries
2022-12-19 12:13   ` Thomas Schwinge

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=a83d3de6-73b0-efd4-26af-cf6b708e1a0f@siemens.com \
    --to=chunglin.tang@siemens.com \
    --cc=chunglin.tang@gmail.com \
    --cc=clm@codesourcery.com \
    --cc=cltang@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tdevries@suse.de \
    /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).