Fixing issues caused by the plugin patches

- Multithreaded Applications and plugin destruction
- Fixing Async-copy trace in file plugin
- Adding the assert checkups for every trace buffer flush function

Change-Id: I96e096fd7ee2604931200a0b446edb5ce49959dd


[ROCm/roctracer commit: 4cd7497a87]
This commit is contained in:
Ammar ELWazir
2022-08-18 21:46:58 -05:00
zatwierdzone przez Ammar Elwazir
rodzic dfc856d164
commit 699d17b733
2 zmienionych plików z 9 dodań i 8 usunięć
+1 -1
Wyświetl plik
@@ -322,7 +322,7 @@ class file_plugin_t {
output_file = get_output_file(ACTIVITY_DOMAIN_HSA_OPS, begin->op);
if (begin->op == HSA_OP_ID_COPY) {
*output_file << std::dec << begin->begin_ns << ":" << begin->end_ns
<< " async-copy:" << begin->correlation_id << " " << GetPid() << std::endl;
<< " async-copy:" << begin->correlation_id << ":" << GetPid() << std::endl;
break;
} else if (begin->op == HSA_OP_ID_RESERVED1) {
*output_file << std::dec << begin->pc_sample.se << " " << begin->pc_sample.cycle << " "
@@ -222,11 +222,11 @@ struct roctx_trace_entry_t {
}
};
roctracer::TraceBuffer<roctx_trace_entry_t> roctx_trace_buffer("rocTX API", 0x200000,
[](roctx_trace_entry_t* entry) {
plugin->write_callback_record(
&entry->record, &entry->data);
});
roctracer::TraceBuffer<roctx_trace_entry_t> roctx_trace_buffer(
"rocTX API", 0x200000, [](roctx_trace_entry_t* entry) {
assert(plugin && "plugin is not initialized");
plugin->write_callback_record(&entry->record, &entry->data);
});
// rocTX callback function
void roctx_api_callback(uint32_t domain, uint32_t cid, const void* callback_data,
@@ -265,6 +265,7 @@ struct hsa_api_trace_entry_t {
roctracer::TraceBuffer<hsa_api_trace_entry_t> hsa_api_trace_buffer(
"HSA API", 0x200000, [](hsa_api_trace_entry_t* entry) {
assert(plugin && "plugin is not initialized");
plugin->write_callback_record(&entry->record, &entry->data);
});
@@ -400,6 +401,7 @@ static std::optional<std::string> getKernelName(uint32_t cid, const hip_api_data
roctracer::TraceBuffer<hip_api_trace_entry_t> hip_api_trace_buffer(
"HIP API", 0x200000, [](hip_api_trace_entry_t* entry) {
assert(plugin && "plugin is not initialized");
plugin->write_callback_record(&entry->record, &entry->data);
});
@@ -495,6 +497,7 @@ void open_tracing_pool() {
roctracer_properties_t properties{};
properties.buffer_size = 0x80000;
properties.buffer_callback_fun = [](const char* begin, const char* end, void* /* arg */) {
assert(plugin && "plugin is not initialized");
plugin->write_activity_records(reinterpret_cast<const roctracer_record_t*>(begin),
reinterpret_cast<const roctracer_record_t*>(end));
};
@@ -550,8 +553,6 @@ void tool_unload() {
// Flush tracing pool
close_tracing_pool();
roctracer::TraceBufferBase::FlushAll();
plugin.reset();
}
// tool load method