Add ROCtracer version information

Change-Id: I10b268790d2dc4f3a3ad8624b2f553da6f3ccc8e
Este commit está contenido en:
Laurent Morichetti
2022-05-23 20:38:54 -07:00
cometido por Laurent Morichetti
padre 1e8e53da1d
commit 1c450082af
Se han modificado 6 ficheros con 297 adiciones y 257 borrados
+58 -61
Ver fichero
@@ -43,10 +43,6 @@
#include "exception.h"
#include "util/logger.h"
#define PUBLIC_API __attribute__((visibility("default")))
#define CONSTRUCTOR_API __attribute__((constructor))
#define DESTRUCTOR_API __attribute__((destructor))
#define CHECK_HSA_STATUS(msg, status) \
do { \
if ((status) != HSA_STATUS_SUCCESS) { \
@@ -520,17 +516,17 @@ LOADER_INSTANTIATE();
//
// Returns library version
PUBLIC_API uint32_t roctracer_version_major() { return ROCTRACER_VERSION_MAJOR; }
PUBLIC_API uint32_t roctracer_version_minor() { return ROCTRACER_VERSION_MINOR; }
ROCTRACER_API uint32_t roctracer_version_major() { return ROCTRACER_VERSION_MAJOR; }
ROCTRACER_API uint32_t roctracer_version_minor() { return ROCTRACER_VERSION_MINOR; }
// Returns the last error
PUBLIC_API const char* roctracer_error_string() {
ROCTRACER_API const char* roctracer_error_string() {
return strdup(util::Logger::LastMessage().c_str());
}
// Return Op string by given domain and activity/API codes
// nullptr returned on the error and the library errno is set
PUBLIC_API const char* roctracer_op_string(uint32_t domain, uint32_t op, uint32_t kind) {
ROCTRACER_API const char* roctracer_op_string(uint32_t domain, uint32_t op, uint32_t kind) {
API_METHOD_PREFIX
switch (domain) {
case ACTIVITY_DOMAIN_HSA_API:
@@ -552,8 +548,8 @@ PUBLIC_API const char* roctracer_op_string(uint32_t domain, uint32_t op, uint32_
}
// Return Op code and kind by given string
PUBLIC_API roctracer_status_t roctracer_op_code(uint32_t domain, const char* str, uint32_t* op,
uint32_t* kind) {
ROCTRACER_API roctracer_status_t roctracer_op_code(uint32_t domain, const char* str, uint32_t* op,
uint32_t* kind) {
API_METHOD_PREFIX
switch (domain) {
case ACTIVITY_DOMAIN_HSA_API: {
@@ -687,17 +683,17 @@ static void roctracer_enable_callback_impl(roctracer_domain_t domain, uint32_t o
roctracer_enable_callback_fun(domain, op, callback, user_data);
}
PUBLIC_API roctracer_status_t roctracer_enable_op_callback(roctracer_domain_t domain, uint32_t op,
roctracer_rtapi_callback_t callback,
void* user_data) {
ROCTRACER_API roctracer_status_t roctracer_enable_op_callback(roctracer_domain_t domain,
uint32_t op,
roctracer_rtapi_callback_t callback,
void* user_data) {
API_METHOD_PREFIX
roctracer_enable_callback_impl(domain, op, callback, user_data);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_enable_domain_callback(roctracer_domain_t domain,
roctracer_rtapi_callback_t callback,
void* user_data) {
ROCTRACER_API roctracer_status_t roctracer_enable_domain_callback(
roctracer_domain_t domain, roctracer_rtapi_callback_t callback, void* user_data) {
API_METHOD_PREFIX
const uint32_t op_end = get_op_end(domain);
for (uint32_t op = get_op_begin(domain); op < op_end; ++op)
@@ -705,8 +701,8 @@ PUBLIC_API roctracer_status_t roctracer_enable_domain_callback(roctracer_domain_
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_enable_callback(roctracer_rtapi_callback_t callback,
void* user_data) {
ROCTRACER_API roctracer_status_t roctracer_enable_callback(roctracer_rtapi_callback_t callback,
void* user_data) {
API_METHOD_PREFIX
for (uint32_t domain = 0; domain < ACTIVITY_DOMAIN_NUMBER; ++domain) {
const uint32_t op_end = get_op_end(domain);
@@ -771,14 +767,14 @@ static void roctracer_disable_callback_impl(roctracer_domain_t domain, uint32_t
roctracer_disable_callback_fun(domain, op);
}
PUBLIC_API roctracer_status_t roctracer_disable_op_callback(roctracer_domain_t domain,
uint32_t op) {
ROCTRACER_API roctracer_status_t roctracer_disable_op_callback(roctracer_domain_t domain,
uint32_t op) {
API_METHOD_PREFIX
roctracer_disable_callback_impl(domain, op);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_disable_domain_callback(roctracer_domain_t domain) {
ROCTRACER_API roctracer_status_t roctracer_disable_domain_callback(roctracer_domain_t domain) {
API_METHOD_PREFIX
const uint32_t op_end = get_op_end(domain);
for (uint32_t op = get_op_begin(domain); op < op_end; ++op)
@@ -786,7 +782,7 @@ PUBLIC_API roctracer_status_t roctracer_disable_domain_callback(roctracer_domain
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_disable_callback() {
ROCTRACER_API roctracer_status_t roctracer_disable_callback() {
API_METHOD_PREFIX
for (uint32_t domain = 0; domain < ACTIVITY_DOMAIN_NUMBER; ++domain) {
const uint32_t op_end = get_op_end(domain);
@@ -797,14 +793,14 @@ PUBLIC_API roctracer_status_t roctracer_disable_callback() {
}
// Return default pool and set new one if parameter pool is not NULL.
PUBLIC_API roctracer_pool_t* roctracer_default_pool_expl(roctracer_pool_t* pool) {
ROCTRACER_API roctracer_pool_t* roctracer_default_pool_expl(roctracer_pool_t* pool) {
std::lock_guard lock(memory_pool_mutex);
roctracer_pool_t* p = reinterpret_cast<roctracer_pool_t*>(default_memory_pool);
if (pool != nullptr) default_memory_pool = reinterpret_cast<MemoryPool*>(pool);
return p;
}
PUBLIC_API roctracer_pool_t* roctracer_default_pool() {
ROCTRACER_API roctracer_pool_t* roctracer_default_pool() {
std::lock_guard lock(memory_pool_mutex);
return reinterpret_cast<roctracer_pool_t*>(default_memory_pool);
}
@@ -824,21 +820,21 @@ static void roctracer_open_pool_impl(const roctracer_properties_t* properties,
default_memory_pool = p;
}
PUBLIC_API roctracer_status_t roctracer_open_pool_expl(const roctracer_properties_t* properties,
roctracer_pool_t** pool) {
ROCTRACER_API roctracer_status_t roctracer_open_pool_expl(const roctracer_properties_t* properties,
roctracer_pool_t** pool) {
API_METHOD_PREFIX
roctracer_open_pool_impl(properties, pool);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_open_pool(const roctracer_properties_t* properties) {
ROCTRACER_API roctracer_status_t roctracer_open_pool(const roctracer_properties_t* properties) {
API_METHOD_PREFIX
roctracer_open_pool_impl(properties, nullptr);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_next_record(const activity_record_t* record,
const activity_record_t** next) {
ROCTRACER_API roctracer_status_t roctracer_next_record(const activity_record_t* record,
const activity_record_t** next) {
API_METHOD_PREFIX
*next = record + 1;
API_METHOD_SUFFIX
@@ -912,15 +908,16 @@ static void roctracer_enable_activity_impl(roctracer_domain_t domain, uint32_t o
roctracer_enable_activity_fun(domain, op, pool);
}
PUBLIC_API roctracer_status_t roctracer_enable_op_activity_expl(roctracer_domain_t domain,
uint32_t op,
roctracer_pool_t* pool) {
ROCTRACER_API roctracer_status_t roctracer_enable_op_activity_expl(roctracer_domain_t domain,
uint32_t op,
roctracer_pool_t* pool) {
API_METHOD_PREFIX
roctracer_enable_activity_impl(domain, op, pool);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_enable_op_activity(activity_domain_t domain, uint32_t op) {
ROCTRACER_API roctracer_status_t roctracer_enable_op_activity(activity_domain_t domain,
uint32_t op) {
API_METHOD_PREFIX
roctracer_enable_activity_impl(domain, op, nullptr);
API_METHOD_SUFFIX
@@ -933,14 +930,14 @@ static void roctracer_enable_domain_activity_impl(roctracer_domain_t domain,
roctracer_enable_activity_impl(domain, op, pool);
}
PUBLIC_API roctracer_status_t roctracer_enable_domain_activity_expl(roctracer_domain_t domain,
roctracer_pool_t* pool) {
ROCTRACER_API roctracer_status_t roctracer_enable_domain_activity_expl(roctracer_domain_t domain,
roctracer_pool_t* pool) {
API_METHOD_PREFIX
roctracer_enable_domain_activity_impl(domain, pool);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_enable_domain_activity(activity_domain_t domain) {
ROCTRACER_API roctracer_status_t roctracer_enable_domain_activity(activity_domain_t domain) {
API_METHOD_PREFIX
roctracer_enable_domain_activity_impl(domain, nullptr);
API_METHOD_SUFFIX
@@ -954,13 +951,13 @@ static void roctracer_enable_activity_impl(roctracer_pool_t* pool) {
}
}
PUBLIC_API roctracer_status_t roctracer_enable_activity_expl(roctracer_pool_t* pool) {
ROCTRACER_API roctracer_status_t roctracer_enable_activity_expl(roctracer_pool_t* pool) {
API_METHOD_PREFIX
roctracer_enable_activity_impl(pool);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_enable_activity() {
ROCTRACER_API roctracer_status_t roctracer_enable_activity() {
API_METHOD_PREFIX
roctracer_enable_activity_impl(nullptr);
API_METHOD_SUFFIX
@@ -1019,14 +1016,14 @@ static void roctracer_disable_activity_impl(roctracer_domain_t domain, uint32_t
roctracer_disable_activity_fun(domain, op);
}
PUBLIC_API roctracer_status_t roctracer_disable_op_activity(roctracer_domain_t domain,
uint32_t op) {
ROCTRACER_API roctracer_status_t roctracer_disable_op_activity(roctracer_domain_t domain,
uint32_t op) {
API_METHOD_PREFIX
roctracer_disable_activity_impl(domain, op);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_disable_domain_activity(roctracer_domain_t domain) {
ROCTRACER_API roctracer_status_t roctracer_disable_domain_activity(roctracer_domain_t domain) {
API_METHOD_PREFIX
const uint32_t op_end = get_op_end(domain);
for (uint32_t op = get_op_begin(domain); op < op_end; ++op)
@@ -1034,7 +1031,7 @@ PUBLIC_API roctracer_status_t roctracer_disable_domain_activity(roctracer_domain
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_disable_activity() {
ROCTRACER_API roctracer_status_t roctracer_disable_activity() {
API_METHOD_PREFIX
for (uint32_t domain = 0; domain < ACTIVITY_DOMAIN_NUMBER; ++domain) {
const uint32_t op_end = get_op_end(domain);
@@ -1064,13 +1061,13 @@ static void roctracer_close_pool_impl(roctracer_pool_t* pool) {
delete (p);
}
PUBLIC_API roctracer_status_t roctracer_close_pool_expl(roctracer_pool_t* pool) {
ROCTRACER_API roctracer_status_t roctracer_close_pool_expl(roctracer_pool_t* pool) {
API_METHOD_PREFIX
roctracer_close_pool_impl(pool);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_close_pool() {
ROCTRACER_API roctracer_status_t roctracer_close_pool() {
API_METHOD_PREFIX
roctracer_close_pool_impl(NULL);
API_METHOD_SUFFIX
@@ -1083,13 +1080,13 @@ static void roctracer_flush_activity_impl(roctracer_pool_t* pool) {
if (default_memory_pool != nullptr) default_memory_pool->Flush();
}
PUBLIC_API roctracer_status_t roctracer_flush_activity_expl(roctracer_pool_t* pool) {
ROCTRACER_API roctracer_status_t roctracer_flush_activity_expl(roctracer_pool_t* pool) {
API_METHOD_PREFIX
roctracer_flush_activity_impl(pool);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_flush_activity() {
ROCTRACER_API roctracer_status_t roctracer_flush_activity() {
API_METHOD_PREFIX
roctracer_flush_activity_impl(nullptr);
API_METHOD_SUFFIX
@@ -1097,7 +1094,7 @@ PUBLIC_API roctracer_status_t roctracer_flush_activity() {
// Notifies that the calling thread is entering an external API region.
// Push an external correlation id for the calling thread.
PUBLIC_API roctracer_status_t
ROCTRACER_API roctracer_status_t
roctracer_activity_push_external_correlation_id(activity_correlation_id_t id) {
API_METHOD_PREFIX
external_id_stack.push(id);
@@ -1107,7 +1104,7 @@ roctracer_activity_push_external_correlation_id(activity_correlation_id_t id) {
// Notifies that the calling thread is leaving an external API region.
// Pop an external correlation id for the calling thread.
// 'lastId' returns the last external correlation
PUBLIC_API roctracer_status_t
ROCTRACER_API roctracer_status_t
roctracer_activity_pop_external_correlation_id(activity_correlation_id_t* last_id) {
API_METHOD_PREFIX
if (last_id != nullptr) *last_id = 0;
@@ -1119,8 +1116,8 @@ roctracer_activity_pop_external_correlation_id(activity_correlation_id_t* last_i
API_METHOD_SUFFIX
}
// Mark API
extern "C" PUBLIC_API void roctracer_mark(const char* str) {
// Mark API (FIXME: why isn't it in the roctracer_ext.h header?)
extern "C" ROCTRACER_API void roctracer_mark(const char* str) {
if (mark_api_callback_ptr) {
mark_api_callback_ptr(ACTIVITY_DOMAIN_EXT_API, ACTIVITY_EXT_OP_MARK, str, nullptr);
NextCorrelationId(); // account for user-defined markers when tracking
@@ -1129,7 +1126,7 @@ extern "C" PUBLIC_API void roctracer_mark(const char* str) {
}
// Start API
PUBLIC_API void roctracer_start() {
ROCTRACER_API void roctracer_start() {
if (set_stopped(0)) {
if (ext_support::roctracer_start_cb) ext_support::roctracer_start_cb();
cb_journal.ForEach([](roctracer_domain_t domain, uint32_t op, const CallbackJournalData& data) {
@@ -1145,7 +1142,7 @@ PUBLIC_API void roctracer_start() {
}
// Stop API
PUBLIC_API void roctracer_stop() {
ROCTRACER_API void roctracer_stop() {
if (set_stopped(1)) {
// Must disable the activity first as the spawner checks for the activity being NULL
// to indicate that there is no callback.
@@ -1161,15 +1158,15 @@ PUBLIC_API void roctracer_stop() {
}
}
PUBLIC_API roctracer_status_t roctracer_get_timestamp(uint64_t* timestamp) {
ROCTRACER_API roctracer_status_t roctracer_get_timestamp(uint64_t* timestamp) {
API_METHOD_PREFIX
*timestamp = util::timestamp_ns();
API_METHOD_SUFFIX
}
// Set properties
PUBLIC_API roctracer_status_t roctracer_set_properties(roctracer_domain_t domain,
void* properties) {
ROCTRACER_API roctracer_status_t roctracer_set_properties(roctracer_domain_t domain,
void* properties) {
API_METHOD_PREFIX
switch (domain) {
case ACTIVITY_DOMAIN_HSA_OPS: {
@@ -1219,24 +1216,24 @@ PUBLIC_API roctracer_status_t roctracer_set_properties(roctracer_domain_t domain
API_METHOD_SUFFIX
}
CONSTRUCTOR_API void constructor() {
__attribute__((constructor)) void constructor() {
ONLOAD_TRACE_BEG();
util::Logger::Create();
ONLOAD_TRACE_END();
}
DESTRUCTOR_API void destructor() {
__attribute__((destructor)) void destructor() {
ONLOAD_TRACE_BEG();
util::Logger::Destroy();
ONLOAD_TRACE_END();
}
// HSA-runtime tool on-load method
extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
uint64_t failed_tool_count,
const char* const* failed_tool_names) {
extern "C" ROCTRACER_EXPORT bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
uint64_t failed_tool_count,
const char* const* failed_tool_names) {
hsa_support::SaveHsaApi(table);
return true;
}
extern "C" PUBLIC_API void OnUnload() {}
extern "C" ROCTRACER_EXPORT void OnUnload() {}
+34 -39
Ver fichero
@@ -27,7 +27,6 @@
#include <cxxabi.h> /* names denangle */
#include <dirent.h>
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -46,23 +45,19 @@
#include "trace_buffer.h"
#include "evt_stats.h"
#define PUBLIC_API __attribute__((visibility("default")))
#define CONSTRUCTOR_API __attribute__((constructor))
#define DESTRUCTOR_API __attribute__((destructor))
// Linux sys call
#define PTHREAD_CALL(call) \
do { \
int err = call; \
if (err != 0) { \
errno = err; \
perror(#call); \
abort(); \
} \
} while (0)
#if !defined(ROCTRACER_TOOL_EXPORT)
#if defined(__GNUC__)
#define ROCTRACER_TOOL_EXPORT __attribute__((visibility("default")))
#elif defined(_MSC_VER)
#define ROCTRACER_TOOL_EXPORT __declspec(dllexport)
#endif /* defined (_MSC_VER) */
#endif /* !defined (ROCTRACER_TOOL_EXPORT) */
// Macro to check ROC-tracer calls status
#define ROCTRACER_CALL(call) \
#define CHECK_ROCTRACER(call) \
do { \
int err = call; \
if (err != 0) { \
@@ -107,7 +102,7 @@ namespace util {
inline timestamp_t timestamp_ns() {
timestamp_t timestamp;
ROCTRACER_CALL(roctracer_get_timestamp(&timestamp));
CHECK_ROCTRACER(roctracer_get_timestamp(&timestamp));
return timestamp;
}
@@ -215,7 +210,7 @@ std::atomic_bool stop_flush_thread = false;
void flush_thr_fun() {
while (!stop_flush_thread) {
ROCTRACER_CALL(roctracer_flush_activity());
CHECK_ROCTRACER(roctracer_flush_activity());
roctracer::TraceBufferBase::FlushAll();
std::this_thread::sleep_until(std::chrono::steady_clock::now() +
std::chrono::microseconds(control_flush_us));
@@ -566,7 +561,7 @@ void pool_activity_callback(const char* begin, const char* end, void* arg) {
}
break;
}
ROCTRACER_CALL(roctracer_next_record(record, &record));
CHECK_ROCTRACER(roctracer_next_record(record, &record));
}
}
@@ -662,15 +657,15 @@ void open_tracing_pool() {
roctracer_properties_t properties{};
properties.buffer_size = 0x80000;
properties.buffer_callback_fun = pool_activity_callback;
ROCTRACER_CALL(roctracer_open_pool(&properties));
CHECK_ROCTRACER(roctracer_open_pool(&properties));
}
}
// Flush tracing pool
void close_tracing_pool() {
if (roctracer_pool_t* pool = roctracer_default_pool(); pool != nullptr) {
ROCTRACER_CALL(roctracer_flush_activity_expl(pool));
ROCTRACER_CALL(roctracer_close_pool_expl(pool));
CHECK_ROCTRACER(roctracer_flush_activity_expl(pool));
CHECK_ROCTRACER(roctracer_close_pool_expl(pool));
}
}
@@ -699,18 +694,18 @@ void tool_unload() {
}
if (trace_roctx) {
ROCTRACER_CALL(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_ROCTX));
CHECK_ROCTRACER(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_ROCTX));
}
if (trace_hsa_api) {
ROCTRACER_CALL(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HSA_API));
CHECK_ROCTRACER(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HSA_API));
}
if (trace_hsa_activity || trace_pcs) {
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HSA_OPS));
CHECK_ROCTRACER(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HSA_OPS));
}
if (trace_hip_api || trace_hip_activity) {
ROCTRACER_CALL(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HIP_API));
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HIP_API));
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HIP_OPS));
CHECK_ROCTRACER(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HIP_API));
CHECK_ROCTRACER(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HIP_API));
CHECK_ROCTRACER(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HIP_OPS));
}
// Flush tracing pool
@@ -836,7 +831,7 @@ void tool_load() {
// initialize HSA tracing
fprintf(stdout, " rocTX-trace()\n");
fflush(stdout);
ROCTRACER_CALL(
CHECK_ROCTRACER(
roctracer_enable_domain_callback(ACTIVITY_DOMAIN_ROCTX, roctx_api_callback, NULL));
}
@@ -884,9 +879,9 @@ void tool_load() {
}
// HSA-runtime tool on-load method
extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
uint64_t failed_tool_count,
const char* const* failed_tool_names) {
extern "C" ROCTRACER_TOOL_EXPORT bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
uint64_t failed_tool_count,
const char* const* failed_tool_names) {
ONLOAD_TRACE_BEG();
const char* output_prefix = getenv("ROCP_OUTPUT_DIR");
@@ -932,13 +927,13 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
for (unsigned i = 0; i < hsa_api_vec().size(); ++i) {
uint32_t cid = HSA_API_ID_NUMBER;
const char* api = hsa_api_vec()[i].c_str();
ROCTRACER_CALL(roctracer_op_code(ACTIVITY_DOMAIN_HSA_API, api, &cid, NULL));
ROCTRACER_CALL(
CHECK_ROCTRACER(roctracer_op_code(ACTIVITY_DOMAIN_HSA_API, api, &cid, NULL));
CHECK_ROCTRACER(
roctracer_enable_op_callback(ACTIVITY_DOMAIN_HSA_API, cid, hsa_api_callback, NULL));
printf(" %s", api);
}
} else {
ROCTRACER_CALL(
CHECK_ROCTRACER(
roctracer_enable_domain_callback(ACTIVITY_DOMAIN_HSA_API, hsa_api_callback, NULL));
}
printf(")\n");
@@ -958,7 +953,7 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
fprintf(stdout, " HSA-activity-trace()\n");
fflush(stdout);
ROCTRACER_CALL(roctracer_enable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_COPY));
CHECK_ROCTRACER(roctracer_enable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_COPY));
}
// Enable HIP API callbacks/activity
@@ -983,13 +978,13 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
for (unsigned i = 0; i < hip_api_vec().size(); ++i) {
uint32_t cid = HIP_API_ID_NONE;
const char* api = hip_api_vec()[i].c_str();
ROCTRACER_CALL(roctracer_op_code(ACTIVITY_DOMAIN_HIP_API, api, &cid, NULL));
ROCTRACER_CALL(
CHECK_ROCTRACER(roctracer_op_code(ACTIVITY_DOMAIN_HIP_API, api, &cid, NULL));
CHECK_ROCTRACER(
roctracer_enable_op_callback(ACTIVITY_DOMAIN_HIP_API, cid, hip_api_callback, NULL));
printf(" %s", api);
}
} else {
ROCTRACER_CALL(
CHECK_ROCTRACER(
roctracer_enable_domain_callback(ACTIVITY_DOMAIN_HIP_API, hip_api_callback, NULL));
}
@@ -1006,7 +1001,7 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
if (trace_hip_activity) {
hcc_activity_file_handle = open_output_file(output_prefix, "hcc_ops_trace.txt");
ROCTRACER_CALL(roctracer_enable_domain_activity(ACTIVITY_DOMAIN_HIP_OPS));
CHECK_ROCTRACER(roctracer_enable_domain_activity(ACTIVITY_DOMAIN_HIP_OPS));
if (is_stats_opt) {
FILE* f = NULL;
@@ -1025,7 +1020,7 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
fflush(stdout);
open_tracing_pool();
pc_sample_file_handle = open_output_file(output_prefix, "pcs_trace.txt");
ROCTRACER_CALL(roctracer_enable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_RESERVED1));
CHECK_ROCTRACER(roctracer_enable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_RESERVED1));
}
ONLOAD_TRACE_END();
@@ -1033,7 +1028,7 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
}
// HSA-runtime on-unload method
extern "C" PUBLIC_API void OnUnload() { ONLOAD_TRACE(""); }
extern "C" ROCTRACER_TOOL_EXPORT void OnUnload() { ONLOAD_TRACE(""); }
extern "C" CONSTRUCTOR_API void constructor() {
ONLOAD_TRACE_BEG();