From 36c4392b345c95d3e33f3610964744e4fa3206f1 Mon Sep 17 00:00:00 2001 From: Aleksey Date: Mon, 14 Jun 2021 22:02:55 +0300 Subject: [PATCH] SWDEV-284883 - QMCPACK hangs when using rocprof --trace-period Workaraund fix race condition in api_callbacks_spawner_t destructor. Change-Id: I77d61492dfa484c3e477805c6f314a00dbb6cc32 [ROCm/clr commit: 4f0bf535c431966809d4b13bcf2c5d986e0ad9b7] --- projects/clr/hipamd/src/hip_prof_api.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/projects/clr/hipamd/src/hip_prof_api.h b/projects/clr/hipamd/src/hip_prof_api.h index 8773f9ac1f..c5d075a68e 100644 --- a/projects/clr/hipamd/src/hip_prof_api.h +++ b/projects/clr/hipamd/src/hip_prof_api.h @@ -190,9 +190,9 @@ template class api_callbacks_spawner_t { public: api_callbacks_spawner_t() : - api_data_(NULL) + api_data_(NULL), was_enabled_on_construction_(is_enabled()) { - if (!is_enabled()) return; + if (!was_enabled_on_construction_) return; if (cid_ >= HIP_API_ID_NUMBER) { fprintf(stderr, "HIP %s bad id %d\n", __FUNCTION__, cid_); @@ -214,7 +214,7 @@ class api_callbacks_spawner_t { } ~api_callbacks_spawner_t() { - if (!is_enabled()) return; + if (!was_enabled_on_construction_) return; if (api_data_ != NULL) { hip_api_callback_t fun = entry(cid_).fun; @@ -242,6 +242,7 @@ class api_callbacks_spawner_t { } hip_api_data_t* api_data_; + bool was_enabled_on_construction_ = false; }; template <>