On 24/07/2019 11:45 am, Thomas Schwinge wrote:
+2017-02-28 Thomas Schwinge <tho...@codesourcery.com>
+
+ [...]
+ * oacc-parallel.c (GOACC_parallel_keyed_internal): Set device_api for
+ profiling.
--- a/libgomp/oacc-parallel.c
+++ b/libgomp/oacc-parallel.c
@@ -275,6 +275,8 @@ GOACC_parallel_keyed_internal (int flags_m, int params,
void (*fn) (void *),
goacc_call_host_fn (fn, mapnum, hostaddrs, params);
goto out_prof;
}
+ else if (profiling_p)
+ api_info.device_api = acc_device_api_cuda;
That change is not quite right, and I'm pretty sure it wasn't me who
introduced that code ;-P -- but that can be resolved later.
git blame shows that that fragment was introduced in commit
fef820dc593f3ee87dd79532701ed709e249eca4 (on the OG8 branch) named 'OpenACC
async re-work'.
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
@@ -41,6 +41,7 @@ static int state = -1;
static acc_device_t acc_device_type;
static int acc_device_num;
static int num_gangs, num_workers, vector_length;
+static int async;
All these 'async' changes in this file logically belong into the
respective commit of the OpenACC 'kernels' changes. It's not a problem
to have them included here; we shall just try to remember to include them
in the OpenACC 'kernels' trunk changes. (I've made a note; no need for
you to re-test/re-post.)
This is because in OG8, the kernel changes came after the introduction of the
profiling interface code, while on OG9 it is the other way around.
@@ -165,6 +166,15 @@ int main()
for (int i = 0; i < N; ++i)
x[i] = i * i;
}
+#ifdef __OPTIMIZE__
+ /* TODO. With -O2 optimizations enabled, the compiler believes that here
+ "state == 0" still holds. It's not yet clear what's going on.
+ Mis-optimization across the GOMP function call boundary? Per its
+ gcc/omp-builtins.def definition, BUILT_IN_GOACC_PARALLEL
+ "GOACC_parallel_keyed" doesn't have a "leaf" attribute, so the compiler
+ must expect calls back into this compilation unit? */
+ asm volatile ("" : : : "memory");
+#endif
That workaround is no longer needed given the more specific workaround
that I've added, marked with "TODO PR90488".
Removed.
In 'libgomp.oacc-c-c++-common/acc_prof-version-1.c:main', we should also
remove the explicit call to 'acc_register_library'.
Removed.
The patches have now been pushed to the openacc-gcc-9-branch git-only branch.
Kwok