Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions unified-runtime/source/adapters/level_zero/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2341,6 +2341,11 @@ _ur_buffer::_ur_buffer(ur_context_handle_t Context, size_t Size,
LastDeviceWithValidAllocation = Device;
}

_ur_buffer::~_ur_buffer() {
if (isSubBuffer())
ur::level_zero::urMemRelease(SubBuffer->Parent);
}

ur_result_t ur_mem_handle_t_::getZeHandle(char *&ZeHandle, access_mode_t mode,
ur_device_handle_t Device,
const ur_event_handle_t *phWaitEvents,
Expand Down
2 changes: 2 additions & 0 deletions unified-runtime/source/adapters/level_zero/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ struct _ur_buffer final : ur_mem_handle_t_ {
_ur_buffer(ur_context_handle_t Context, size_t Size,
ur_device_handle_t Device, char *ZeMemHandle, bool OwnZeMemHandle);

~_ur_buffer();

// Returns a pointer to the USM allocation representing this PI buffer
// on the specified Device. If Device is nullptr then the returned
// USM allocation is on the device where this buffer was used the latest.
Expand Down