CLFLUSH(3clc)
π CLFLUSH β the OpenCL Manual, bestie edition
okay so you're here because of clFlush from the OpenCL Manual (3clc section, and yes it's CLFLUSH(3clc), the Khronos girlies know) and honestly? you're about to be obsessed. let's get into it π¦
β¨ NAME β¨
clFlush β issues all previously queued OpenCL commands in a command-queue to the device associated with the command-queue. no cap, that's the whole vibe.
cl_int clFlush(cl_command_queue command_queue);
πΈ NOTES πΈ
So clFlush issues all previously queued OpenCL commands in command_queue to the device associated with command_queue. that's it, that's the job π
β οΈ But listen, and listen closely bestie:clFlushonly guarantees that all queued commands to command_queue will eventually be submitted to the appropriate device. There is no guarantee that they will be complete afterclFlushreturns. it's giving "i sent the text, not my problem if they replied" π
Okay so the tea on implicit flushes π« β any blocking commands queued in a command-queue and clReleaseCommandQueue(3clc) perform an implicit flush of the command-queue. The blocking commands in question, for the girlies keeping score:
clEnqueueReadBuffer(3clc),clEnqueueReadBufferRect(3clc), orclEnqueueReadImage(3clc)withblocking_readset toCL_TRUEclEnqueueWriteBuffer(3clc),clEnqueueWriteBufferRect(3clc), orclEnqueueWriteImage(3clc)withblocking_writeset toCL_TRUEclEnqueueMapBuffer(3clc)orclEnqueueMapImage(3clc)withblocking_mapset toCL_TRUE- or
clWaitForEvents(3clc)
And here's the plot twist π β if you wanna use event objects that refer to commands enqueued in a command-queue as event objects to wait on by commands enqueued in a different command-queue, your application must call a clFlush or any of those blocking commands that perform an implicit flush of the command-queue where the commands that refer to these event objects are enqueued. cross-queue communication? she requires a handshake, periodt.
π ERRORS π
Returns CL_SUCCESS if the function call was executed successfully. Otherwise, it returns one of the following:
CL_INVALID_COMMAND_QUEUEβ if command_queue is not a valid command-queue. fake queue, blocked π«CL_OUT_OF_HOST_MEMORYβ if there is a failure to allocate resources required by the OpenCL implementation on the host.CL_OUT_OF_RESOURCESβ if there is a failure to allocate resources required by the OpenCL implementation on the device.
π SPECIFICATION π
OpenCL Specification[1] β iconic, obviously.
π SEE ALSO π
clFinish(3clc)β the one who actually waits around for things to be done π
π 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 193, section 5.13 - Flush and Finish. iykyk, go read it π
and that's the whole page, bestie β brought to you by The Khronos Group, dated 01/14/2021, filed under CLFLUSH(3clc) π«Ά go forth and flush 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