cl::sycl::experimental::sub_group Struct Reference
The sub_group class is an interface for subgroups. More...
#include <sub_group.h>
Public Member Functions | |
id< 1 > | get_group_id () const noexcept |
Get an id representing the index of the subgroup within the work-group. More... | |
range< 1 > | get_group_range () const noexcept |
Get the number of subgroups within the work-group. More... | |
range< 1 > | get_uniform_group_range () const noexcept |
Get the number of subgroups per work-group in the uniform region of the nd-range. More... | |
id< 1 > | get_local_id () const noexcept |
Get an id representing the index of the work-item within the subgroup. More... | |
range< 1 > | get_local_range () const noexcept |
Get the number of work-items in the subgroup. More... | |
range< 1 > | get_max_local_range () const noexcept |
Get the maximum number of work-items in any subgroups within the nd-range. More... | |
COMPUTECPP_DEPRECATED_BY_SYCL_VER (202001, "Use group_barrier(sub_group) instead.") inline void barrier(access | |
Synchronizes all work-items in a subgroup. More... | |
Public Attributes | |
size_t | m_subGroupId |
size_t | m_subGroupRange |
size_t | m_uniformSubGroupRange |
size_t | m_localId |
size_t | m_localRange |
size_t | m_maxLocalRange |
Detailed Description
The sub_group class is an interface for subgroups.
Definition at line 49 of file sub_group.h.
Member Function Documentation
◆ COMPUTECPP_DEPRECATED_BY_SYCL_VER()
|
inline |
Synchronizes all work-items in a subgroup.
- Parameters
-
fenceSpace Barrier fence space.Logical any function. predicate Value of the predicate for the current work-item.
- Returns
- True if
predicate
is true for any work-item in the subgroup.Logical all function.
- Parameters
-
predicate Value of the predicate for the current work-item.
- Returns
- True if
predicate
is true for all work-items in the subgroup.Broadcastx
from the specifiedlocalId
to all work-items within the subgroup.
- Template Parameters
-
T
- Parameters
-
x Value to broadcast. localId Must be the same id for all work-items in the subgroup.
- Returns
- The value broadcasted by
localId.Reduce
the valuesx
from all work-items. The initialization value is chosen to be the identity element ofbinaryOp
.
- Template Parameters
-
T BinaryOp
- Parameters
-
x Value to reduce for the current work-item. binaryOp Reduce operation, must be one of cl::sycl::plus, cl::sycl::minimum, cl::sycl::maximum.
- Returns
- The result of the reduction.Reduce the values
x
from all work-items.
- Template Parameters
-
T BinaryOp
- Parameters
-
x Value to reduce for the current work-item. init Initialization value. binaryOp Reduce operation, must be one of cl::sycl::plus, cl::sycl::minimum, cl::sycl::maximum.
- Returns
- The result of the reduction.Exclusive scan of the values
x
from all work-items. The value returned on thei
-th work-item is the scan of the firsti
work-items. The initialization value is chosen to be the identity element ofbinaryOp
.
- Template Parameters
-
T BinaryOp
- Parameters
-
x Value to reduce for the current work-item. binaryOp Scan operation, must be one of cl::sycl::plus, cl::sycl::minimum, cl::sycl::maximum.
- Returns
- The result of the exclusive scan of the first
i
work-items.Exclusive scan of the valuesx
from all work-items. The value returned on thei
-th work-item is the scan of the firsti
work-items.
- Template Parameters
-
T BinaryOp
- Parameters
-
x Value to reduce for the current work-item. init Initialization value. binaryOp Scan operation, must be one of cl::sycl::plus, cl::sycl::minimum, cl::sycl::maximum.
- Returns
- The result of the exclusive scan of the first
i
work-items.Inclusive scan of the valuesx
from all work-items. The value returned on thei
-th work-item is the scan of the firsti
work-items. The initialization value is chosen to be the identity element ofbinaryOp
.
- Template Parameters
-
T BinaryOp
- Parameters
-
x Value to reduce for the current work-item. binaryOp Scan operation, must be one of cl::sycl::plus, cl::sycl::minimum, cl::sycl::maximum.
- Returns
- The result of the inclusive scan of the first
i
work-items.Inclusive scan of the valuesx
from all work-items. The value returned on thei
-th work-item is the scan of the firsti
work-items.
- Template Parameters
-
T BinaryOp
- Parameters
-
x Value to reduce for the current work-item. init Initialization value. binaryOp Scan operation, must be one of cl::sycl::plus, cl::sycl::minimum, cl::sycl::maximum.
- Returns
- The result of the inclusive scan of the first
i
work-items.Exchange values ofx
between work-items in a subgroup.
- Template Parameters
-
T
- Parameters
-
x Value to send. localId Work-item id to retrieve.
- Returns
- The value sent by the work-item
localId.Exchange
values ofx
between work-items in a subgroup. shuffle_down is a specialized version of shuffle that may be optimized. The return value is unspecified ifget_local_id() + delta >= get_local_range()
.
- Template Parameters
-
T
- Parameters
-
x Value to send. delta Offset added to the calling work-item's id.
- Returns
- The value sent by the work-item whose id is
get_local_id() + delta
.Exchange values ofx
between work-items in a subgroup. shuffle_up is a specialized version of shuffle that may be optimized. The return value is unspecified ifget_local_id() - delta < 0
.
- Template Parameters
-
T
- Parameters
-
x Value to send. delta Offset substracted to the calling work-item's id.
- Returns
- The value sent by the work-item whose id is
get_local_id() - delta
.Exchange values ofx
between work-items in a subgroup. shuffle_xor is a specialized version of shuffle that may be optimized.
- Template Parameters
-
T
- Parameters
-
x Value to send. mask Mask applied to the calling work-item's, must be constant across the subgroup.
- Returns
- The value sent by the work-item whose id is
get_local_id() ^ mask
.Exchange values ofx
andy
between work-items in a subgroup. Two inputs shuffles can be thought as a one input shuffle on a virtual subgroup twice as big.
- Template Parameters
-
T
- Parameters
-
x Value to send. y Value to send. localId Work-item id to retrieve, must be between 0 and twice the subgroup size.
- Returns
- The value
x
sent by the work-item whose id islocalId
iflocalId
is between 0 and the subgroup size. Return the valuey
sent the work-item whose id islocalId % get_local_range()
otherwise.Exchange values ofx
andy
between work-items in a subgroup. Two inputs shuffles can be thought as a one input shuffle on a virtual subgroup twice as big. shuffle_down is a specialized version of shuffle that may be optimized.
- Template Parameters
-
T
- Parameters
-
x Value to send. y Value to send. delta Offset added to the calling work-item's id, must be less than the subgroup size.
- Returns
- The value
x
sent by the work-item whose id isget_local_id() + delta
if the result is between 0 and the subgroup size. Return the valuey
sent by the work-item whose id is(get_local_id() + delta) % get_local_range()
otherwise.Exchange values ofx
andy
between work-items in a subgroup. Two inputs shuffles can be thought as a one input shuffle on a virtual subgroup twice as big. shuffle_up is a specialized version of shuffle that may be optimized.
- Template Parameters
-
T
- Parameters
-
x Value to send. y Value to send. delta Offset added to the calling work-item's id, must be less than the subgroup size.
- Returns
- The value
x
sent by the work-item whose id isget_local_id() - delta
if the result is between 0 and the subgroup size. Return the valuey
sent by the work-item whose id is(get_local_id() - delta) % get_local_range()
otherwise.Load contiguous data fromsrc
.
- Template Parameters
-
T Space
- Parameters
-
src Pointer to the data to load, must be the same across all work-items in the subgroup.
- Returns
- T Data corresponding to
src + get_local_id()
.Load contiguous data fromsrc
.
- Template Parameters
-
T N Number of element to load per work-item. Space
- Parameters
-
src Pointer to the data to load, must be the same across all work-items in the subgroup.
- Returns
- T Data corresponding to
src + get_local_id() + i * get_max_local_range()
fori
between 0 andN.Store
contiguous data todst
.
- Template Parameters
-
T Space
- Parameters
-
dst Pointer to the data to store, must be the same across all work-items in the subgroup. x Value to store at dst + get_local_id()
.Store contiguous data todst
.
- Template Parameters
-
T N Number of element to store per work-item. Space
- Parameters
-
dst Pointer to the data to store, must be the same across all work-items in the subgroup. x Values to store at dst + get_local_id() + i * get_max_local_range()
fori
between 0 andN.Construct
a new subgroup object. Constructor is private to enforce construction by nd_item::get_sub_group().subGroupId
- See also
- get_group_id.
- Parameters
-
subGroupRange
- See also
- get_group_range.
- Parameters
-
localId
- See also
- get_local_id.
- Parameters
-
localRange
- See also
- get_local_range.
Definition at line 149 of file sub_group.h.
◆ get_group_id()
|
inlinenoexcept |
Get an id representing the index of the subgroup within the work-group.
- Returns
- The subgroup id.
Definition at line 73 of file sub_group.h.
◆ get_group_range()
|
inlinenoexcept |
Get the number of subgroups within the work-group.
- Returns
- The subgroup range.
Definition at line 78 of file sub_group.h.
◆ get_local_id()
|
inlinenoexcept |
Get an id representing the index of the work-item within the subgroup.
- Returns
- The local id.
Definition at line 94 of file sub_group.h.
◆ get_local_range()
|
inlinenoexcept |
Get the number of work-items in the subgroup.
- Returns
- The local range.
Definition at line 99 of file sub_group.h.
◆ get_max_local_range()
|
inlinenoexcept |
Get the maximum number of work-items in any subgroups within the nd-range.
- Returns
- The maximum local range.
Definition at line 142 of file sub_group.h.
◆ get_uniform_group_range()
|
inlinenoexcept |
Get the number of subgroups per work-group in the uniform region of the nd-range.
- Returns
- The subgroup uniform range.
Definition at line 86 of file sub_group.h.
Member Data Documentation
◆ m_localId
size_t cl::sycl::experimental::sub_group::m_localId |
Definition at line 507 of file sub_group.h.
◆ m_localRange
size_t cl::sycl::experimental::sub_group::m_localRange |
Definition at line 508 of file sub_group.h.
◆ m_maxLocalRange
size_t cl::sycl::experimental::sub_group::m_maxLocalRange |
Definition at line 509 of file sub_group.h.
◆ m_subGroupId
size_t cl::sycl::experimental::sub_group::m_subGroupId |
Definition at line 504 of file sub_group.h.
◆ m_subGroupRange
size_t cl::sycl::experimental::sub_group::m_subGroupRange |
Definition at line 505 of file sub_group.h.
◆ m_uniformSubGroupRange
size_t cl::sycl::experimental::sub_group::m_uniformSubGroupRange |
Definition at line 506 of file sub_group.h.
The documentation for this struct was generated from the following file: