From 63ead6901234c892b0d1178f969fdcff26251eed Mon Sep 17 00:00:00 2001 From: Laurent Morichetti Date: Thu, 5 May 2022 09:33:33 -0700 Subject: [PATCH] Fix a hang in './test/hsa/ctrl ctrl_hsa_input_trace' At the end of the test, the tracer tool is unloaded and the active memory pools are flushed. In the flush callback, to get the activity operation string, the RocpLoader instance is neeeded, and if the RocpLoader is not already loaded, it attempts to dlopen the rocprofiler library. Calling dlopen from a global destructor hangs because the dynamic loader lock is already owned (e.g. by dlclose). To temporarily work around the issue, instanciate the RocpLoader when the activities needing it are enabled. Change-Id: I712c66d88c43694fe53a95d6a61d7b22abb75262 [ROCm/roctracer commit: 11887f596a3020365f346d18b3f069ff7f6a3996] --- projects/roctracer/src/core/roctracer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/roctracer/src/core/roctracer.cpp b/projects/roctracer/src/core/roctracer.cpp index 93580e92e6..249b71c5d6 100644 --- a/projects/roctracer/src/core/roctracer.cpp +++ b/projects/roctracer/src/core/roctracer.cpp @@ -939,6 +939,7 @@ static roctracer_status_t roctracer_enable_activity_fun(roctracer_domain_t domai switch (domain) { case ACTIVITY_DOMAIN_HSA_OPS: { if (op == HSA_OP_ID_COPY) { + roctracer::RocpLoader::Instance(); roctracer::hsa_support::async_copy_callback_enabled = true; roctracer::hsa_support::async_copy_callback_memory_pool = reinterpret_cast(pool); @@ -958,6 +959,7 @@ static roctracer_status_t roctracer_enable_activity_fun(roctracer_domain_t domai case ACTIVITY_DOMAIN_HSA_API: break; case ACTIVITY_DOMAIN_HSA_EVT: + roctracer::RocpLoader::Instance(); break; case ACTIVITY_DOMAIN_HIP_OPS: { if (roctracer::HipLoader::Instance().Enabled() == false) break;