From d4da72bf2dcc2e7950e1ab5c7f5e2bab26d733a6 Mon Sep 17 00:00:00 2001 From: Sajina PK Date: Mon, 14 Jul 2025 21:12:10 -0400 Subject: [PATCH] Update gotcha submodule from timemory (#277) * Update gotcha submodule from timemory * Fix build failure and add copilot suggestions * Fix formatting errors [ROCm/rocprofiler-systems commit: d26486ad830b2d7f85b1a1f6c2d6b87669fe37dd] --- projects/rocprofiler-systems/.gitmodules | 1 + .../rocprofiler-systems/external/timemory | 2 +- .../components/pthread_create_gotcha.cpp | 25 ++++++++++++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/projects/rocprofiler-systems/.gitmodules b/projects/rocprofiler-systems/.gitmodules index 4fbeaeebb2..89b551a769 100644 --- a/projects/rocprofiler-systems/.gitmodules +++ b/projects/rocprofiler-systems/.gitmodules @@ -1,6 +1,7 @@ [submodule "external/timemory"] path = external/timemory url = https://github.com/ROCm/timemory.git + branch = rocprofiler-systems [submodule "external/perfetto"] path = external/perfetto url = https://github.com/google/perfetto.git diff --git a/projects/rocprofiler-systems/external/timemory b/projects/rocprofiler-systems/external/timemory index 5400e1349c..469eced5c6 160000 --- a/projects/rocprofiler-systems/external/timemory +++ b/projects/rocprofiler-systems/external/timemory @@ -1 +1 @@ -Subproject commit 5400e1349cb3266a1f9c605643c6d4f3871ced47 +Subproject commit 469eced5c690bb7320b88bf7ce93e7333f349aa5 diff --git a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/pthread_create_gotcha.cpp b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/pthread_create_gotcha.cpp index 1e7249d09a..4ab2279696 100644 --- a/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/pthread_create_gotcha.cpp +++ b/projects/rocprofiler-systems/source/lib/rocprof-sys/library/components/pthread_create_gotcha.cpp @@ -411,7 +411,30 @@ pthread_create_gotcha::shutdown() { // skip sending signals to internal threads if(internal_native_handles.count(itr) != 0) continue; - if(pthread_equal(pthread_self(), itr) == 0 && pthread_equal(itr, itr) != 0) + + bool has_bundle = false; + std::unique_lock _bundle_lk{ *bundles_mutex }; + const auto& thread_info = thread_info::get(itr); + // Check if this thread has a corresponding bundle entry + // With the new gotcha update more external threads are tracked + // but we only want to send signals to threads that have bundles + for(const auto& bundle_itr : *bundles) + { + try + { + if(thread_info && thread_info->index_data && + bundle_itr.first == thread_info->index_data->sequent_value) + { + has_bundle = true; + break; + } + } catch(...) + { + continue; + } + } + + if(has_bundle && pthread_equal(pthread_self(), itr) == 0) { ::pthread_kill(itr, shutdown_signal_v); ++_expected_shutdown_signals_delivered;