From: Tobias Burnus <tobias@codesourcery.com>
To: Thomas Schwinge <thomas@codesourcery.com>,
<gcc-patches@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>
Subject: Re: [Patch] libgomp: Handle OpenMP's reverse offloads
Date: Thu, 15 Dec 2022 20:42:53 +0100 [thread overview]
Message-ID: <fd3e5c7d-e4c3-cb6d-9043-6a8f9e15c41f@codesourcery.com> (raw)
In-Reply-To: <87ilicfu55.fsf@euler.schwinge.homeip.net>
Hi,
I have not fully tried to understand it, yet.
(A) Regarding the issue of stalling, see als Andrew's patch and the
discussion about it in
"[PATCH] libgomp: fix hang on fatal error",
https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603616.html
and in particular Jakub's two replies.
(b) I think you want to remove this:
On 15.12.22 18:34, Thomas Schwinge wrote:
> --- a/libgomp/plugin/plugin-nvptx.c
> +++ b/libgomp/plugin/plugin-nvptx.c
> @@ -1,3 +1,5 @@
> +#pragma GCC optimize "O0"
> +
> /* Plugin for NVPTX execution.
(c)
> If the libgomp plugin doesn't request special
> 'host_to_dev_cpy'/'dev_to_host_cpy' for 'gomp_target_rev', then standard
> 'gomp_copy_host2dev'/'gomp_copy_dev2host' are used, which use
> 'gomp_device_copy', which expects the device to be locked. (As can be
> told by the unconditional 'gomp_mutex_unlock (&devicep->lock);' before
> 'gomp_fatal'.) However, in a number of the
> 'gomp_copy_host2dev'/'gomp_copy_dev2host' calls from 'gomp_target_rev',
> the device definitely is not locked; see the calls adjacent to the TODO
The question is what unlocks the device – it is surely locked in gomp_target_rev by:
if (!(devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM))
...
gomp_mutex_lock (&devicep->lock);
for (uint64_t i = 0; i < mapnum; i++)
...
}
gomp_mutex_unlock (&devicep->lock);
}
Except for code like:
gomp_mutex_unlock (&devicep->lock);
gomp_fatal ("gomp_target_rev unhandled kind 0x%.4x", kinds[i]);
The only functions that know about the pointer and get called are those behind
the dev_to_host_cpy and host_to_dev_cpy - thus, they seemingly mess about with the
unlocking?!?
* * *
Regarding your patch, I do not understand why you call twice unlock and
have trice TODO unlock; that does not seem to make any sense.
I think it is worthwhile to understand why plugin-nvptx.c unlocks the lock in
the non-error case - as you observe that it is not locked in the error case.
Additionally, it seems to make more sense to look into a revised patch of
Andrew's patch, your patch looks like a rather bad band aid.
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
next prev parent reply other threads:[~2022-12-15 19:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 7:45 Tobias Burnus
2022-12-07 8:08 ` [Patch] libgomp.texi: Reverse-offload updates (was: [Patch] libgomp: Handle OpenMP's reverse offloads) Tobias Burnus
2022-12-10 8:18 ` Tobias Burnus
2023-01-31 12:21 ` Jakub Jelinek
2022-12-09 14:44 ` [Patch] libgomp: Handle OpenMP's reverse offloads Jakub Jelinek
2022-12-10 8:11 ` Tobias Burnus
2022-12-10 8:28 ` Jakub Jelinek
2022-12-15 17:34 ` Thomas Schwinge
2022-12-15 17:49 ` Jakub Jelinek
2022-12-15 19:42 ` Tobias Burnus [this message]
2022-12-15 20:13 ` Tobias Burnus
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=fd3e5c7d-e4c3-cb6d-9043-6a8f9e15c41f@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--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).