diff options
author | Martin Liska <mliska@suse.cz> | 2016-03-23 10:59:51 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2016-03-23 09:59:51 +0000 |
commit | 7397fce2f723d1a8c59979e92938b01878ae8e80 (patch) | |
tree | b6ab1a771d0a8f39f2971b0ff4c008a0ca07c286 | |
parent | 0179520a83329a8daefcbb87c2609035694b928a (diff) | |
download | gcc-7397fce2f723d1a8c59979e92938b01878ae8e80.zip gcc-7397fce2f723d1a8c59979e92938b01878ae8e80.tar.gz gcc-7397fce2f723d1a8c59979e92938b01878ae8e80.tar.bz2 |
Copy shadow argument conditionally (PR hsa/70337)
PR hsa/70337
* plugin/plugin-hsa.c (GOMP_OFFLOAD_run): Copy shadow
argument just in case a dispatched kernel uses that argument.
From-SVN: r234418
-rw-r--r-- | libgomp/ChangeLog | 6 | ||||
-rw-r--r-- | libgomp/plugin/plugin-hsa.c | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index fca65e6..b3e735c 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2016-03-23 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. + 2016-03-16 Thomas Schwinge <thomas@codesourcery.com> * testsuite/libgomp.oacc-fortran/kernels-loop-2.f95: Adjust to 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"); |