14#if defined(ALPAKA_ACC_GPU_CUDA_ENABLED) || defined(ALPAKA_ACC_GPU_HIP_ENABLED)
19 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
26 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
33 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
39 return buf.m_spBufImpl->m_dev;
44 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
51 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
58 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
63 return buf.m_spBufImpl->m_extentElements;
68 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
74 return buf.m_spBufImpl->m_pMem;
79 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
88 return buf.m_spBufImpl->m_pMem;
92 throw std::runtime_error(
"The buffer is not accessible from the given device!");
97 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
103 if constexpr(TDim::value <= 1)
105 return alpaka::detail::calculatePitchesFromExtents<TElem>(buf.m_spBufImpl->m_extentElements);
109 return alpaka::detail::calculatePitchesFromExtentsAndPitch<TElem>(
110 buf.m_spBufImpl->m_extentElements,
111 buf.m_spBufImpl->m_rowPitchInBytes);
117 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
128 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
135 template<
typename TApi,
typename TElem,
typename TDim,
typename TIdx>
143 TElem* pDev(
nullptr);
147 const_cast<void*
>(
reinterpret_cast<void const*
>(
getPtrNative(buf))),
155 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 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.