diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2019-05-17 21:13:36 +0200 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2019-05-17 21:13:36 +0200 |
commit | 5fae049dc272144f8e61af94ee0ba42b270915e5 (patch) | |
tree | 6108e18ecb0a9f9190bb4d03730bba8cd80654f1 /libgomp/oacc-int.h | |
parent | b48f44bf77a39fefc238a16cf1225c6464c82406 (diff) | |
download | gcc-5fae049dc272144f8e61af94ee0ba42b270915e5.zip gcc-5fae049dc272144f8e61af94ee0ba42b270915e5.tar.gz gcc-5fae049dc272144f8e61af94ee0ba42b270915e5.tar.bz2 |
OpenACC Profiling Interface (incomplete)
libgomp/
* acc_prof.h: New file.
* oacc-profiling.c: Likewise.
* Makefile.am (nodist_libsubinclude_HEADERS, libgomp_la_SOURCES):
Add these, respectively.
* Makefile.in: Regenerate.
* env.c (initialize_env): Call goacc_profiling_initialize.
* oacc-plugin.c (GOMP_PLUGIN_goacc_thread)
(GOMP_PLUGIN_goacc_profiling_dispatch): New functions.
* oacc-plugin.h (GOMP_PLUGIN_goacc_thread)
(GOMP_PLUGIN_goacc_profiling_dispatch): Declare.
* libgomp.map (OACC_2.5.1): Add acc_prof_lookup,
acc_prof_register, acc_prof_unregister, and acc_register_library.
(GOMP_PLUGIN_1.3): Add GOMP_PLUGIN_goacc_profiling_dispatch, and
GOMP_PLUGIN_goacc_thread.
* oacc-int.h (struct goacc_thread): Add prof_info, api_info,
prof_callbacks_enabled members.
(goacc_prof_enabled, goacc_profiling_initialize)
(_goacc_profiling_dispatch_p, _goacc_profiling_setup_p)
(goacc_profiling_dispatch): Declare.
(GOACC_PROF_ENABLED, GOACC_PROFILING_DISPATCH_P)
(GOACC_PROFILING_SETUP_P): Define.
* oacc-async.c (acc_async_test, acc_async_test_all, acc_wait)
(acc_wait_async, acc_wait_all, acc_wait_all_async): Update for
OpenACC Profiling Interface.
* oacc-cuda.c (acc_get_current_cuda_device)
(acc_get_current_cuda_context, acc_get_cuda_stream)
(acc_set_cuda_stream): Likewise.
* oacc-init.c (acc_init_1, goacc_attach_host_thread_to_device)
(acc_init, acc_set_device_type, acc_get_device_type)
(acc_get_device_num, goacc_lazy_initialize): Likewise.
* oacc-mem.c (acc_malloc, acc_free, memcpy_tofrom_device)
(acc_deviceptr, acc_hostptr, acc_is_present, acc_map_data)
(acc_unmap_data, present_create_copy, delete_copyout)
(update_dev_host): Likewise.
* oacc-parallel.c (GOACC_parallel_keyed, GOACC_data_start)
(GOACC_data_end, GOACC_enter_exit_data, GOACC_update, GOACC_wait):
Likewise.
* plugin/plugin-nvptx.c (nvptx_exec, nvptx_alloc, nvptx_free)
(GOMP_OFFLOAD_openacc_exec, GOMP_OFFLOAD_openacc_async_exec):
Likewise.
* libgomp.texi: Update.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-dispatch-1.c: New
file.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-parallel-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-valid_bytes-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_prof-version-1.c:
Likewise.
From-SVN: r271346
Diffstat (limited to 'libgomp/oacc-int.h')
-rw-r--r-- | libgomp/oacc-int.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libgomp/oacc-int.h b/libgomp/oacc-int.h index e4b6ea6..5ca9944 100644 --- a/libgomp/oacc-int.h +++ b/libgomp/oacc-int.h @@ -40,6 +40,7 @@ #include "openacc.h" #include "config.h" +#include "acc_prof.h" #include <stddef.h> #include <stdbool.h> #include <stdarg.h> @@ -68,6 +69,12 @@ struct goacc_thread strictly push/pop semantics according to lexical scope. */ struct target_mem_desc *mapped_data; + /* Data of the OpenACC Profiling Interface. */ + acc_prof_info *prof_info; + acc_api_info *api_info; + /* Per-thread toggle of OpenACC Profiling Interface callbacks. */ + bool prof_callbacks_enabled; + /* These structures form a list: this is the next thread in that list. */ struct goacc_thread *next; @@ -128,6 +135,28 @@ async_synchronous_p (int async) return async == acc_async_sync; } + +extern bool goacc_prof_enabled; +/* Tune for the (very common) case that profiling is not enabled. */ +#define GOACC_PROF_ENABLED \ + (__builtin_expect (__atomic_load_n (&goacc_prof_enabled, \ + MEMMODEL_ACQUIRE) == true, false)) + +void goacc_profiling_initialize (void); +bool _goacc_profiling_dispatch_p (bool); +/* Tune for the (very common) case that profiling is not enabled. */ +#define GOACC_PROFILING_DISPATCH_P(...) \ + (GOACC_PROF_ENABLED \ + && _goacc_profiling_dispatch_p (__VA_ARGS__)) +bool _goacc_profiling_setup_p (struct goacc_thread *, + acc_prof_info *, acc_api_info *); +/* Tune for the (very common) case that profiling is not enabled. */ +#define GOACC_PROFILING_SETUP_P(...) \ + (GOACC_PROFILING_DISPATCH_P (false) \ + && _goacc_profiling_setup_p (__VA_ARGS__)) +void goacc_profiling_dispatch (acc_prof_info *, acc_event_info *, + acc_api_info *); + #ifdef HAVE_ATTRIBUTE_VISIBILITY # pragma GCC visibility pop #endif |