Skip to content

Commit

Permalink
When not storing the dangling events, we must still perform the deini…
Browse files Browse the repository at this point in the history
…t operations that were producing these events !
  • Loading branch information
caugonnet committed Jan 13, 2025
1 parent 564705d commit e52651e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cudax/include/cuda/experimental/__stf/internal/backend_ctx.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -651,20 +651,23 @@ protected:
const bool track_dangling = bctx.track_dangling_events();

// Deinitialize all attached allocators in reversed order
if (track_dangling)
for (auto it : each(attached_allocators.rbegin(), attached_allocators.rend()))
{
for (auto it : each(attached_allocators.rbegin(), attached_allocators.rend()))
auto deinit_res = it->deinit(bctx);
if (track_dangling)
{
stack.add_dangling_events(it->deinit(bctx));
stack.add_dangling_events(mv(deinit_res));
}
}

// Erase the vector of allocators now that they were deinitialized
attached_allocators.clear();

// We "duplicate" the code of the deinit to remove any storage and avoid a move
auto composite_deinit_res = composite_cache.deinit();
if (track_dangling)
{
stack.add_dangling_events(composite_cache.deinit());
stack.add_dangling_events(mv(composite_deinit_res));
}
}

Expand Down

0 comments on commit e52651e

Please sign in to comment.