SWDEV-351980 - Consolidate registration tables in the roctracer library

Remove the activity_prof::CallbacksTable. The table was redundant with
the information already stored in the roctracer library. Instead use a
single callback into the roctracer library to query whether the activity
is enabled, and to report it.

Change-Id: I2e05b0881bb4a1953c14361d00ea310d02eb6e0c
Этот коммит содержится в:
Laurent Morichetti
2022-08-30 18:38:25 -07:00
коммит произвёл Maneesh Gupta
родитель e713b5c7d0
Коммит 52eb28930a
7 изменённых файлов: 41 добавлений и 61 удалений
+22 -8
Просмотреть файл
@@ -23,8 +23,12 @@
#include "platform/commandqueue.hpp"
#include "platform/command_utils.hpp"
#include <atomic>
namespace activity_prof {
decltype(report_activity) report_activity{nullptr};
#if USE_PROF_API
#if defined(__linux__)
@@ -40,17 +44,29 @@ static inline size_t linearSize(const amd::Coord3D& size3d) {
return size;
}
void CallbacksTable::reportActivity(const amd::Command& command) {
assert(command.profilingInfo().enabled_ && "profiling must be enabled for this command");
auto operation_id = operationId(command.type());
bool IsEnabled(OpId operation_id) {
if (operation_id < OP_ID_NUMBER)
if (auto report = report_activity.load(std::memory_order_relaxed))
return report(ACTIVITY_DOMAIN_HIP_OPS, operation_id, nullptr) == 0;
return false;
}
if (!isEnabled(operation_id)) return;
void ReportActivity(const amd::Command& command) {
assert(command.profilingInfo().enabled_ && "profiling must be enabled for this command");
auto operation_id = OperationId(command.type());
if (operation_id >= OP_ID_NUMBER)
// This command does not translate into a profiler activity (dispatch, memcopy, etc...), there
// is nothing to report to the profiler.
return;
auto function = report_activity.load(std::memory_order_relaxed);
if (!function) return;
const auto* queue = command.queue();
assert(queue != nullptr);
activity_record_t record{
ACTIVITY_DOMAIN_HIP_VDI, // activity domain
ACTIVITY_DOMAIN_HIP_OPS, // activity domain
command.type(), // activity kind
operation_id, // operation id
command.profilingInfo().correlation_id_, // activity correlation id
@@ -84,11 +100,9 @@ void CallbacksTable::reportActivity(const amd::Command& command) {
break;
}
table_.activity_callback.first(operation_id, &record, table_.activity_callback.second);
function(ACTIVITY_DOMAIN_HIP_OPS, operation_id, &record);
}
decltype(CallbacksTable::table_) CallbacksTable::table_;
#endif // USE_PROF_API
} // namespace activity_prof