12 #include <type_traits>
24 std::size_t TDimExtents,
29 if constexpr(TDimOut == 0 || TDimIn == 0)
31 else if constexpr(TDimOut == TDimIn)
33 else if constexpr(TDimOut == 1)
36 for(std::size_t d = 1; d < TDimIn; ++d)
37 out =
static_cast<TElem
>(out * extent[d] + in[d]);
40 else if constexpr(TDimIn == 1)
42 auto flat = in.front();
44 for(std::size_t d = TDimOut - 1u; d > 0; d--)
46 out[d] =
static_cast<TElem
>(flat % extent[d]);
49 out.
front() =
static_cast<TElem
>(flat);
53 static_assert(!
sizeof(TElem),
"Not implemented");
65 template<std::
size_t TDimOut, std::
size_t TDimIn, std::
size_t T
idxDimPitch,
typename TElem>
70 if constexpr(TDimOut == 0 || TDimIn == 0)
72 else if constexpr(TDimOut == TDimIn)
74 else if constexpr(TDimOut == 1)
76 using DimMinusOne =
DimInt<TDimIn - 1>;
77 return {in.back() + (subVecBegin<DimMinusOne>(pitches) * subVecBegin<DimMinusOne>(in)).sum()};
79 else if constexpr(TDimIn == 1)
83 TElem out = in.front();
84 for(std::size_t d = 0; d < TDimOut - 1u; ++d)
86 result[d] =
static_cast<TElem
>(out / pitches[d]);
94 static_assert(!
sizeof(TElem),
"Not implemented");
#define ALPAKA_UNREACHABLE(...)
Before CUDA 11.5 nvcc is unable to correctly identify return statements in 'if constexpr' branches....
constexpr ALPAKA_FN_HOST_ACC auto front() -> TVal &
#define ALPAKA_FN_HOST_ACC
#define ALPAKA_NO_HOST_ACC_WARNING
Disable nvcc warning: 'calling a host function from host device function.' Usage: ALPAKA_NO_HOST_ACC_...
The alpaka accelerator library.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto mapIdx(Vec< DimInt< TDimIn >, TElem > const &in, Vec< DimInt< TDimExtents >, TElem > const &extent) -> Vec< DimInt< TDimOut >, TElem >
Maps an N-dimensional index to an N-dimensional position. At least one dimension must always be 1 or ...
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_HOST_ACC auto mapIdxPitchBytes(Vec< DimInt< TDimIn >, TElem > const &in, Vec< DimInt< TidxDimPitch >, TElem > const &pitches) -> Vec< DimInt< TDimOut >, TElem >
Maps an N dimensional index to a N dimensional position based on the pitches of a view without paddin...
std::integral_constant< std::size_t, N > DimInt