Implements the DeviceBuffer type and routines for OpenCL. Should only be included directly by the main DeviceBuffer file devicebuffer.h. TODO: the intent is for DeviceBuffer to become a class.
- Author
- Aleksei Iupinov a.yup.nosp@m.inov.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
|
template<typename ValueType > |
void | allocateDeviceBuffer (DeviceBuffer< ValueType > *buffer, size_t numValues, Context context) |
| Allocates a device-side buffer. It is currently a caller's responsibility to call it only on not-yet allocated buffers. More...
|
|
template<typename DeviceBuffer > |
void | freeDeviceBuffer (DeviceBuffer *buffer) |
| Frees a device-side buffer. This does not reset separately stored size/capacity integers, as this is planned to be a destructor of DeviceBuffer as a proper class, and no calls on buffer should be made afterwards. More...
|
|
template<typename ValueType > |
void | copyToDeviceBuffer (DeviceBuffer< ValueType > *buffer, const ValueType *hostBuffer, size_t startingOffset, size_t numValues, CommandStream stream, GpuApiCallBehavior transferKind, CommandEvent *timingEvent) |
| Performs the host-to-device data copy, synchronous or asynchronously on request. More...
|
|
template<typename ValueType > |
void | copyFromDeviceBuffer (ValueType *hostBuffer, DeviceBuffer< ValueType > *buffer, size_t startingOffset, size_t numValues, CommandStream stream, GpuApiCallBehavior transferKind, CommandEvent *timingEvent) |
| Performs the device-to-host data copy, synchronous or asynchronously on request. More...
|
|
template<typename ValueType > |
void | clearDeviceBufferAsync (DeviceBuffer< ValueType > *buffer, size_t startingOffset, size_t numValues, CommandStream stream) |
| Clears the device buffer asynchronously. More...
|
|
template<typename ValueType >
void allocateDeviceBuffer |
( |
DeviceBuffer< ValueType > * |
buffer, |
|
|
size_t |
numValues, |
|
|
Context |
context |
|
) |
| |
Allocates a device-side buffer. It is currently a caller's responsibility to call it only on not-yet allocated buffers.
- Template Parameters
-
ValueType | Raw value type of the buffer . |
- Parameters
-
[in,out] | buffer | Pointer to the device-side buffer. |
[in] | numValues | Number of values to accomodate. |
[in] | context | The buffer's context-to-be. |
template<typename ValueType >
void clearDeviceBufferAsync |
( |
DeviceBuffer< ValueType > * |
buffer, |
|
|
size_t |
startingOffset, |
|
|
size_t |
numValues, |
|
|
CommandStream |
stream |
|
) |
| |
Clears the device buffer asynchronously.
- Template Parameters
-
ValueType | Raw value type of the buffer . |
- Parameters
-
[in,out] | buffer | Pointer to the device-side buffer |
[in] | startingOffset | Offset (in values) at the device-side buffer to start clearing at. |
[in] | numValues | Number of values to clear. |
[in] | stream | GPU stream. |
template<typename ValueType >
Performs the device-to-host data copy, synchronous or asynchronously on request.
TODO: This is meant to gradually replace cu/ocl_copy_d2h.
- Template Parameters
-
ValueType | Raw value type of the buffer . |
- Parameters
-
[in,out] | hostBuffer | Pointer to the raw host-side memory, also typed ValueType |
[in] | buffer | Pointer to the device-side buffer |
[in] | startingOffset | Offset (in values) at the device-side buffer to copy from. |
[in] | numValues | Number of values to copy. |
[in] | stream | GPU stream to perform asynchronous copy in. |
[in] | transferKind | Copy type: synchronous or asynchronous. |
[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 to queue a wait for this operation or to query profiling information. |
template<typename ValueType >
Performs the host-to-device data copy, synchronous or asynchronously on request.
TODO: This is meant to gradually replace cu/ocl_copy_h2d.
- Template Parameters
-
ValueType | Raw value type of the buffer . |
- Parameters
-
[in,out] | buffer | Pointer to the device-side buffer |
[in] | hostBuffer | Pointer to the raw host-side memory, also typed ValueType |
[in] | startingOffset | Offset (in values) at the device-side buffer to copy into. |
[in] | numValues | Number of values to copy. |
[in] | stream | GPU stream to perform asynchronous copy in. |
[in] | transferKind | Copy type: synchronous or asynchronous. |
[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 to queue a wait for this operation or to query profiling information. |
template<typename DeviceBuffer >
Frees a device-side buffer. This does not reset separately stored size/capacity integers, as this is planned to be a destructor of DeviceBuffer as a proper class, and no calls on buffer
should be made afterwards.
- Parameters
-
[in] | buffer | Pointer to the buffer to free. |