The BlockDiscontinuity class provides collective methods for flagging discontinuities within an ordered set of items partitioned across a CUDA thread block. More...
The BlockDiscontinuity class provides collective methods for flagging discontinuities within an ordered set of items partitioned across a CUDA thread block.
T | The data type to be flagged. |
BLOCK_DIM_X | The thread block length in threads along the X dimension |
BLOCK_DIM_Y | [optional] The thread block length in threads along the Y dimension (default: 1) |
BLOCK_DIM_Z | [optional] The thread block length in threads along the Z dimension (default: 1) |
PTX_ARCH | [optional] \ptxversion |
thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], [3,4,4,4], ... }
. The corresponding output head_flags
in those threads will be { [1,0,1,0], [0,0,0,0], [1,1,0,0], [0,1,0,0], ... }
.Definition at line 108 of file block_discontinuity.cuh.
Data Structures | |
struct | _TempStorage |
Shared memory storage layout type (last element from each thread's input) More... | |
struct | ApplyOp |
Specialization for when FlagOp has third index param. More... | |
struct | ApplyOp< FlagOp, false > |
Specialization for when FlagOp does not have a third index param. More... | |
struct | Iterate |
Templated unrolling of item comparison (inductive case) More... | |
struct | Iterate< MAX_ITERATIONS, MAX_ITERATIONS > |
Templated unrolling of item comparison (termination case) More... | |
struct | TempStorage |
\smemstorage{BlockDiscontinuity} More... | |
Public Member Functions | |
Collective constructors | |
__device__ __forceinline__ | BlockDiscontinuity () |
Collective constructor using a private static allocation of shared memory as temporary storage. | |
__device__ __forceinline__ | BlockDiscontinuity (TempStorage &temp_storage) |
Collective constructor using the specified memory allocation as temporary storage. | |
Head flag operations | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeads (FlagT(&head_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], T(&preds)[ITEMS_PER_THREAD], FlagOp flag_op) |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeads (FlagT(&head_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], T(&preds)[ITEMS_PER_THREAD], FlagOp flag_op, T tile_predecessor_item) |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeads (FlagT(&head_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], FlagOp flag_op) |
Sets head flags indicating discontinuities between items partitioned across the thread block, for which the first item has no reference and is always flagged. | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeads (FlagT(&head_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], FlagOp flag_op, T tile_predecessor_item) |
Sets head flags indicating discontinuities between items partitioned across the thread block. | |
Tail flag operations | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagTails (FlagT(&tail_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], FlagOp flag_op) |
Sets tail flags indicating discontinuities between items partitioned across the thread block, for which the last item has no reference and is always flagged. | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagTails (FlagT(&tail_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], FlagOp flag_op, T tile_successor_item) |
Sets tail flags indicating discontinuities between items partitioned across the thread block. | |
Head & tail flag operations | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeadsAndTails (FlagT(&head_flags)[ITEMS_PER_THREAD], FlagT(&tail_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], FlagOp flag_op) |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block. | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeadsAndTails (FlagT(&head_flags)[ITEMS_PER_THREAD], FlagT(&tail_flags)[ITEMS_PER_THREAD], T tile_successor_item, T(&input)[ITEMS_PER_THREAD], FlagOp flag_op) |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block. | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeadsAndTails (FlagT(&head_flags)[ITEMS_PER_THREAD], T tile_predecessor_item, FlagT(&tail_flags)[ITEMS_PER_THREAD], T(&input)[ITEMS_PER_THREAD], FlagOp flag_op) |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block. | |
template<int ITEMS_PER_THREAD, typename FlagT , typename FlagOp > | |
__device__ __forceinline__ void | FlagHeadsAndTails (FlagT(&head_flags)[ITEMS_PER_THREAD], T tile_predecessor_item, FlagT(&tail_flags)[ITEMS_PER_THREAD], T tile_successor_item, T(&input)[ITEMS_PER_THREAD], FlagOp flag_op) |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block. | |
Private Types | |
enum | { BLOCK_THREADS = BLOCK_DIM_X * BLOCK_DIM_Y * BLOCK_DIM_Z } |
Constants. More... | |
Private Member Functions | |
__device__ __forceinline__ _TempStorage & | PrivateStorage () |
Internal storage allocator. | |
Private Attributes | |
_TempStorage & | temp_storage |
Shared storage reference. | |
unsigned int | linear_tid |
Linear thread-id. | |
|
private |
Constants.
Enumerator | |
---|---|
BLOCK_THREADS | The thread block size in threads. |
Definition at line 117 of file block_discontinuity.cuh.
|
inline |
Collective constructor using a private static allocation of shared memory as temporary storage.
Definition at line 271 of file block_discontinuity.cuh.
|
inline |
Collective constructor using the specified memory allocation as temporary storage.
[in] | temp_storage | Reference to memory allocation having layout type TempStorage |
Definition at line 281 of file block_discontinuity.cuh.
|
inline |
Sets head flags indicating discontinuities between items partitioned across the thread block, for which the first item has no reference and is always flagged.
head_flagsi
is set for item inputi
when flag_op(
previous-item, inputi)
returns true
(where previous-item is either the preceding item in the same thread or the last item in the previous thread).input0
is always flagged.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], [3,4,4,4], ... }
. The corresponding output head_flags
in those threads will be { [1,0,1,0], [0,0,0,0], [1,1,0,0], [0,1,0,0], ... }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | head_flags | Calling thread's discontinuity head_flags |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
Definition at line 411 of file block_discontinuity.cuh.
|
inline |
Sets head flags indicating discontinuities between items partitioned across the thread block.
head_flagsi
is set for item inputi
when flag_op(
previous-item, inputi)
returns true
(where previous-item is either the preceding item in the same thread or the last item in the previous thread).input0
is compared against tile_predecessor_item
.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], [3,4,4,4], ... }
, and that tile_predecessor_item
is 0
. The corresponding output head_flags
in those threads will be { [0,0,1,0], [0,0,0,0], [1,1,0,0], [0,1,0,0], ... }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | head_flags | Calling thread's discontinuity head_flags |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
[in] | tile_predecessor_item | [thread0 only] Item with which to compare the first tile item (input0 from thread0). |
Definition at line 480 of file block_discontinuity.cuh.
|
inline |
[out] | head_flags | Calling thread's discontinuity head_flags |
[in] | input | Calling thread's input items |
[out] | preds | Calling thread's predecessor items |
[in] | flag_op | Binary boolean flag predicate |
Definition at line 302 of file block_discontinuity.cuh.
|
inline |
[out] | head_flags | Calling thread's discontinuity head_flags |
[in] | input | Calling thread's input items |
[out] | preds | Calling thread's predecessor items |
[in] | flag_op | Binary boolean flag predicate |
[in] | tile_predecessor_item | [thread0 only] Item with which to compare the first tile item (input0 from thread0). |
Definition at line 332 of file block_discontinuity.cuh.
|
inline |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block.
head_flagsi
is set for item inputi
when flag_op(
previous-item, inputi)
returns true
(where previous-item is either the preceding item in the same thread or the last item in the previous thread).input0
is always flagged.tail_flagsi
is set for item inputi
when flag_op(inputi,
next-item)
returns true
(where next-item is either the next item in the same thread or the first item in the next thread).input
ITEMS_PER_THREAD-1 is compared against tile_predecessor_item
.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], ..., [124,125,125,125] }
and that the tile_successor_item is 125
. The corresponding output head_flags
in those threads will be { [1,0,1,0], [0,0,0,0], [1,1,0,0], [0,1,0,0], ... }
. and the corresponding output tail_flags
in those threads will be { [0,1,0,0], [0,0,0,1], [1,0,0,...], ..., [1,0,0,0] }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | head_flags | Calling thread's discontinuity head_flags |
[out] | tail_flags | Calling thread's discontinuity tail_flags |
[in] | tile_successor_item | [threadBLOCK_THREADS -1 only] Item with which to compare the last tile item (input ITEMS_PER_THREAD-1 from threadBLOCK_THREADS-1). |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
Definition at line 851 of file block_discontinuity.cuh.
|
inline |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block.
head_flagsi
is set for item inputi
when flag_op(
previous-item, inputi)
returns true
(where previous-item is either the preceding item in the same thread or the last item in the previous thread).input0
is always flagged.tail_flagsi
is set for item inputi
when flag_op(inputi,
next-item)
returns true
(where next-item is either the next item in the same thread or the first item in the next thread).input
ITEMS_PER_THREAD-1 is always flagged.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], ..., [124,125,125,125] }
and that the tile_successor_item is 125
. The corresponding output head_flags
in those threads will be { [1,0,1,0], [0,0,0,0], [1,1,0,0], [0,1,0,0], ... }
. and the corresponding output tail_flags
in those threads will be { [0,1,0,0], [0,0,0,1], [1,0,0,...], ..., [1,0,0,1] }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | head_flags | Calling thread's discontinuity head_flags |
[out] | tail_flags | Calling thread's discontinuity tail_flags |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
Definition at line 735 of file block_discontinuity.cuh.
|
inline |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block.
head_flagsi
is set for item inputi
when flag_op(
previous-item, inputi)
returns true
(where previous-item is either the preceding item in the same thread or the last item in the previous thread).input0
is compared against tile_predecessor_item
.tail_flagsi
is set for item inputi
when flag_op(inputi,
next-item)
returns true
(where next-item is either the next item in the same thread or the first item in the next thread).input
ITEMS_PER_THREAD-1 is compared against tile_successor_item
.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], ..., [124,125,125,125] }
, that the tile_predecessor_item
is 0
, and that the tile_successor_item
is 125
. The corresponding output head_flags
in those threads will be { [0,0,1,0], [0,0,0,0], [1,1,0,0], [0,1,0,0], ... }
. and the corresponding output tail_flags
in those threads will be { [0,1,0,0], [0,0,0,1], [1,0,0,...], ..., [1,0,0,0] }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | head_flags | Calling thread's discontinuity head_flags |
[in] | tile_predecessor_item | [thread0 only] Item with which to compare the first tile item (input0 from thread0). |
[out] | tail_flags | Calling thread's discontinuity tail_flags |
[in] | tile_successor_item | [threadBLOCK_THREADS -1 only] Item with which to compare the last tile item (input ITEMS_PER_THREAD-1 from threadBLOCK_THREADS-1). |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
Definition at line 1094 of file block_discontinuity.cuh.
|
inline |
Sets both head and tail flags indicating discontinuities between items partitioned across the thread block.
head_flagsi
is set for item inputi
when flag_op(
previous-item, inputi)
returns true
(where previous-item is either the preceding item in the same thread or the last item in the previous thread).input0
is compared against tile_predecessor_item
.tail_flagsi
is set for item inputi
when flag_op(inputi,
next-item)
returns true
(where next-item is either the next item in the same thread or the first item in the next thread).input
ITEMS_PER_THREAD-1 is always flagged.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], ..., [124,125,125,125] }
, that the tile_predecessor_item
is 0
, and that the tile_successor_item
is 125
. The corresponding output head_flags
in those threads will be { [0,0,1,0], [0,0,0,0], [1,1,0,0], [0,1,0,0], ... }
. and the corresponding output tail_flags
in those threads will be { [0,1,0,0], [0,0,0,1], [1,0,0,...], ..., [1,0,0,1] }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | head_flags | Calling thread's discontinuity head_flags |
[in] | tile_predecessor_item | [thread0 only] Item with which to compare the first tile item (input0 from thread0). |
[out] | tail_flags | Calling thread's discontinuity tail_flags |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
Definition at line 975 of file block_discontinuity.cuh.
|
inline |
Sets tail flags indicating discontinuities between items partitioned across the thread block, for which the last item has no reference and is always flagged.
tail_flagsi
is set for item inputi
when flag_op(inputi,
next-item)
returns true
(where next-item is either the next item in the same thread or the first item in the next thread).input
ITEMS_PER_THREAD-1 is always flagged.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], ..., [124,125,125,125] }
. The corresponding output tail_flags
in those threads will be { [0,1,0,0], [0,0,0,1], [1,0,0,...], ..., [1,0,0,1] }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | tail_flags | Calling thread's discontinuity tail_flags |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
Definition at line 553 of file block_discontinuity.cuh.
|
inline |
Sets tail flags indicating discontinuities between items partitioned across the thread block.
tail_flagsi
is set for item inputi
when flag_op(inputi,
next-item)
returns true
(where next-item is either the next item in the same thread or the first item in the next thread).input
ITEMS_PER_THREAD-1 is compared against tile_successor_item
.thread_data
across the block of threads is { [0,0,1,1], [1,1,1,1], [2,3,3,3], ..., [124,125,125,125] }
and that tile_successor_item
is 125
. The corresponding output tail_flags
in those threads will be { [0,1,0,0], [0,0,0,1], [1,0,0,...], ..., [1,0,0,0] }
.ITEMS_PER_THREAD | [inferred] The number of consecutive items partitioned onto each thread. |
FlagT | [inferred] The flag type (must be an integer type) |
FlagOp | [inferred] Binary predicate functor type having member T operator()(const T &a, const T &b) or member T operator()(const T &a, const T &b, unsigned int b_index) , and returning true if a discontinuity exists between a and b , otherwise false . b_index is the rank of b in the aggregate tile of data. |
[out] | tail_flags | Calling thread's discontinuity tail_flags |
[in] | input | Calling thread's input items |
[in] | flag_op | Binary boolean flag predicate |
[in] | tile_successor_item | [threadBLOCK_THREADS -1 only] Item with which to compare the last tile item (input ITEMS_PER_THREAD-1 from threadBLOCK_THREADS-1). |
Definition at line 637 of file block_discontinuity.cuh.
|
inlineprivate |
Internal storage allocator.
Definition at line 137 of file block_discontinuity.cuh.
|
private |
Linear thread-id.
Definition at line 254 of file block_discontinuity.cuh.
|
private |
Shared storage reference.
Definition at line 251 of file block_discontinuity.cuh.