Double-buffer storage wrapper for multi-pass stream transformations that require more than one storage array for streaming intermediate results back and forth. More...
Double-buffer storage wrapper for multi-pass stream transformations that require more than one storage array for streaming intermediate results back and forth.
Many multi-pass computations require a pair of "ping-pong" storage buffers (e.g., one for reading from and the other for writing to, and then vice-versa for the subsequent pass). This structure wraps a set of device buffers and a "selector" member to track which is "current".
Definition at line 791 of file util_type.cuh.
Public Member Functions | |
__host__ __device__ __forceinline__ | DoubleBuffer () |
Constructor. | |
__host__ __device__ __forceinline__ | DoubleBuffer (T *d_current, T *d_alternate) |
Constructor. More... | |
__host__ __device__ __forceinline__ T * | Current () |
Return pointer to the currently valid buffer. | |
__host__ __device__ __forceinline__ T * | Alternate () |
Return pointer to the currently invalid buffer. | |
Data Fields | |
T * | d_buffers [2] |
Pair of device buffer pointers. | |
int | selector |
Selector into d_buffers (i.e., the active/valid buffer) | |
|
inline |
Constructor.
d_current | The currently valid buffer |
d_alternate | Alternate storage buffer of the same size as d_current |
Definition at line 808 of file util_type.cuh.