SWDEV-351980 - Move hip_api_data and record to the HIP function's stack

Since the hip_api_data and record are only needed at the HIP function's
scope, there is no need to allocate/free them in the ROCtracer activity
callback, they can reside on the HIP function's stack frame.

This solves an issue with the thread local stacks of records the tracer
maintains that are destroyed first (before any global destructor) on
process exit, making it impossible to use HIP functions in global
destructors when the profiler is enabled.

Change-Id: Ib1d70124d009a44dc1f08d41edff95e5f9f84369
Этот коммит содержится в:
Laurent Morichetti authored and Maneesh Gupta committed 2022-09-21 02:41:15 -04:00
1 родитель 42b5a6d5af
Коммит 85fd969253
2 files changed
+34 -37

No files matched your search

+4 -5
Просмотреть файл
@@ -20,16 +20,15 @@
#include "platform/activity.hpp"
extern "C" void hipInitActivityCallback(void* id_callback, void* op_callback, void* arg) {
activity_prof::CallbacksTable::init(reinterpret_cast<activity_prof::id_callback_fun_t>(id_callback),
reinterpret_cast<activity_prof::callback_fun_t>(op_callback),
extern "C" void hipInitActivityCallback(void* op_callback, void* arg) {
activity_prof::CallbacksTable::init(reinterpret_cast<activity_async_callback_t>(op_callback),
arg);
}
extern "C" bool hipEnableActivityCallback(unsigned op, bool enable) {
return activity_prof::CallbacksTable::SetEnabled(op, enable);
return activity_prof::CallbacksTable::setEnabled(static_cast<OpId>(op), enable);
}
extern "C" const char* hipGetCmdName(unsigned op) {
return getOclCommandKindString(static_cast<uint32_t>(op));
return getOclCommandKindString(static_cast<cl_command_type>(op));
}