SWDEV-295205 - Remove KFD domain from roctracer
Change-Id: I2771cf43aa115bb466531bf887f7cc75e187f2ef
This commit is contained in:
@@ -46,7 +46,7 @@ $(EXECUTABLE): $(OBJECTS)
|
||||
$(HIPCC) $(OBJECTS) -o $@ $(ROC_LIBS)
|
||||
|
||||
test: $(EXECUTABLE)
|
||||
LD_PRELOAD="$(LIB_PATH)/libkfdwrapper64.so librocprofiler64.so" $(EXECUTABLE)
|
||||
LD_PRELOAD="librocprofiler64.so" $(EXECUTABLE)
|
||||
|
||||
clean:
|
||||
rm -f $(EXECUTABLE)
|
||||
|
||||
@@ -234,7 +234,6 @@ int main() {
|
||||
#include <roctracer_hip.h>
|
||||
#include <roctracer_hcc.h>
|
||||
#include <roctracer_hsa.h>
|
||||
#include <roctracer_kfd.h>
|
||||
#include <roctracer_roctx.h>
|
||||
|
||||
#include <unistd.h>
|
||||
@@ -268,15 +267,6 @@ void api_callback(
|
||||
fprintf(stdout, "rocTX <\"%s pid(%d) tid(%d)\">\n", data->args.message, GetPid(), GetTid());
|
||||
return;
|
||||
}
|
||||
if (domain == ACTIVITY_DOMAIN_KFD_API) {
|
||||
const kfd_api_data_t* data = (const kfd_api_data_t*)(callback_data);
|
||||
fprintf(stdout, "<%s id(%u)\tcorrelation_id(%lu) %s pid(%d) tid(%d)>\n",
|
||||
roctracer_op_string(ACTIVITY_DOMAIN_KFD_API, cid, 0),
|
||||
cid,
|
||||
data->correlation_id,
|
||||
(data->phase == ACTIVITY_API_PHASE_ENTER) ? "on-enter" : "on-exit", GetPid(), GetTid());
|
||||
return;
|
||||
}
|
||||
const hip_api_data_t* data = (const hip_api_data_t*)(callback_data);
|
||||
SPRINT("<%s id(%u)\tcorrelation_id(%lu) %s pid(%d) tid(%d)> ",
|
||||
roctracer_op_string(ACTIVITY_DOMAIN_HIP_API, cid, 0),
|
||||
@@ -334,7 +324,7 @@ void activity_callback(const char* begin, const char* end, void* arg) {
|
||||
record->correlation_id,
|
||||
record->begin_ns,
|
||||
record->end_ns);
|
||||
if ((record->domain == ACTIVITY_DOMAIN_HIP_API) || (record->domain == ACTIVITY_DOMAIN_KFD_API)) {
|
||||
if (record->domain == ACTIVITY_DOMAIN_HIP_API) {
|
||||
SPRINT(" process_id(%u) thread_id(%u)",
|
||||
record->process_id,
|
||||
record->thread_id);
|
||||
@@ -381,8 +371,6 @@ void init_tracing() {
|
||||
ROCTRACER_CALL(roctracer_enable_domain_activity(ACTIVITY_DOMAIN_HCC_OPS));
|
||||
// Enable PC sampling
|
||||
ROCTRACER_CALL(roctracer_enable_op_activity(ACTIVITY_DOMAIN_HSA_OPS, HSA_OP_ID_RESERVED1));
|
||||
// Enable KFD API tracing
|
||||
ROCTRACER_CALL(roctracer_enable_domain_callback(ACTIVITY_DOMAIN_KFD_API, api_callback, NULL));
|
||||
// Enable rocTX
|
||||
ROCTRACER_CALL(roctracer_enable_domain_callback(ACTIVITY_DOMAIN_ROCTX, api_callback, NULL));
|
||||
}
|
||||
@@ -403,7 +391,6 @@ void stop_tracing() {
|
||||
#endif
|
||||
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HCC_OPS));
|
||||
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HSA_OPS));
|
||||
ROCTRACER_CALL(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_KFD_API));
|
||||
ROCTRACER_CALL(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_ROCTX));
|
||||
ROCTRACER_CALL(roctracer_flush_activity());
|
||||
printf("# STOP #############################\n");
|
||||
|
||||
+4
-7
@@ -112,18 +112,15 @@ eval_test "ctrl dry run" ./test/hsa/ctrl ctrl_dryrun_trace
|
||||
|
||||
# Standalone test
|
||||
# rocTrecer is used explicitely by test
|
||||
eval_test "standalone C test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose_ctest" MatrixTranspose_ctest_trace
|
||||
eval_test "standalone HIP test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose_test" MatrixTranspose_test_trace
|
||||
eval_test "standalone HIP hipaact test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose_hipaact_test" MatrixTranspose_hipaact_test_trace
|
||||
eval_test "standalone HIP MGPU test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose_mgpu" MatrixTranspose_mgpu_trace
|
||||
eval_test "standalone C test" "./test/MatrixTranspose_ctest" MatrixTranspose_ctest_trace
|
||||
eval_test "standalone HIP test" "./test/MatrixTranspose_test" MatrixTranspose_test_trace
|
||||
eval_test "standalone HIP hipaact test" "./test/MatrixTranspose_hipaact_test" MatrixTranspose_hipaact_test_trace
|
||||
eval_test "standalone HIP MGPU test" "./test/MatrixTranspose_mgpu" MatrixTranspose_mgpu_trace
|
||||
|
||||
# Tool test
|
||||
# rocTracer/tool is loaded by HSA runtime
|
||||
export HSA_TOOLS_LIB="$ROCTRACER_TOOL_PATH/libtracer_tool.so"
|
||||
|
||||
# KFD test
|
||||
export ROCTRACER_DOMAIN="kfd"
|
||||
eval_test "tool KFD test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose" MatrixTranspose_kfd_trace
|
||||
# SYS test
|
||||
export ROCTRACER_DOMAIN="sys:roctx"
|
||||
eval_test "tool SYS test" ./test/MatrixTranspose MatrixTranspose_sys_trace
|
||||
|
||||
@@ -38,7 +38,6 @@ THE SOFTWARE.
|
||||
#include <roctracer_hsa.h>
|
||||
#include <roctracer_hip.h>
|
||||
#include <roctracer_hcc.h>
|
||||
#include <roctracer_kfd.h>
|
||||
#include <ext/hsa_rt_utils.hpp>
|
||||
|
||||
#include "src/core/loader.h"
|
||||
@@ -101,17 +100,14 @@ typedef hsa_rt_utils::Timer::timestamp_t timestamp_t;
|
||||
hsa_rt_utils::Timer* timer = NULL;
|
||||
thread_local timestamp_t hsa_begin_timestamp = 0;
|
||||
thread_local timestamp_t hip_begin_timestamp = 0;
|
||||
thread_local timestamp_t kfd_begin_timestamp = 0;
|
||||
bool trace_roctx = false;
|
||||
bool trace_hsa_api = false;
|
||||
bool trace_hsa_activity = false;
|
||||
bool trace_hip_api = false;
|
||||
bool trace_hip_activity = false;
|
||||
bool trace_kfd = false;
|
||||
bool trace_pcs = false;
|
||||
// API trace vector
|
||||
std::vector<std::string> hsa_api_vec;
|
||||
std::vector<std::string> kfd_api_vec;
|
||||
std::vector<std::string> hip_api_vec;
|
||||
|
||||
LOADER_INSTANTIATE();
|
||||
@@ -130,7 +126,6 @@ FILE* hsa_api_file_handle = NULL;
|
||||
FILE* hsa_async_copy_file_handle = NULL;
|
||||
FILE* hip_api_file_handle = NULL;
|
||||
FILE* hcc_activity_file_handle = NULL;
|
||||
FILE* kfd_api_file_handle = NULL;
|
||||
FILE* pc_sample_file_handle = NULL;
|
||||
|
||||
void close_output_file(FILE* file_handle);
|
||||
@@ -141,7 +136,6 @@ void close_file_handles() {
|
||||
if (hsa_async_copy_file_handle) close_output_file(hsa_async_copy_file_handle);
|
||||
if (hip_api_file_handle) close_output_file(hip_api_file_handle);
|
||||
if (hcc_activity_file_handle) close_output_file(hcc_activity_file_handle);
|
||||
if (kfd_api_file_handle) close_output_file(kfd_api_file_handle);
|
||||
if (pc_sample_file_handle) close_output_file(pc_sample_file_handle);
|
||||
}
|
||||
|
||||
@@ -657,32 +651,6 @@ void pool_activity_callback(const char* begin, const char* end, void* arg) {
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// KFD API tracing
|
||||
|
||||
// KFD API callback function
|
||||
static thread_local bool in_kfd_api_callback = false;
|
||||
void kfd_api_callback(
|
||||
uint32_t domain,
|
||||
uint32_t cid,
|
||||
const void* callback_data,
|
||||
void* arg)
|
||||
{
|
||||
(void)arg;
|
||||
if (in_kfd_api_callback) return;
|
||||
in_kfd_api_callback = true;
|
||||
const kfd_api_data_t* data = reinterpret_cast<const kfd_api_data_t*>(callback_data);
|
||||
if (data->phase == ACTIVITY_API_PHASE_ENTER) {
|
||||
kfd_begin_timestamp = timer->timestamp_fn_ns();
|
||||
} else {
|
||||
const timestamp_t end_timestamp = timer->timestamp_fn_ns();
|
||||
std::ostringstream os;
|
||||
os << kfd_begin_timestamp << ":" << end_timestamp << " " << GetPid() << ":" << GetTid() << " " << kfd_api_data_pair_t(cid, *data);
|
||||
fprintf(kfd_api_file_handle, "%s\n", os.str().c_str());
|
||||
}
|
||||
in_kfd_api_callback = false;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Input parser
|
||||
@@ -810,9 +778,6 @@ void tool_unload() {
|
||||
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HIP_API));
|
||||
ROCTRACER_CALL(roctracer_disable_domain_activity(ACTIVITY_DOMAIN_HCC_OPS));
|
||||
}
|
||||
if (trace_kfd) {
|
||||
ROCTRACER_CALL(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_KFD_API));
|
||||
}
|
||||
|
||||
// Flush tracing pool
|
||||
close_tracing_pool();
|
||||
@@ -863,11 +828,6 @@ void tool_load() {
|
||||
trace_hip_activity = true;
|
||||
}
|
||||
|
||||
// KFD domain enabling
|
||||
if (std::string(trace_domain).find("kfd") != std::string::npos) {
|
||||
trace_kfd = true;
|
||||
}
|
||||
|
||||
// PC sampling enabling
|
||||
if (std::string(trace_domain).find("pcs") != std::string::npos) {
|
||||
trace_pcs = true;
|
||||
@@ -917,11 +877,6 @@ void tool_load() {
|
||||
trace_hip_activity = true;
|
||||
hip_api_vec = api_vec;
|
||||
}
|
||||
if (name == "KFD") {
|
||||
found = true;
|
||||
trace_kfd = true;
|
||||
kfd_api_vec = api_vec;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) printf("input from \"%s\"", xml_name);
|
||||
@@ -993,27 +948,6 @@ void tool_load() {
|
||||
flush_thread_started = true;
|
||||
}
|
||||
|
||||
// Enable KFD API callbacks/activity
|
||||
if (trace_kfd) {
|
||||
kfd_api_file_handle = open_output_file(output_prefix, "kfd_api_trace.txt");
|
||||
// initialize KFD tracing
|
||||
roctracer_set_properties(ACTIVITY_DOMAIN_KFD_API, NULL);
|
||||
|
||||
printf(" KFD-trace(");
|
||||
if (kfd_api_vec.size() != 0) {
|
||||
for (unsigned i = 0; i < kfd_api_vec.size(); ++i) {
|
||||
uint32_t cid = KFD_API_ID_NUMBER;
|
||||
const char* api = kfd_api_vec[i].c_str();
|
||||
ROCTRACER_CALL(roctracer_op_code(ACTIVITY_DOMAIN_KFD_API, api, &cid, NULL));
|
||||
ROCTRACER_CALL(roctracer_enable_op_callback(ACTIVITY_DOMAIN_KFD_API, cid, kfd_api_callback, NULL));
|
||||
printf(" %s", api);
|
||||
}
|
||||
} else {
|
||||
ROCTRACER_CALL(roctracer_enable_domain_callback(ACTIVITY_DOMAIN_KFD_API, kfd_api_callback, NULL));
|
||||
}
|
||||
printf(")\n");
|
||||
}
|
||||
|
||||
ONLOAD_TRACE_END();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user