Skip to content

Commit

Permalink
Fix HIP-API CTest failure
Browse files Browse the repository at this point in the history
Check if stack is empty before popping data off of it.

Signed-off-by: Aleksandar Janicijevic <Aleksandar.Janicijevic@amd.com>
  • Loading branch information
ajanicijamd committed Jun 7, 2024
1 parent 6bcd1d3 commit 9dff7af
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions source/lib/omnitrace/library/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 9dff7af

Please sign in to comment.