CLENQUEUEUNMAPMEMOBJ(3clc)
π
CLENQUEUEUNMAPMEMOBJ β the 3clc glow-up β¨
okay bestie, so this is clEnqueueUnmapMemObject from the OpenCL Manual (3clc), and it's literally the "ok we're done here, put it back" command. no cap.
β¨ NAME β¨
clEnqueueUnmapMemObject β enqueues a command to unmap a previously mapped region of a memory object. π
cl_int clEnqueueUnmapMemObject(cl_command_queue command_queue,
cl_mem memobj, void *mapped_ptr,
cl_uint num_events_in_wait_list,
const cl_event *event_wait_list,
cl_event *event);
πΈ PARAMETERS πΈ
here's the tea on every single one of them, no skipping:
command_queueβ must be a valid command-queue. like, a real one. not a vibe.memobjβ a valid memory object. and the OpenCL context chillin' withcommand_queueandmemobjhas to be the same context. they gotta be in the same group chat, fr fr. π―mapped_ptrβ the host address that a previous call toclEnqueueMapBuffer(3clc)orclEnqueueMapImage(3clc)handed back formemobj. the receipt, basically. π§Ύevent_wait_list,num_events_in_wait_listβ these two are the "wait your turn" girlies. they specify events that need to complete beforeclEnqueueUnmapMemObjectcan even be executed. so:- if
event_wait_listisNULL, thenclEnqueueUnmapMemObjectdoes not wait on any event to complete. π€ - if
event_wait_listisNULL,num_events_in_wait_listmust be0. - if
event_wait_listis notNULL, the list of events pointed to byevent_wait_listmust be valid andnum_events_in_wait_listmust be greater than0. - the events in
event_wait_listact as synchronization points. β³ - the context associated with events in
event_wait_listandcommand_queuemust be the same. - the memory associated with
event_wait_listcan be reused or freed after the function returns. (recycle era β»οΈ)
- 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.eventcan beNULL, 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. and if that's your situation,clEnqueueBarrierWithWaitList(3clc)can be used instead. so you're not stranded, bestie. π«Ά
π NOTES π
- Reads or writes from the host using the pointer returned by
clEnqueueMapBuffer(3clc)orclEnqueueMapImage(3clc)are considered to be complete. done. finished. ate. π clEnqueueMapBuffer(3clc)andclEnqueueMapImage(3clc)increment the mapped count of the memory object. the initial mapped count value of a memory object is zero. multiple calls toclEnqueueMapBuffer(3clc)orclEnqueueMapImage(3clc)on the same memory object will increment this mapped count by the appropriate number of calls. and thenclEnqueueUnmapMemObjectdecrements the mapped count of the memory object. it's giving loyalty-card stamp math, and honestly? iconic. ποΈclEnqueueMapBuffer(3clc)andclEnqueueMapImage(3clc)act as synchronization points for a region of the buffer object being mapped. β¨
π ERRORS π
clEnqueueUnmapMemObject returns CL_SUCCESS if the function is executed successfully. otherwise, it returns one of these, and we're gonna read them all:
CL_INVALID_COMMAND_QUEUEβ ifcommand_queueis not a valid command-queue. π«CL_INVALID_MEM_OBJECTβ ifmemobjis not a valid memory object.CL_INVALID_VALUEβ ifmapped_ptris not a valid pointer returned byclEnqueueMapBuffer(3clc)orclEnqueueMapImage(3clc)formemobj.CL_INVALID_EVENT_WAIT_LISTβ ifevent_wait_listisNULLandnum_events_in_wait_list>0, orevent_wait_listis notNULLandnum_events_in_wait_listis0, or if event objects inevent_wait_listare not valid events.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.CL_INVALID_CONTEXTβ if the context associated withcommand_queueandmemobjare not the same, or if the context associated withcommand_queueand events inevent_wait_listare not the same.
okay real talk, the context-mismatch ones are the ones that get everybody. if your stuff isn't from the same context, it's not gonna work, periodt. π«
π SPECIFICATION π
OpenCL Specification[1] β that's the source, she's citable, she's canon. π
π SEE ALSO π
clEnqueueMapBuffer(3clc), clEnqueueMapImage(3clc)
(its little sibling mapping functions, go read them too π¦)
π«Ά 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 condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.
π NOTES π
- OpenCL Specification β page
120, section5.4.2- Unmapping Mapped Memory Objects π
and that's the whole page, bestie!! π this one's from The Khronos Group, the OpenCL Manual, dated 01/14/2021, and the page is CLENQUEUEUNMAPMEMOBJ(3clc). go unmap responsibly, mwah πβ¨
π¦ 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