* \param[in] hostBuffer Pointer to the raw host-side memory, also typed \p ValueType
* \param[in] startingOffset Offset (in values) at the device-side buffer to copy into.
* \param[in] numValues Number of values to copy.
- * \param[in] stream GPU stream to perform asynchronous copy in.
+ * \param[in] deviceStream GPU stream to perform asynchronous copy in.
* \param[in] transferKind Copy type: synchronous or asynchronous.
* \param[out] timingEvent A pointer to the H2D copy timing event to be filled in.
* If the pointer is not null, the event can further be used
const ValueType* hostBuffer,
size_t startingOffset,
size_t numValues,
- CommandStream stream,
+ const DeviceStream& deviceStream,
GpuApiCallBehavior transferKind,
CommandEvent* timingEvent)
{
switch (transferKind)
{
case GpuApiCallBehavior::Async:
- clError = clEnqueueWriteBuffer(stream, *buffer, CL_FALSE, offset, bytes, hostBuffer, 0,
- nullptr, timingEvent);
+ clError = clEnqueueWriteBuffer(deviceStream.stream(), *buffer, CL_FALSE, offset, bytes,
+ hostBuffer, 0, nullptr, timingEvent);
GMX_RELEASE_ASSERT(
clError == CL_SUCCESS,
gmx::formatString("Asynchronous H2D copy failed (OpenCL error %d: %s)", clError,
break;
case GpuApiCallBehavior::Sync:
- clError = clEnqueueWriteBuffer(stream, *buffer, CL_TRUE, offset, bytes, hostBuffer, 0,
- nullptr, timingEvent);
+ clError = clEnqueueWriteBuffer(deviceStream.stream(), *buffer, CL_TRUE, offset, bytes,
+ hostBuffer, 0, nullptr, timingEvent);
GMX_RELEASE_ASSERT(
clError == CL_SUCCESS,
gmx::formatString("Synchronous H2D copy failed (OpenCL error %d: %s)", clError,
* \param[in] buffer Pointer to the device-side buffer
* \param[in] startingOffset Offset (in values) at the device-side buffer to copy from.
* \param[in] numValues Number of values to copy.
- * \param[in] stream GPU stream to perform asynchronous copy in.
+ * \param[in] deviceStream GPU stream to perform asynchronous copy in.
* \param[in] transferKind Copy type: synchronous or asynchronous.
* \param[out] timingEvent A pointer to the H2D copy timing event to be filled in.
* If the pointer is not null, the event can further be used
DeviceBuffer<ValueType>* buffer,
size_t startingOffset,
size_t numValues,
- CommandStream stream,
+ const DeviceStream& deviceStream,
GpuApiCallBehavior transferKind,
CommandEvent* timingEvent)
{
switch (transferKind)
{
case GpuApiCallBehavior::Async:
- clError = clEnqueueReadBuffer(stream, *buffer, CL_FALSE, offset, bytes, hostBuffer, 0,
- nullptr, timingEvent);
+ clError = clEnqueueReadBuffer(deviceStream.stream(), *buffer, CL_FALSE, offset, bytes,
+ hostBuffer, 0, nullptr, timingEvent);
GMX_RELEASE_ASSERT(
clError == CL_SUCCESS,
gmx::formatString("Asynchronous D2H copy failed (OpenCL error %d: %s)", clError,
break;
case GpuApiCallBehavior::Sync:
- clError = clEnqueueReadBuffer(stream, *buffer, CL_TRUE, offset, bytes, hostBuffer, 0,
- nullptr, timingEvent);
+ clError = clEnqueueReadBuffer(deviceStream.stream(), *buffer, CL_TRUE, offset, bytes,
+ hostBuffer, 0, nullptr, timingEvent);
GMX_RELEASE_ASSERT(
clError == CL_SUCCESS,
gmx::formatString("Synchronous D2H copy failed (OpenCL error %d: %s)", clError,
* \param[in,out] buffer Pointer to the device-side buffer
* \param[in] startingOffset Offset (in values) at the device-side buffer to start clearing at.
* \param[in] numValues Number of values to clear.
- * \param[in] stream GPU stream.
+ * \param[in] deviceStream GPU stream.
*/
template<typename ValueType>
-void clearDeviceBufferAsync(DeviceBuffer<ValueType>* buffer, size_t startingOffset, size_t numValues, CommandStream stream)
+void clearDeviceBufferAsync(DeviceBuffer<ValueType>* buffer,
+ size_t startingOffset,
+ size_t numValues,
+ const DeviceStream& deviceStream)
{
GMX_ASSERT(buffer, "needs a buffer pointer");
const size_t offset = startingOffset * sizeof(ValueType);
const cl_uint numWaitEvents = 0;
const cl_event* waitEvents = nullptr;
cl_event commandEvent;
- cl_int clError = clEnqueueFillBuffer(stream, *buffer, &pattern, sizeof(pattern), offset, bytes,
- numWaitEvents, waitEvents, &commandEvent);
+ cl_int clError = clEnqueueFillBuffer(deviceStream.stream(), *buffer, &pattern, sizeof(pattern),
+ offset, bytes, numWaitEvents, waitEvents, &commandEvent);
GMX_RELEASE_ASSERT(clError == CL_SUCCESS,
gmx::formatString("Couldn't clear the device buffer (OpenCL error %d: %s)",
clError, ocl_get_error_string(clError).c_str())