From: Tobias Burnus <tobias@codesourcery.com>
To: Andrew Stubbs <ams@codesourcery.com>, <gcc-patches@gcc.gnu.org>,
Thomas Schwinge <thomas@codesourcery.com>
Subject: Re: [PATCH] libgomp, nvptx, amdgcn: parallel reverse offload
Date: Thu, 21 Sep 2023 11:22:04 +0200 [thread overview]
Message-ID: <4018d42a-dba2-44ff-a8b5-69f390dfc342@codesourcery.com> (raw)
In-Reply-To: <10e18da8-78b3-465f-8685-b8881d690357@codesourcery.com>
Hi Andrew, hi Thomas, hi all,
@Thomas: I wouldn't mind if you could glance at the nvptx/CUDA bits.
On 12.09.23 16:27, Andrew Stubbs wrote:
> This patch implements parallel execution of OpenMP reverse offload
> kernels.
> ...
> The device threads that sent requests are still blocked waiting for
> the completion signal, but any other threads may continue as usual.
Which matches the spec. (Except that, starting with TR12, a user may
also use the 'nowait' clause on the reverse-offload target directive.)
> +++ b/libgomp/config/nvptx/target.c
> @@ -93,7 +93,6 @@ GOMP_target_ext (int device, void (*fn) (void *), size_t mapnum,
> void **hostaddrs, size_t *sizes, unsigned short *kinds,
> unsigned int flags, void **depend, void **args)
> {
...
> + if ((unsigned int) (index + 1) < GOMP_REV_OFFLOAD_VAR->consumed)
> + abort (); /* Overflow. */
[I assume the ideas is that this gets diagnosed by the host (via the
GOMP_PLUGIN_fatal) and that that diagnosis is faster then the
propagation of the abort() from the device to the host such that the
message is always printed.]
Should there be an "Error message is printed via the nvptx plugin on the
host" or something along this line?
> +++ b/libgomp/libgomp.texi
...
> +* GOMP_REVERSE_OFFLOAD_THREADS:: Set the maximum number of host threads
> @end menu
...
> +@node GOMP_REVERSE_OFFLOAD_THREADS
> +@section @env{GOMP_REVERSE_OFFLOAD_THREADS} -- Set the maximum number of host threads
Thanks but can you also update the gcn/nvptx description? We currently have:
https://gcc.gnu.org/onlinedocs/libgomp/index.html
--------<cut->----------
@section AMD Radeon (GCN)
...
@item Reverse offload regions (i.e. @code{target} regions with
@code{device(ancestor:1)}) are processed serially per @code{target} region
such that the next reverse offload region is only executed after the previous
one returned.
...
@section nvptx
...
@item Reverse offload regions (i.e. @code{target} regions with
@code{device(ancestor:1)}) are processed serially per @code{target} region
such that the next reverse offload region is only executed after the previous
one returned.
--------<cut->----------
Possibly by also adding a @ref{GOMP_REVERSE_OFFLOAD_THREADS} such that a user
can find this.
(I wonder whether the "UINTMAX (= 4294967296)" should be documented or whether
that's an implementation detail we do not need to document. But given that a
long-running code taking 4 weeks still can issues 1775 reverse offloads per
second before exhausting the count, that should be a nonissue.)
> +++ b/libgomp/plugin/plugin-nvptx.c
> @@ -1639,9 +1639,10 @@ nvptx_goacc_asyncqueue_construct (unsigned int flags)
> }
>
> struct goacc_asyncqueue *
> -GOMP_OFFLOAD_openacc_async_construct (int device __attribute__((unused)))
> +GOMP_OFFLOAD_openacc_async_construct (int device)
> {
> - return nvptx_goacc_asyncqueue_construct (CU_STREAM_DEFAULT);
> + nvptx_attach_host_thread_to_device (device);
> + return nvptx_goacc_asyncqueue_construct (CU_STREAM_NON_BLOCKING);
> }
That's not really new and we have plenty of code of this kind, but isn't
this a race if this is called nearly instantaneously for multiple
devices? (Still, the new code is surely better than the previous one.)
@Thomas: ?
I will have another look after the Cauldron, but I think the patch is
otherwise okay.
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
prev parent reply other threads:[~2023-09-21 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 14:27 Andrew Stubbs
2023-09-12 16:32 ` [OG13][committed] " Andrew Stubbs
2023-09-21 9:22 ` Tobias Burnus [this message]
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=4018d42a-dba2-44ff-a8b5-69f390dfc342@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=ams@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=thomas@codesourcery.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).