Skip to content

Commit

Permalink
[cuda][hip] Fix a resource leak when using deferred command buffers. (i…
Browse files Browse the repository at this point in the history
…ree-org#17582)

The stream_command_buffer that is created when applying
deferred_commands is never properly freed, as we never release it after
adding it to the resource set.

Signed-off-by: Andrew Woloszyn <[email protected]>
  • Loading branch information
AWoloszyn authored Jun 5, 2024
1 parent 5a44639 commit 9a33952
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions runtime/src/iree/hal/drivers/cuda/pending_queue_actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ static iree_status_t iree_hal_cuda_pending_queue_actions_issue_execution(
z0, iree_hal_deferred_command_buffer_apply(
command_buffer, stream_command_buffer,
iree_hal_buffer_binding_table_empty()));
// The stream_command_buffer is going to be retained by
// the action->resource_set and deleted after the action
// completes.
iree_hal_resource_release(stream_command_buffer);
}
}
IREE_TRACE_ZONE_END(dispatch_command_buffers);
Expand Down
4 changes: 4 additions & 0 deletions runtime/src/iree/hal/drivers/hip/pending_queue_actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ static iree_status_t iree_hal_hip_pending_queue_actions_issue_execution(
z0, iree_hal_deferred_command_buffer_apply(
command_buffer, stream_command_buffer,
iree_hal_buffer_binding_table_empty()));
// The stream_command_buffer is going to be retained by
// the action->resource_set and deleted after the action
// completes.
iree_hal_resource_release(stream_command_buffer);
}
}
IREE_TRACE_ZONE_END(dispatch_command_buffers);
Expand Down

0 comments on commit 9a33952

Please sign in to comment.