Enqueues a command to free the shared virtual memory allocated using clSVMAlloc or a shared system memory pointer.
cl_int clEnqueueSVMFree
(
| cl_command_queue command_queue, |
| cl_uint num_svm_pointers , | |
| void *svm_pointers[] , | |
| void (CL_CALLBACK *pfn_free_func) ( cl_command_queue queue, cl_uint num_svm_pointers, void *svm_pointers[]), | |
| void *user_data), | |
| void *user_data, | |
| cl_uint num_events_in_wait_list, | |
| const cl_event *event_wait_list, | |
cl_event *event) |
command_queue
A valid host command-queue.
svm_pointers and num_svm_pointers
Specify shared virtual memory pointers to be freed. Each
pointer in svm_pointers that was
allocated using
clSVMAlloc
must have been allocated from the
same context from which command_queue
was created. The memory associated with
svm_pointers can be reused or
freed after the function returns.
pfn_free_func
Specifies the callback
function to be called to free the SVM pointers.
pfn_free_func takes four arguments:
queue which is the command queue in which
clEnqueueSVMFree was enqueued, the
count and list of SVM pointers to free and user_data
which is a pointer to user specified data.
If pfn_free_func is NULL, all pointers specified in
svm_pointers must be allocated using
clSVMAlloc
and the OpenCL implementation will free
these SVM pointers. pfn_free_func must
be a valid callback function if any SVM pointer to be
freed is a shared system memory pointer i.e. not allocated
using clSVMAlloc.
If pfn_free_func
is a valid callback function, the OpenCL implementation
will call pfn_free_func to free all the
SVM pointers specified in svm_pointers.
user_data
Will be passed as the
user_data argument when pfn_free_func
is called. user_data can be NULL.
event_wait_list and num_events_in_wait_list
Specify events that need to complete before
clEnqueueSVMFree can be executed. If
event_wait_list is NULL, then
clEnqueueSVMFree
does not wait on any event to complete. If
event_wait_list is NULL,
num_events_in_wait_list
must be 0. If event_wait_list is not
NULL, the list of events pointed to by
event_wait_list must
be valid and num_events_in_wait_list
must be greater than 0. The events specified in
event_wait_list act as synchronization
points. The context associated with events in
event_wait_list and
command_queue must be the same.
The memory associated with
event_wait_list can be
reused or freed after the function returns.
event
Returns an event object that
identifies this particular command and can be used to query or
queue a wait for this particular command to complete.
event can be NULL in which case it will
not be possible for the application to query the
status of this command or queue a wait for this
command to complete. If the event_wait_list
and the event arguments are not NULL,
the event
argument should not refer to an element of the
event_wait_list array.
Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:
command_queue is not a valid host command-queue.
num_svm_pointers is 0 or if
svm_pointers is NULL or if any of
the pointers specified in svm_pointers
array is NULL.
event_wait_list is NULL and
num_events_in_wait_list > 0, or
event_wait_list is not NULL and
num_events_in_wait_list is 0, or
if event objects in event_wait_list
are not valid events.
Copyright © 2007-2013 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the condition that this copyright notice and permission notice shall be included
in all copies or substantial portions of the Materials.