Lock-free ring of buffer indices with a device producer (push()) and a device consumer (pop()).
More...
#include <RingIndex_DtoD.hh>
|
| __host__ | RingIndexDtoD (const unsigned capacity) |
| | Allocate the pinned head and tail words and start empty; asserts that capacity is a power of 2.
|
| |
| __host__ | ~RingIndexDtoD () |
| | Free the pinned head and tail words.
|
| |
| __device__ bool | push (unsigned index) const |
| | Move head forward when not full.
|
| |
| __device__ bool | pop (unsigned *const __restrict__ index) const |
| | Return current head.
|
| |
| __host__ __device__ unsigned | head () const |
| | Return the head, the next position to be pushed.
|
| |
| __host__ __device__ unsigned | tail () const |
| | Return the tail, the next position to be popped.
|
| |
| __host__ __device__ unsigned | occupancy () const |
| | Return the number of entries (head minus tail, modulo the capacity).
|
| |
| __host__ __device__ size_t | size () const |
| | Return the capacity.
|
| |
| __host__ void | reset () |
| | Set the head and tail to 0 (empty); not synchronized with the device.
|
| |
Lock-free ring of buffer indices with a device producer (push()) and a device consumer (pop()).
Head and tail are device-scope atomics in pinned host memory; one slot always stays empty. Used for the Reader queues read by TrgInpGen.
◆ RingIndexDtoD()
| __host__ Drp::Gpu::RingIndexDtoD::RingIndexDtoD |
( |
const unsigned |
capacity | ) |
|
|
inline |
Allocate the pinned head and tail words and start empty; asserts that capacity is a power of 2.
◆ ~RingIndexDtoD()
| __host__ Drp::Gpu::RingIndexDtoD::~RingIndexDtoD |
( |
| ) |
|
|
inline |
Free the pinned head and tail words.
◆ head()
| __host__ __device__ unsigned Drp::Gpu::RingIndexDtoD::head |
( |
| ) |
const |
|
inline |
Return the head, the next position to be pushed.
◆ occupancy()
| __host__ __device__ unsigned Drp::Gpu::RingIndexDtoD::occupancy |
( |
| ) |
const |
|
inline |
Return the number of entries (head minus tail, modulo the capacity).
◆ pop()
| __device__ bool Drp::Gpu::RingIndexDtoD::pop |
( |
unsigned *const __restrict__ |
index | ) |
const |
|
inline |
◆ push()
| __device__ bool Drp::Gpu::RingIndexDtoD::push |
( |
unsigned |
index | ) |
const |
|
inline |
Move head forward when not full.
◆ reset()
| __host__ void Drp::Gpu::RingIndexDtoD::reset |
( |
| ) |
|
|
inline |
Set the head and tail to 0 (empty); not synchronized with the device.
◆ size()
| __host__ __device__ size_t Drp::Gpu::RingIndexDtoD::size |
( |
| ) |
const |
|
inline |
◆ tail()
| __host__ __device__ unsigned Drp::Gpu::RingIndexDtoD::tail |
( |
| ) |
const |
|
inline |
Return the tail, the next position to be popped.
The documentation for this class was generated from the following file: