SWDEV-295522: Fixing Performance Issue

Removing DEBUG_TRACES and the unnecessary use of roctracer_op_string, made the MS app reporting 78 to 81 stable samples per second, depending on the type of the trace, while the main app without rocprof reports 100 to 106. More detailed numbers will be posted in the ticket.

Change-Id: Ifbc529278cea54dd23e6086aa9b9ea2df952d5dd
이 커밋은 다음에 포함됨:
Ammar ELWazir 작성하고 Ammar Elwazir가 2022-04-22 18:51:49 -04:00를 커밋함
1 부모 dc8717a6b5
커밋 e4569c41fe
3 파일이 변경됨
+13 -16

검색과 일치하는 파일 없음

+7 -8
파일 보기
@@ -409,12 +409,12 @@ void* HIP_SyncApiDataCallback(uint32_t op_id, roctracer_record_t* record, const
correlation_id_tls = 0;
}
const char* name = roctracer_op_string(ACTIVITY_DOMAIN_HIP_API, op_id, 0);
DEBUG_TRACE(
"HIP_SyncApiDataCallback(\"%s\") phase(%d): op(%u) record(%p) data(%p) pool(%p) depth(%d) "
"correlation_id(%lu) time_ns(%lu)\n",
name, phase, op_id, record, data, pool, (int)(record_pair_stack->size()),
(data_ptr) ? data_ptr->correlation_id : 0, timer.timestamp_ns());
roctracer_op_string(ACTIVITY_DOMAIN_HIP_API, op_id, 0), phase, op_id, record, data, pool,
(int)(record_pair_stack->size()), (data_ptr) ? data_ptr->correlation_id : 0,
timer.timestamp_ns());
return ret;
}
@@ -503,12 +503,11 @@ void* HIP_SyncActivityCallback(uint32_t op_id, roctracer_record_t* record,
correlation_id_tls = 0;
}
const char* name = roctracer_op_string(ACTIVITY_DOMAIN_HIP_API, op_id, 0);
DEBUG_TRACE(
"HIP_SyncActivityCallback(\"%s\") phase(%d): op(%u) record(%p) data(%p) pool(%p) depth(%d) "
"correlation_id(%lu) beg_ns(%lu) end_ns(%lu)\n",
name, phase, op_id, record, data, pool, (int)(record_pair_stack->size()),
(data_ptr) ? data_ptr->correlation_id : 0, timestamp_ns);
roctracer_op_string(ACTIVITY_DOMAIN_HIP_API, op_id, 0), phase, op_id, record, data, pool,
(int)(record_pair_stack->size()), (data_ptr) ? data_ptr->correlation_id : 0, timestamp_ns);
return ret;
}
@@ -525,11 +524,11 @@ void HIP_AsyncActivityCallback(uint32_t op_id, void* record, void* arg) {
if (record_ptr->correlation_id == 0) return;
pool->Write(*record_ptr);
const char* name = roctracer_op_string(ACTIVITY_DOMAIN_HIP_OPS, record_ptr->op, record_ptr->kind);
DEBUG_TRACE(
"HIP_AsyncActivityCallback(\"%s\"): op(%u) kind(%u) record(%p) pool(%p) correlation_id(%d) "
"beg_ns(%lu) end_ns(%lu)\n",
name, record_ptr->op, record_ptr->kind, record, pool, record_ptr->correlation_id,
roctracer_op_string(ACTIVITY_DOMAIN_HIP_OPS, record_ptr->op, record_ptr->kind),
record_ptr->op, record_ptr->kind, record, pool, record_ptr->correlation_id,
record_ptr->begin_ns, record_ptr->end_ns);
}
+1 -1
파일 보기
@@ -209,7 +209,7 @@ inline static void DEBUG_TRACE(const char* fmt, ...) {
va_end(valist);
}
#else
inline static void DEBUG_TRACE(const char* fmt, ...) {}
#define DEBUG_TRACE(...)
#endif
#endif // SRC_UTIL_LOGGER_H_
+5 -7
파일 보기
@@ -94,7 +94,7 @@ inline static void DEBUG_TRACE(const char* fmt, ...) {
va_end(valist);
}
#else
inline static void DEBUG_TRACE(const char* fmt, ...) {}
#define DEBUG_TRACE(...)
#endif
typedef hsa_rt_utils::Timer::timestamp_t timestamp_t;
@@ -466,12 +466,11 @@ void hip_api_callback(uint32_t domain, uint32_t cid, const void* callback_data,
entry->valid.store(roctracer::TRACE_ENTRY_COMPL, std::memory_order_release);
}
const char* name = roctracer_op_string(domain, cid, 0);
DEBUG_TRACE(
"hip_api_callback(\"%s\") phase(%d): cid(%u) data(%p) entry(%p) name(\"%s\") "
"correlation_id(%lu) timestamp(%lu)\n",
name, data->phase, cid, data, entry, (entry) ? entry->name : NULL, data->correlation_id,
timestamp);
roctracer_op_string(domain, cid, 0), data->phase, cid, data, entry,
(entry) ? entry->name : NULL, data->correlation_id, timestamp);
}
void mark_api_callback(uint32_t domain, uint32_t cid, const void* callback_data, void* arg) {
@@ -512,12 +511,11 @@ void hip_api_flush_cb(hip_api_trace_entry_t* entry) {
<< entry->tid;
oss << std::dec << rec_ss.str() << " " << str;
const char* name = roctracer_op_string(entry->domain, entry->cid, 0);
DEBUG_TRACE(
"hip_api_flush_cb(\"%s\"): domain(%u) cid(%u) entry(%p) name(\"%s\" correlation_id(%lu) "
"beg(%lu) end(%lu))\n",
name, entry->domain, entry->cid, entry, entry->name, correlation_id, begin_timestamp,
end_timestamp);
roctracer_op_string(entry->domain, entry->cid, 0), entry->domain, entry->cid, entry,
entry->name, correlation_id, begin_timestamp, end_timestamp);
if (domain == ACTIVITY_DOMAIN_HIP_API) {
#if HIP_PROF_HIP_API_STRING