13#if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) || defined(ALPAKA_ACC_GPU_HIP_ENABLED)
18 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
25 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
32 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
38 return buf.m_spBufImpl->m_dev;
43 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
50 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
57 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
62 return buf.m_spBufImpl->m_extentElements;
67 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
73 return buf.m_spBufImpl->m_pMem;
78 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
87 return buf.m_spBufImpl->m_pMem;
91 throw std::runtime_error(
"The buffer is not accessible from the given device!");
96 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
103 if constexpr(TDim::value > 0)
105 v.
back() =
sizeof(TElem);
106 if constexpr(TDim::value > 1)
108 v[TDim::value - 2] =
static_cast<TIdx
>(buf.m_spBufImpl->m_rowPitchInBytes);
109 for(TIdx i = TDim::value - 2; i > 0; i--)
110 v[i - 1] = buf.m_spBufImpl->m_extentElements[i] * v[i];
118 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
129 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
136 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
144 TElem* pDev(
nullptr);
148 const_cast<void*
>(
reinterpret_cast<void const*
>(
getPtrNative(buf))),
156 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
ALPAKA_NO_HOST_ACC_WARNING static ALPAKA_FN_HOST_ACC constexpr auto zeros() -> Vec< TDim, TVal >
Zero value constructor.
ALPAKA_FN_HOST_ACC constexpr auto back() -> TVal &
ALPAKA_FN_HOST auto getPtrNative(TView const &view) -> Elem< TView > const *
Gets the native pointer of the memory view.
ALPAKA_FN_HOST auto getDev(T const &t)
The memory const-buffer type trait.
The dimension getter type trait.
ALPAKA_FN_HOST auto operator()(ConstBufUniformCudaHipRt< TApi, TElem, TDim, TIdx > const &buf) const
The GetExtents trait for getting the extents of an object as an alpaka::Vec.
The GetOffsets trait for getting the offsets of an object as an alpaka::Vec.
Customization point for getPitchesInBytes. The default implementation uses the extent to calculate th...
static ALPAKA_FN_HOST auto getPtrDev(ConstBufCpu< TElem, TDim, TIdx > const &buf, DevUniformCudaHipRt< TApi > const &) -> TElem const *
The pointer on device get trait.
The native pointer get trait.
The trait to transform a mutable buffer into a constant one.