Patch for omnitrace-sample crash with HIP API. (#344)

Fix HIP-API CTest failure

Check if stack is empty before popping data off of it.

Signed-off-by: Aleksandar Janicijevic <Aleksandar.Janicijevic@amd.com>

[ROCm/rocprofiler-systems commit: f0bd9126a5]
This commit is contained in:
ajanicijamd
2024-06-07 15:23:18 -04:00
committed by GitHub
parent 7bbca47ee8
commit 15d4e8d0b9
@@ -151,8 +151,16 @@ create_cpu_cid_entry(int64_t _tid)
auto_lock_t _p_lk{ _p_mtx, std::defer_lock };
if(!_p_lk.owns_lock()) _p_lk.lock();
auto&& _cid = get_cpu_cid()++;
auto&& _parent_cid = get_cpu_cid_stack(_p_idx)->back();
auto&& _cid = get_cpu_cid()++;
// auto&& _parent_cid = get_cpu_cid_stack(_p_idx)->back();
uint64_t _parent_cid = 0;
auto& cid_stack = get_cpu_cid_stack(_p_idx);
if(!cid_stack->empty())
{
_parent_cid = cid_stack->back();
}
uint32_t&& _depth = get_cpu_cid_stack(_p_idx)->size() - ((_p_idx == _tid) ? 1 : 0);
get_cpu_cid_parents(_tid)->emplace(_cid, std::make_tuple(_parent_cid, _depth));