alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout > Struct Template Reference

Creates a functor operate on contiguous data concurrently. More...

#include <SimdAlgo.hpp>

Inheritance diagram for alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >:

Public Member Functions

constexpr SimdAlgo (T_WorkGroup const workGroup, T_Traverse traverse=T_Traverse{}, T_IdxLayout idxLayout=T_IdxLayout{})
constexpr T_IdxLayout getIdxLayoutPolicy () const
constexpr T_Traverse getTraversePolicy () const
constexpr T_WorkGroup getWorkGroup () const
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto transformReduce (auto const &acc, alpaka::concepts::Vector auto extents, auto const &neutralElement, auto &&reduceFunc, auto &&transformFunc, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const
 transform the input data and reduce it to a single value
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto transformReduce (auto const &acc, alpaka::concepts::Vector auto extents, auto const &neutralElement, auto &&reduceFunc, auto &&transformFunc, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const
 transform the input data and reduce it to a single value
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto transformReduce (auto const &acc, auto const &neutralElement, auto &&reduceFunc, auto &&transformFunc, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const
 transform the input data and reduce it to a single value
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto transformReduce (auto const &acc, auto const &neutralElement, auto &&reduceFunc, auto &&transformFunc, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const
 transform the input data and reduce it to a single value
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void concurrent (auto const &acc, auto &&func, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const
 execute the functor concurrently over the given data.
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void concurrent (auto const &acc, alpaka::concepts::Vector auto extents, auto &&func, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void concurrent (auto const &acc, auto &&func, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const
 execute the functor concurrently over the given data.
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void concurrent (auto const &acc, alpaka::concepts::Vector auto extents, auto &&func, alpaka::concepts::IDataSource auto &&data0, alpaka::concepts::IDataSource auto &&... dataN) const

Detailed Description

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
struct alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >

Creates a functor operate on contiguous data concurrently.

The class is automatically configured to use the best fitting SIMD width for the given data type and is able to expose instruction level parallelism.

Parameters
T_WorkGroupparticipating thread description. More than one thread can have the same index within the group. All worker with the same id will get the same index as result.
T_TraversePolicy to configure the method used to find the next valid index for a worker.
See also
namespace traverse
Parameters
T_IdxLayoutPolicy to define how index data will be mapped to worker threads.
See also
namespace layout

Definition at line 33 of file SimdAlgo.hpp.

Constructor & Destructor Documentation

◆ SimdAlgo()

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::SimdAlgo ( T_WorkGroup const workGroup,
T_Traverse traverse = T_Traverse{},
T_IdxLayout idxLayout = T_IdxLayout{} )
inlineconstexpr

Definition at line 37 of file SimdAlgo.hpp.

Member Function Documentation

◆ concurrent() [1/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::concurrent ( auto const & acc,
alpaka::concepts::Vector auto extents,
auto && func,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr
Parameters
extentsnumber of elements to process in each dimension

Definition at line 144 of file SimdAlgo.hpp.

◆ concurrent() [2/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::concurrent ( auto const & acc,
alpaka::concepts::Vector auto extents,
auto && func,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr
Parameters
extentsnumber of elements to process in each dimension

Definition at line 85 of file SimdAlgo.hpp.

◆ concurrent() [3/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::concurrent ( auto const & acc,
auto && func,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr

execute the functor concurrently over the given data.

Attention
The number of elements to process is derived from the first MdSpan object. All other MdSpan objects must have at least the same number of elements.
Parameters
T_maxConcurrencyInByteMaximum number of bytes to be used for concurrency. Concurrency bytes describe a virtual simd pack size which is not exceeded. Internally a best fitting SIMD width is calculated and instruction parallelism is exposed based on T_maxConcurrencyInByte.
T_MemAlignmentalignment of the memory, if no alignments is given the alignment will be derived from the MdSpan data descriptions
functhe functor to be executed
data0the first data to be processed
dataNthe remaining data to be processed

Definition at line 126 of file SimdAlgo.hpp.

◆ concurrent() [4/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr void alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::concurrent ( auto const & acc,
auto && func,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr

execute the functor concurrently over the given data.

Attention
The number of elements to process is derived from the first MdSpan object. All other MdSpan objects must have at least the same number of elements. The optimal concurrency is also derived from the first MdSpan.
Parameters
functhe functor to be executed
data0the first data to be processed
dataNthe remaining data to be processed

Definition at line 73 of file SimdAlgo.hpp.

◆ getIdxLayoutPolicy()

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
T_IdxLayout alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::getIdxLayoutPolicy ( ) const
inlineconstexpr

Definition at line 56 of file SimdAlgo.hpp.

◆ getTraversePolicy()

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
T_Traverse alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::getTraversePolicy ( ) const
inlineconstexpr

Definition at line 51 of file SimdAlgo.hpp.

◆ getWorkGroup()

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
T_WorkGroup alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::getWorkGroup ( ) const
inlineconstexpr

Definition at line 46 of file SimdAlgo.hpp.

◆ transformReduce() [1/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::transformReduce ( auto const & acc,
alpaka::concepts::Vector auto extents,
auto const & neutralElement,
auto && reduceFunc,
auto && transformFunc,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr

transform the input data and reduce it to a single value

Attention
If no extent is given the number of elements to process is derived from the first MdSpan object. All other MdSpan objects must have at least the same number of elements.
Parameters
neutralElementthe neutral element for the reduction operation
reduceFuncThe binary reduction operation to be executed, e.g. std::plus. The functor should support Simd packages.
transformFuncN-nary functor to be executed, values of all containers will be passed to the functor as arguments. The functor should support Simd packages. If not you can enforce the element wise execution by wrapping into ScalarFunc. If you would like to support stencil executions wrapp fn into StencilFunc. StencilFunc is getting all arguments as SimdPtr. If StencilFunc is used you should take care to not read outside of valid memory ranges by using sub-views to your input and output data. Optionally a transformFn can have an accelerator as first argument. If the result of this functor is a structured value providing an overload to simdize the type can improve the performance see alpaka::makeSimdized.
data0the first data to be processed
dataNthe remaining data to be processed
Returns
A single reduced value.
Parameters
extentsnumber of elements to process in each dimension
Template Parameters
T_maxConcurrencyInByteMaximum number of bytes to be used for concurrency. Concurrency bytes describe a virtual simd pack size which is not exceeded. Internally a best fitting SIMD width is calculated and instruction parallelism is exposed based on T_maxConcurrencyInByte.
T_MemAlignmentalignment of the memory, if no alignments is given the alignment will be derived from the MdSpan data descriptions

Definition at line 272 of file SimdAlgo.hpp.

◆ transformReduce() [2/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::transformReduce ( auto const & acc,
alpaka::concepts::Vector auto extents,
auto const & neutralElement,
auto && reduceFunc,
auto && transformFunc,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr

transform the input data and reduce it to a single value

Attention
If no extent is given the number of elements to process is derived from the first MdSpan object. All other MdSpan objects must have at least the same number of elements.
Parameters
neutralElementthe neutral element for the reduction operation
reduceFuncThe binary reduction operation to be executed, e.g. std::plus. The functor should support Simd packages.
transformFuncN-nary functor to be executed, values of all containers will be passed to the functor as arguments. The functor should support Simd packages. If not you can enforce the element wise execution by wrapping into ScalarFunc. If you would like to support stencil executions wrapp fn into StencilFunc. StencilFunc is getting all arguments as SimdPtr. If StencilFunc is used you should take care to not read outside of valid memory ranges by using sub-views to your input and output data. Optionally a transformFn can have an accelerator as first argument. If the result of this functor is a structured value providing an overload to simdize the type can improve the performance see alpaka::makeSimdized.
data0the first data to be processed
dataNthe remaining data to be processed
Returns
A single reduced value.
Parameters
extentsnumber of elements to process in each dimension

Definition at line 205 of file SimdAlgo.hpp.

◆ transformReduce() [3/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
template<uint32_t T_maxConcurrencyInByte, alpaka::concepts::Alignment T_MemAlignment = AutoAligned>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::transformReduce ( auto const & acc,
auto const & neutralElement,
auto && reduceFunc,
auto && transformFunc,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr

transform the input data and reduce it to a single value

Attention
If no extent is given the number of elements to process is derived from the first MdSpan object. All other MdSpan objects must have at least the same number of elements.
Parameters
neutralElementthe neutral element for the reduction operation
reduceFuncThe binary reduction operation to be executed, e.g. std::plus. The functor should support Simd packages.
transformFuncN-nary functor to be executed, values of all containers will be passed to the functor as arguments. The functor should support Simd packages. If not you can enforce the element wise execution by wrapping into ScalarFunc. If you would like to support stencil executions wrapp fn into StencilFunc. StencilFunc is getting all arguments as SimdPtr. If StencilFunc is used you should take care to not read outside of valid memory ranges by using sub-views to your input and output data. Optionally a transformFn can have an accelerator as first argument. If the result of this functor is a structured value providing an overload to simdize the type can improve the performance see alpaka::makeSimdized.
data0the first data to be processed
dataNthe remaining data to be processed
Returns
A single reduced value.
Template Parameters
T_maxConcurrencyInByteMaximum number of bytes to be used for concurrency. Concurrency bytes describe a virtual simd pack size which is not exceeded. Internally a best fitting SIMD width is calculated and instruction parallelism is exposed based on T_maxConcurrencyInByte.
T_MemAlignmentalignment of the memory, if no alignments is given the alignment will be derived from the MdSpan data descriptions

Definition at line 241 of file SimdAlgo.hpp.

◆ transformReduce() [4/4]

template<typename T_WorkGroup, concepts::IdxTraversing T_Traverse = traverse::Flat, concepts::IdxMapping T_IdxLayout = layout::Optimized>
ALPAKA_FN_INLINE ALPAKA_FN_ACC constexpr auto alpaka::onAcc::SimdAlgo< T_WorkGroup, T_Traverse, T_IdxLayout >::transformReduce ( auto const & acc,
auto const & neutralElement,
auto && reduceFunc,
auto && transformFunc,
alpaka::concepts::IDataSource auto && data0,
alpaka::concepts::IDataSource auto &&... dataN ) const
inlineconstexpr

transform the input data and reduce it to a single value

Attention
If no extent is given the number of elements to process is derived from the first MdSpan object. All other MdSpan objects must have at least the same number of elements.
Parameters
neutralElementthe neutral element for the reduction operation
reduceFuncThe binary reduction operation to be executed, e.g. std::plus. The functor should support Simd packages.
transformFuncN-nary functor to be executed, values of all containers will be passed to the functor as arguments. The functor should support Simd packages. If not you can enforce the element wise execution by wrapping into ScalarFunc. If you would like to support stencil executions wrapp fn into StencilFunc. StencilFunc is getting all arguments as SimdPtr. If StencilFunc is used you should take care to not read outside of valid memory ranges by using sub-views to your input and output data. Optionally a transformFn can have an accelerator as first argument. If the result of this functor is a structured value providing an overload to simdize the type can improve the performance see alpaka::makeSimdized.
data0the first data to be processed
dataNthe remaining data to be processed
Returns
A single reduced value.

Definition at line 183 of file SimdAlgo.hpp.


The documentation for this struct was generated from the following file: