Skip to content

Commit

Permalink
Delete ur context after l0 context
Browse files Browse the repository at this point in the history
  • Loading branch information
omarahmed1111 committed Aug 28, 2024
1 parent 05d3ea7 commit dced7c2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions source/adapters/level_zero/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,6 @@ ur_result_t ContextReleaseHelper(ur_context_handle_t Context) {
// Clean up any live memory associated with Context
ur_result_t Result = Context->finalize();

// We must delete Context first and then destroy zeContext because
// Context deallocation requires ZeContext in some member deallocation of
// ur_context_handle_t.
delete Context;

// Destruction of some members of ur_context_handle_t uses L0 context
// and therefore it must be valid at that point.
// Technically it should be placed to the destructor of ur_context_handle_t
Expand All @@ -384,6 +379,9 @@ ur_result_t ContextReleaseHelper(ur_context_handle_t Context) {
return ze2urResult(ZeResult);
}

ZeDestroyContext = nullptr;
delete Context;

return Result;
}

Expand Down

0 comments on commit dced7c2

Please sign in to comment.