Fix thread-limit bug in roctracer (#326)
Update roctracer.cpp - fix call to hip_exec_activity_callbacks when more runtime threads than compile time max
This commit is contained in:
کامیت شده توسط
GitHub
والد
cfaace38a8
کامیت
edd6f57cf3
@@ -306,6 +306,8 @@ roctracer::flush()
|
||||
// make sure all async operations are executed
|
||||
for(size_t i = 0; i < thread_info::get_peak_num_threads(); ++i)
|
||||
hip_exec_activity_callbacks(i);
|
||||
|
||||
OMNITRACE_VERBOSE_F(2, "roctracer flush completed\n");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -163,6 +163,14 @@ get_hip_activity_callbacks(int64_t _tid = threading::get_id())
|
||||
return thread_data_t::instance(construct_on_thread{ _tid });
|
||||
}
|
||||
|
||||
size_t
|
||||
get_hip_activity_callbacks_size()
|
||||
{
|
||||
using thread_data_t =
|
||||
thread_data<std::vector<std::function<void()>>, category::roctracer>;
|
||||
return thread_data_t::size();
|
||||
}
|
||||
|
||||
using hip_activity_mutex_t = std::decay_t<decltype(get_hip_activity_callbacks())>;
|
||||
using key_data_mutex_t = std::decay_t<decltype(get_roctracer_key_data())>;
|
||||
|
||||
@@ -430,6 +438,9 @@ hsa_activity_callback(uint32_t op, const void* vrecord, void* arg)
|
||||
void
|
||||
hip_exec_activity_callbacks(int64_t _tid)
|
||||
{
|
||||
// guard against initialization of structure when trying to exec
|
||||
if(static_cast<size_t>(_tid) >= get_hip_activity_callbacks_size()) return;
|
||||
|
||||
// OMNITRACE_ROCTRACER_CALL(roctracer_flush_activity());
|
||||
locking::atomic_lock _lk{ get_hip_activity_mutex(_tid) };
|
||||
auto& _async_ops = get_hip_activity_callbacks(_tid);
|
||||
|
||||
مرجع در شماره جدید
Block a user