CLENQUEUECOPYBUFFER(3clc)
π CLENQUEUECOPYBUFFER π
okay bestie, we're doing the OpenCL manual page for clEnqueueCopyBuffer, from the OpenCL Manual, and it's literally about yeeting bytes from one buffer object into another. two buffers. one copy command. let's go β¨
πΈ NAME πΈ
clEnqueueCopyBuffer β Enqueues a command to copy from one buffer object to another. π
cl_int clEnqueueCopyBuffer(cl_command_queue command_queue,
cl_mem src_buffer, cl_mem dst_buffer,
size_t src_offset, size_t dst_offset,
size_t size, cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
π PARAMETERS π
command_queueβ the command-queue where this copy command is gonna get queued up. and listen: the OpenCL context that's chillin' withcommand_queue,src_buffer, anddst_bufferhas to be the same context. all three. no mixing contexts, that's not the vibe. π ββοΈsrc_offsetβ where you start copying data from insrc_buffer. like, the starting line. πdst_offsetβ where you start copying data intodst_buffer. the destination's starting line. πsizeβ the size, in bytes, of what you're copying. bytes!! fr fr. πevent_wait_list,num_events_in_wait_listβ these specify the events that need to finish up before this particular command can even be executed. so:- if
event_wait_listisNULL, then this particular command does not wait on any event to complete. free spirit. π¦ - if
event_wait_listisNULL, thennum_events_in_wait_listmust be0. - if
event_wait_listis notNULL, the list of events thatevent_wait_listpoints to must be valid, andnum_events_in_wait_listmust be greater than0. - the events in
event_wait_listact as synchronization points. β³ - the context associated with the events in
event_wait_listand the one associated withcommand_queuemust be the same. - and good news: the memory associated with
event_wait_listcan be reused or freed after the function returns. no need to hoard it. π
- if
eventβ returns an event object that identifies this particular copy command, and you can use it to query or queue a wait for this particular command to complete. buteventcan beNULL, and in that 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 that's your situation,clEnqueueBarrierWithWaitList(3clc)can be used instead.) also, if theevent_wait_listand theeventarguments are notNULL, theeventargument should not refer to an element of theevent_wait_listarray. π
π₯ ERRORS π₯
Returns CL_SUCCESS if the function is executed successfully. otherwise, it returns one of these:
CL_INVALID_COMMAND_QUEUEβ ifcommand_queueis not a valid command-queue. πCL_INVALID_CONTEXTβ if the context associated withcommand_queue,src_buffer, anddst_bufferare not the same, or if the context associated withcommand_queueand events inevent_wait_listare not the same.CL_INVALID_MEM_OBJECTβ ifsrc_bufferanddst_bufferare not valid buffer objects.CL_INVALID_VALUEβ ifsrc_offset,dst_offset,size,src_offset + size, ordst_offset + sizerequire accessing elements outside thesrc_bufferanddst_bufferbuffer objects respectively. stay in bounds babes π§CL_INVALID_VALUEβ ifsizeis0. (yes, zero counts as a crime here.)CL_INVALID_EVENT_WAIT_LISTβ ifevent_wait_listisNULLandnum_events_in_wait_listis> 0, orevent_wait_listis notNULLandnum_events_in_wait_listis0, or if event objects inevent_wait_listare not valid events.CL_MISALIGNED_SUB_BUFFER_OFFSETβ ifsrc_bufferis a sub-buffer object and the offset specified when the sub-buffer object is created is not aligned toCL_DEVICE_MEM_BASE_ADDR_ALIGNvalue for the device associated with queue. πCL_MISALIGNED_SUB_BUFFER_OFFSETβ ifdst_bufferis a sub-buffer object and the offset specified when the sub-buffer object is created is not aligned toCL_DEVICE_MEM_BASE_ADDR_ALIGNvalue for the device associated with queue.CL_MEM_COPY_OVERLAPβ ifsrc_bufferanddst_bufferare the same buffer or subbuffer object and the source and destination regions overlap, or ifsrc_bufferanddst_bufferare different sub-buffers of the same associated buffer object and they overlap. the regions overlap ifsrc_offset β€ to dst_offset β€ to src_offset + size - 1, or ifdst_offset β€ to src_offset β€ to dst_offset + size - 1. β οΈ overlapping is not it.CL_MEM_OBJECT_ALLOCATION_FAILUREβ if there is a failure to allocate memory for the data store associated withsrc_bufferordst_buffer.CL_OUT_OF_RESOURCESβ if there is a failure to allocate resources required by the OpenCL implementation on the device. πCL_OUT_OF_HOST_MEMORYβ if there is a failure to allocate resources required by the OpenCL implementation on the host. π
π SPECIFICATION π
OpenCL Specification[1]
π«Ά SEE ALSO π«Ά
clEnqueueReadBuffer(3clc)clEnqueueWriteBuffer(3clc)clCreateBuffer(3clc)clCreateSubBuffer(3clc)clEnqueueCopyBufferToImage(3clc)clEnqueueCopyImageToBuffer(3clc)
π AUTHORS π
The Khronos Group
π COPYRIGHT π
Copyright Β© 2007-2011 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 following condition: the above copyright notice and this permission notice shall be included in all copies or substantial portions of the Materials.
π§ NOTES π§
- OpenCL Specification page 79, section 5.2.2 - Reading, Writing, Copying Buffer Objects
and that's the whole page bestie, no cap π this was brought to you by The Khronos Group, dated 01/14/2021 β mwah, go copy some buffers responsibly πβ¨
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms