'\" t .\" Title: clEnqueueMigrateMemObjects .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 02/03/2019 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "CLENQUEUEMIGRATEMEMO" "3clc" "02/03/2019" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" clEnqueueMigrateMemObjects \- Enqueues a command to indicate which device a set of memory objects should be associated with\&. .SH "" .HP \w'cl_int\ clEnqueueMigrateMemObjects('u .BI "cl_int clEnqueueMigrateMemObjects(cl_command_queue\ " "command_queue" ", cl_uint\ " "num_mem_objects" ", const\ cl_mem\ *" "mem_objects" ", cl_mem_migration_flags\ " "flags" ", cl_uint\ " "num_events_in_wait_list" ", const\ cl_event\ *" "event_wait_list" ", cl_event\ *" "event" ");" .SH "PARAMETERS" .PP \fI command_queue \fR .RS 4 A valid command\-queue\&. The specified set of memory objects in \fImem_objects\fR will be migrated to the OpenCL device associated with \fIcommand_queue\fR or to the host if the \fBCL_MIGRATE_MEM_OBJECT_HOST\fR has been specified\&. .RE .PP \fI num_mem_objects \fR .RS 4 The number of memory objects specified in \fImem_objects\fR\&. .RE .PP \fI mem_objects \fR .RS 4 A pointer to a list of memory objects\&. .RE .PP \fI flags \fR .RS 4 A bit\-field that is used to specify migration options\&. The table below describes the possible values for flags\&. .TS allbox tab(:); lB lB. T{ cl_mem_migration flags T}:T{ Description T} .T& l l l l. T{ \fBCL_MIGRATE_MEM_OBJECT_HOST\fR T}:T{ This flag indicates that the specified set of memory objects are to be migrated to the host, regardless of the target command\-queue\&. T} T{ \fBCL_MIGRATE_MEM_OBJECT_\- CONTENT_UNDEFINED\fR T}:T{ 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 \fIcommand_queue\fR without incurring the overhead of migrating their contents\&. T} .TE .sp 1 .RE .PP \fI event_wait_list, num_events_in_wait_list \fR .RS 4 Specify events that need to complete before this particular command can be executed\&. If \fIevent_wait_list\fR is NULL, then this particular command does not wait on any event to complete\&. If \fIevent_wait_list\fR is NULL, \fInum_events_in_wait_list\fR must be 0\&. If \fIevent_wait_list\fR is not NULL, the list of events pointed to by \fIevent_wait_list\fR must be valid and \fInum_events_in_wait_list\fR must be greater than 0\&. The events specified in \fIevent_wait_list\fR act as synchronization points\&. The context associated with events in \fIevent_wait_list\fR and \fIcommand_queue\fR must be the same\&. The memory associated with \fIevent_wait_list\fR can be reused or freed after the function returns\&. .RE .PP \fI event \fR .RS 4 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\&. \fIevent\fR 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 \fIevent_wait_list\fR and the \fIevent\fR arguments are not NULL, the \fIevent\fR argument should not refer to an element of the \fIevent_wait_list\fR array\&. .RE .SH "NOTES" .PP This section describes a mechanism for assigning which device an OpenCL memory object resides\&. A user may wish to have more explicit control over the location of their memory objects on creation\&. This could be used to: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Ensure that an object is allocated on a specific device prior to usage\&..RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} Preemptively migrate an object from one device to another\&..RE .PP Typically, memory objects are implicitly migrated to a device for which enqueued commands, using the memory object, are targeted\&. \fBclEnqueueMigrateMemObjects\fR 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 \fBclEnqueueMigrateMemObjects\fR, has been marked \fBCL_COMPLETE\fR the memory objects specified in \fImem_objects\fR have been successfully migrated to the device associated with \fIcommand_queue\fR\&. The migrated memory object shall remain resident on the device until another command is enqueued that either implicitly or explicitly migrates it away\&. .PP \fBclEnqueueMigrateMemObjects\fR 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\&. .PP 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 \fBclEnqueueMigrateMemObjects\fR could result in undefined results\&. .SH "ERRORS" .PP \fBclEnqueueMigrateMemObjects\fR returns CL_SUCCESS if the function is executed successfully\&. Otherwise, it returns one of the following errors: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_COMMAND_QUEUE if \fIcommand_queue\fR is not a valid \fIcommand_queue\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_CONTEXT if the context associated with \fIcommand_queue\fR and memory objects in \fImemobj\fR are not the same or if the context associated with \fIcommand_queue\fR and events in \fIevent_wait_list\fR are not the same\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_MEM_OBJECT if any of the memory objects in \fImem_objs\fR is not a valid memory object\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if \fInum_mem_objects\fR is zero or if \fImem_objects\fR is NULL\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_VALUE if \fIflags\fR is not 0 or is not any of the values described in the table above\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_INVALID_EVENT_WAIT_LIST if \fIevent_wait_list\fR is NULL and \fInum_events_in_wait_list\fR > 0, or \fIevent_wait_list\fR is not NULL and \fInum_events_in_wait_list\fR is 0, or if event objects in \fIevent_wait_list\fR are not valid events\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_MEM_OBJECT_ALLOCATION_FAILURE if there is a failure to allocate memory for the specified set of memory objects in \fImem_objects\fR\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device\&. .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host\&. .RE .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" .PP \fBclEnqueueMapBuffer\fR(3clc), \fBclEnqueueMapImage\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2011 The Khronos Group Inc. .br 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. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 123, section 5.4.4 - Migrating Memory Objects .RE