From 3990498a1ea844f55c7a2b6f3758ddf15513d7cc Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 8 Oct 2019 12:46:05 -0400 Subject: [PATCH] P4 to Git Change 2009953 by eshcherb@evgeny-hip on 2019/10/08 12:36:36 SWDEV-197287 - HIP tracing layer instrumentation - Windows link issues. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_intercept.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/api/hip/hip_prof_api.h#2 edit --- api/hip/hip_intercept.cpp | 2 +- api/hip/hip_prof_api.h | 58 ++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 33 deletions(-) diff --git a/api/hip/hip_intercept.cpp b/api/hip/hip_intercept.cpp index b6aed14701..f4936c065d 100644 --- a/api/hip/hip_intercept.cpp +++ b/api/hip/hip_intercept.cpp @@ -27,7 +27,7 @@ THE SOFTWARE. api_callbacks_table_t callbacks_table; -extern std::string& FunctionName(const hipFunction_t f); +extern const std::string& FunctionName(const hipFunction_t f); const char* hipKernelNameRef(const hipFunction_t f) { return FunctionName(f).c_str(); } hipError_t hipRegisterApiCallback(uint32_t id, void* fun, void* arg) { diff --git a/api/hip/hip_prof_api.h b/api/hip/hip_prof_api.h index 32679f403a..f0cc5881c4 100644 --- a/api/hip/hip_prof_api.h +++ b/api/hip/hip_prof_api.h @@ -27,16 +27,34 @@ THE SOFTWARE. #include #include +#if USE_PROF_API #include "hip/hcc_detail/hip_prof_str.h" +#include "prof_protocol.h" -template -class api_callbacks_table_templ { +// HIP API callbacks spawner object macro +#define HIP_CB_SPAWNER_OBJECT(CB_ID) \ + api_callbacks_spawner_t __api_tracer; \ + { \ + hip_api_data_t* api_data = __api_tracer.get_api_data_ptr(); \ + if (api_data != NULL) { \ + hip_api_data_t& api_data_ref = *api_data; \ + INIT_CB_ARGS_DATA(CB_ID, api_data_ref); \ + __api_tracer.call(); \ + } \ + } + +static const uint32_t HIP_DOMAIN_ID = ACTIVITY_DOMAIN_HIP_API; +typedef activity_record_t hip_api_record_t; +typedef activity_rtapi_callback_t hip_api_callback_t; +typedef activity_sync_callback_t hip_act_callback_t; + +class api_callbacks_table_t { public: typedef std::recursive_mutex mutex_t; - typedef Record record_t; - typedef Fun fun_t; - typedef Act act_t; + typedef hip_api_record_t record_t; + typedef hip_api_callback_t fun_t; + typedef hip_act_callback_t act_t; // HIP API callbacks table struct hip_cb_table_entry_t { @@ -52,7 +70,7 @@ class api_callbacks_table_templ { hip_cb_table_entry_t arr[HIP_API_ID_NUMBER]; }; - api_callbacks_table_templ() { + api_callbacks_table_t() { memset(&callbacks_table_, 0, sizeof(callbacks_table_)); } @@ -150,36 +168,12 @@ class api_callbacks_table_templ { bool enabled_; }; - -#if USE_PROF_API -#include "prof_protocol.h" - -static const uint32_t HIP_DOMAIN_ID = ACTIVITY_DOMAIN_HIP_API; -typedef activity_record_t hip_api_record_t; -typedef activity_rtapi_callback_t hip_api_callback_t; -typedef activity_sync_callback_t hip_act_callback_t; - -// HIP API callbacks spawner object macro -#define HIP_CB_SPAWNER_OBJECT(CB_ID) \ - api_callbacks_spawner_t __api_tracer(HIP_API_ID_##CB_ID); \ - { \ - hip_api_data_t* api_data = __api_tracer.get_api_data_ptr(); \ - if (api_data != NULL) { \ - hip_api_data_t& api_data_ref = *api_data; \ - INIT_CB_ARGS_DATA(CB_ID, api_data_ref); \ - __api_tracer.call(); \ - } \ - } - -typedef api_callbacks_table_templ api_callbacks_table_t; extern api_callbacks_table_t callbacks_table; template class api_callbacks_spawner_t { public: - api_callbacks_spawner_t(const hip_api_id_t& cid) : + api_callbacks_spawner_t() : api_data_(NULL) { if (!is_enabled()) return; @@ -232,7 +226,7 @@ class api_callbacks_spawner_t { template <> class api_callbacks_spawner_t { public: - api_callbacks_spawner_t(const hip_api_id_t& cid) {} + api_callbacks_spawner_t() {} void call() {} hip_api_data_t* get_api_data_ptr() { return NULL; } bool is_enabled() const { return false; }