Skip to content

Commit 24892cf

Browse files
committed
opal/accelerator: add destroy_stream API
Introduce the destroy stream operation to properly release resources. Signed-off-by: Wenduo Wang <wenduwan@amazon.com>
1 parent 33a11af commit 24892cf

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

opal/mca/accelerator/accelerator.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ typedef int (*opal_accelerator_base_module_check_addr_fn_t)(
150150

151151
/**
152152
* Creates a stream for asynchonous operations. This function will allocate
153-
* memory for the object. To release the memory, call OBJ_RELEASE(*stream);
153+
* memory for the object.
154+
* To release the memory and associated resources,
155+
* call opal_accelerator_base_module_create_stream_fn_t
154156
*
155157
* @param[IN] dev_id Associated device for the stream or
156158
* MCA_ACCELERATOR_NO_DEVICE_ID
@@ -161,6 +163,18 @@ typedef int (*opal_accelerator_base_module_check_addr_fn_t)(
161163
typedef int (*opal_accelerator_base_module_create_stream_fn_t)(
162164
int dev_id, opal_accelerator_stream_t **stream);
163165

166+
/**
167+
* Destroys a stream and release the object memory.
168+
* This function should return immediately, but resources associated with
169+
* the stream may be released later.
170+
*
171+
* @param[IN] stream Stream to destroy
172+
*
173+
* @return OPAL_SUCCESS or error status on failure
174+
*/
175+
typedef int (*opal_accelerator_base_module_destroy_stream_fn_t)(
176+
opal_accelerator_stream_t *stream);
177+
164178
/**
165179
* Creates an event. An event is a synchronization marker that can be
166180
* appended to a stream to monitor device progress or synchronize the
@@ -402,6 +416,7 @@ typedef struct {
402416
opal_accelerator_base_module_check_addr_fn_t check_addr;
403417

404418
opal_accelerator_base_module_create_stream_fn_t create_stream;
419+
opal_accelerator_base_module_destroy_stream_fn_t destroy_stream;
405420
opal_accelerator_base_module_create_event_fn_t create_event;
406421
opal_accelerator_base_module_record_event_fn_t record_event;
407422
opal_accelerator_base_module_query_event_fn_t query_event;

0 commit comments

Comments
 (0)