Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix roctracer data race #309

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions source/lib/omnitrace/library/roctracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ namespace omnitrace
{
namespace
{
template <typename Tp, typename CategoryT = category::roctracer>
template <typename Tp>
auto&
roctracer_type_mutex(uint64_t _n = threading::get_id())
roctracer_type_mutex()
{
return tim::type_mutex<Tp, CategoryT, max_supported_threads, locking::atomic_mutex>(
_n % max_supported_threads);
return tim::type_mutex<Tp, category::roctracer, max_supported_threads,
locking::atomic_mutex>();
}

std::string
Expand Down Expand Up @@ -173,7 +173,9 @@ using key_data_mutex_t = std::decay_t<decltype(get_roctracer_key_data())>;
auto&
get_hip_activity_mutex(int64_t _tid = threading::get_id())
{
return roctracer_type_mutex<hip_activity_mutex_t, category::roctracer>(_tid);
return tim::type_mutex<hip_activity_mutex_t, category::roctracer,
max_supported_threads, locking::atomic_mutex>(
_tid % max_supported_threads);
}
} // namespace

Expand Down