Fix a RCCL initialization to avoid a deadlock (#136)
Also fixes:
- crash while finalizing rocprof-sys-causal
[ROCm/rocprofiler-systems commit: 26bb604215]
This commit is contained in:
@@ -105,6 +105,8 @@ delay::setup()
|
||||
void
|
||||
delay::process()
|
||||
{
|
||||
if(!is_local_available()) return;
|
||||
|
||||
if(causal::experiment::is_active())
|
||||
{
|
||||
if(get_global() < get_local())
|
||||
@@ -130,6 +132,8 @@ delay::process()
|
||||
void
|
||||
delay::credit()
|
||||
{
|
||||
if(!is_local_available()) return;
|
||||
|
||||
auto _diff = get_global() - get_local();
|
||||
if(_diff > 0)
|
||||
{
|
||||
@@ -140,6 +144,8 @@ delay::credit()
|
||||
void
|
||||
delay::preblock()
|
||||
{
|
||||
if(!is_local_available()) return;
|
||||
|
||||
auto _diff = get_global() - get_local();
|
||||
if(_diff > 0)
|
||||
{
|
||||
@@ -150,6 +156,7 @@ delay::preblock()
|
||||
void
|
||||
delay::postblock(int64_t _preblock_global_delay_value)
|
||||
{
|
||||
if(!is_local_available()) return;
|
||||
get_local() += (get_global() - _preblock_global_delay_value);
|
||||
}
|
||||
|
||||
@@ -168,18 +175,36 @@ delay::get_global()
|
||||
return _v;
|
||||
}
|
||||
|
||||
int64_t&
|
||||
delay::get_local(int64_t _tid)
|
||||
static void
|
||||
thr_init()
|
||||
{
|
||||
auto& _data = get_delay_data();
|
||||
static thread_local auto _thr_init = []() {
|
||||
using thread_data_t = thread_data<identity<int64_t>, delay>;
|
||||
thread_data_t::construct(construct_on_thread{ threading::get_id() },
|
||||
get_global().load());
|
||||
delay::get_global().load());
|
||||
return true;
|
||||
}();
|
||||
(void) _thr_init; // To make compiler happy.
|
||||
}
|
||||
|
||||
bool
|
||||
delay::is_local_available()
|
||||
{
|
||||
thr_init();
|
||||
auto& _data = get_delay_data();
|
||||
return _data != nullptr;
|
||||
}
|
||||
|
||||
int64_t&
|
||||
delay::get_local(int64_t _tid)
|
||||
{
|
||||
thr_init();
|
||||
auto& _data = get_delay_data();
|
||||
if(_data == nullptr)
|
||||
{
|
||||
throw std::runtime_error("No data: get_delay_data() returned nullptr");
|
||||
}
|
||||
return _data->at(_tid);
|
||||
(void) _thr_init;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
||||
Reference in New Issue
Block a user