From: "Martin Liška" <mliska@suse.cz>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Martin Jambor <mjambor@suse.cz>
Subject: Re: [HSA, PATCH] Allocate memory for shadow arg (PR hsa/70337)
Date: Mon, 21 Mar 2016 20:58:00 -0000 [thread overview]
Message-ID: <56F05ECF.3020005@suse.cz> (raw)
In-Reply-To: <20160321182325.GD3435@virgil.suse.cz>
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
On 03/21/2016 07:23 PM, Martin Jambor wrote:
> This is strange. The pointer to the shadow data structure is, from
> the HSA perspective, a normal kernel argument and therefore should
> already be included in the kernel->kernarg_segment_size. Have you
> checked that the values are indeed off?
Hi Martin.
You are right that size of a shadow argument pointer should be
included in the kernel->kernarg_segment_size. I've been currently
testing a proper patch which conditionally copies shadow argument.
Thanks,
Martin
[-- Attachment #2: 0001-Copy-shadow-argument-conditionally-PR-hsa-70337.patch --]
[-- Type: text/x-patch, Size: 1445 bytes --]
From 413707c51bf4b0ac7f8dac6421be9955c18767dd Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Mon, 21 Mar 2016 21:40:03 +0100
Subject: [PATCH] Copy shadow argument conditionally (PR hsa/70337)
libgomp/ChangeLog:
2016-03-21 Martin Liska <mliska@suse.cz>
PR hsa/70337
* plugin/plugin-hsa.c (GOMP_OFFLOAD_run): Copy shadow
argument just in case a dispatched kernel uses that argument.
---
libgomp/plugin/plugin-hsa.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libgomp/plugin/plugin-hsa.c b/libgomp/plugin/plugin-hsa.c
index d888493..f7ef600 100644
--- a/libgomp/plugin/plugin-hsa.c
+++ b/libgomp/plugin/plugin-hsa.c
@@ -1255,8 +1255,16 @@ GOMP_OFFLOAD_run (int n, void *fn_ptr, void *vars, void **args)
hsa_signal_store_relaxed (s, 1);
memcpy (shadow->kernarg_address, &vars, sizeof (vars));
- memcpy (shadow->kernarg_address + sizeof (vars), &shadow,
- sizeof (struct hsa_kernel_runtime *));
+ /* PR hsa/70337. */
+ size_t vars_size = sizeof (vars);
+ if (kernel->kernarg_segment_size > vars_size)
+ {
+ if (kernel->kernarg_segment_size != vars_size
+ + sizeof (struct hsa_kernel_runtime *))
+ GOMP_PLUGIN_fatal ("Kernel segment size has an unexpected value");
+ memcpy (packet->kernarg_address + vars_size, &shadow,
+ sizeof (struct hsa_kernel_runtime *));
+ }
HSA_DEBUG ("Copying kernel runtime pointer to kernarg_address\n");
--
2.7.1
next prev parent reply other threads:[~2016-03-21 20:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-21 13:05 Martin Liška
2016-03-21 19:06 ` Martin Jambor
2016-03-21 20:58 ` Martin Liška [this message]
2016-03-22 16:51 ` Martin Jambor
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=56F05ECF.3020005@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@suse.cz \
/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).