To enqueue a command to indicate which device a set of memory objects should be associated with, call the function
const cl_mem* mem_objects,
const cl_event* event_wait_list,
|clEnqueueMigrateMemObjects is missing before version 1.2.
command_queue is a valid host command-queue. The specified set of memory objects in mem_objects will be migrated to the OpenCL device associated with command_queue or to the host if the
CL_MIGRATE_has been specified.
MEM_ OBJECT_ HOST
num_mem_objects is the number of memory objects specified in mem_objects.
mem_objects is a pointer to a list of memory objects.
flags is a bit-field that is used to specify migration options. The Memory Migration Flags describes the possible values for flags.
event_wait_list and num_events_in_wait_list specify events that need to complete before this particular command can be executed. If event_wait_list is
NULL, then this particular command 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 command and can be used to query or queue a wait for this command to complete. If event is
NULLor the enqueue is unsuccessful, no event will be created and therefore it will not be possible to query the status of this command or to wait for this command to complete. If event_wait_list and event are not
NULL, event must not refer to an element of the event_wait_list array.
|Memory Migration Flags
missing before version 1.2.
This flag indicates that the specified set of memory objects are to be migrated to the host, regardless of the target command-queue.
missing before version 1.2.
This flag indicates that the contents of the set of memory objects are undefined after migration. The specified set of memory objects are migrated to the device associated with command_queue without incurring the overhead of migrating their contents.
Typically, memory objects are implicitly migrated to a device for which enqueued commands, using the memory object, are targeted. clEnqueueMigrateMemObjects allows this migration to be explicitly performed ahead of the dependent commands. This allows a user to preemptively change the association of a memory object, through regular command-queue scheduling, in order to prepare for another upcoming command. This also permits an application to overlap the placement of memory objects with other unrelated operations before these memory objects are needed potentially hiding transfer latencies. Once the event, returned from clEnqueueMigrateMemObjects, has been marked CL_COMPLETE the memory objects specified in mem_objects have been successfully migrated to the device associated with command_queue. The migrated memory object shall remain resident on the device until another command is enqueued that either implicitly or explicitly migrates it away.
clEnqueueMigrateMemObjects can also be used to direct the initial placement of a memory object, after creation, possibly avoiding the initial overhead of instantiating the object on the first enqueued command to use it.
The user is responsible for managing the event dependencies, associated with this command, in order to avoid overlapping access to memory objects. Improperly specified event dependencies passed to clEnqueueMigrateMemObjects could result in undefined results.
CL_SUCCESS if the function is executed
Otherwise, it returns one of the following errors:
CL_INVALID_if command_queue is not a valid host command-queue.
CL_INVALID_if the context associated with command_queue and memory objects in mem_objects are not the same or if the context associated with command_queue and events in event_wait_list are not the same.
CL_INVALID_if any of the memory objects in mem_objects is not a valid memory object.
CL_INVALID_if num_mem_objects is zero or if mem_objects is
CL_INVALID_if flags is not 0 or is not any of the values described in the table above.
CL_INVALID_if event_wait_list is
EVENT_ WAIT_ LIST
NULLand num_events_in_wait_list > 0, or event_wait_list is not
NULLand num_events_in_wait_list is 0, or if event objects in event_wait_list are not valid events.
CL_MEM_if there is a failure to allocate memory for the specified set of memory objects in mem_objects.
OBJECT_ ALLOCATION_ FAILURE
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.
OF_ HOST_ MEMORY
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.