cub::BlockRakingLayout
Defined in cub/block/block_raking_layout.cuh
-
template<typename T, int BLOCK_THREADS, int LEGACY_PTX_ARCH = 0>
struct BlockRakingLayout BlockRakingLayout provides a conflict-free shared memory layout abstraction for 1D raking across thread block data.
Overview
This type facilitates a shared memory usage pattern where a block of CUDA threads places elements into shared memory and then reduces the active parallelism to one “raking” warp of threads for serially aggregating consecutive sequences of shared items. Padding is inserted to eliminate bank conflicts (for most data types).
- Template Parameters
T – The data type to be exchanged.
BLOCK_THREADS – The thread block size in threads.
LEGACY_PTX_ARCH – [optional] Unused.
Public Types
-
enum [anonymous]
Values:
-
enumerator SHARED_ELEMENTS
The total number of elements that need to be cooperatively reduced.
-
enumerator MAX_RAKING_THREADS
Maximum number of warp-synchronous raking threads.
-
enumerator SEGMENT_LENGTH
Number of raking elements per warp-synchronous raking thread (rounded up)
-
enumerator RAKING_THREADS
Never use a raking thread that will have no valid data (e.g., when BLOCK_THREADS is 62 and SEGMENT_LENGTH is 2, we should only use 31 raking threads)
-
enumerator HAS_CONFLICTS
Whether we will have bank conflicts (technically we should find out if the GCD is > 1)
-
enumerator CONFLICT_DEGREE
Degree of bank conflicts (e.g., 4-way)
-
enumerator USE_SEGMENT_PADDING
Pad each segment length with one element if segment length is not relatively prime to warp size and can’t be optimized as a vector load.
-
enumerator GRID_ELEMENTS
Total number of elements in the raking grid.
-
enumerator UNGUARDED
Whether or not we need bounds checking during raking (the number of reduction elements is not a multiple of the number of raking threads)
-
enumerator SHARED_ELEMENTS
Public Static Functions
-
static inline T *PlacementPtr(TempStorage &temp_storage, unsigned int linear_tid)
Returns the location for the calling thread to place data into the grid.
-
static inline T *RakingPtr(TempStorage &temp_storage, unsigned int linear_tid)
Returns the location for the calling thread to begin sequential raking.
-
struct _TempStorage
Shared memory storage type.
Public Members
-
T buff[BlockRakingLayout::GRID_ELEMENTS]
-
T buff[BlockRakingLayout::GRID_ELEMENTS]
-
struct TempStorage : public Uninitialized<_TempStorage>
Alias wrapper allowing storage to be unioned.