alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
ConstBufGenericSycl.hpp
Go to the documentation of this file.
1/* Copyright 2024 Jan Stephan, Luca Ferragina, Aurora Perego, Andrea Bocci
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
11#include "alpaka/dim/Traits.hpp"
15#include "alpaka/vec/Vec.hpp"
16
17#include <memory>
18#include <type_traits>
19
20#ifdef ALPAKA_ACC_SYCL_ENABLED
21
22# include <sycl/sycl.hpp>
23
24namespace alpaka
25{
26 // Predeclaration
27 template<typename TElem, typename TDim, typename TIdx, concepts::Tag TTag>
28 class BufGenericSycl;
29
30 //! The SYCL memory buffer.
31 template<typename TElem, typename TDim, typename TIdx, concepts::Tag TTag>
32 class ConstBufGenericSycl
33 : public internal::ViewAccessorType<DevGenericSycl<TTag>, ConstBufGenericSycl<TElem, TDim, TIdx, TTag>>
34 {
35 public:
36 //! Constructor
37 template<typename TExtent, typename Deleter>
38 ConstBufGenericSycl(DevGenericSycl<TTag> const& dev, TElem* pMem, Deleter deleter, TExtent const& extent)
39 : m_spBufImpl{std::make_shared<detail::BufGenericSyclImpl<TElem, TDim, TIdx, TTag>>(
40 dev,
41 pMem,
42 std::move(deleter),
43 extent)}
44 {
45 }
46
47 //! Constructor for a ConstBuf from a BufGenericSycl
48 ALPAKA_FN_HOST ConstBufGenericSycl(BufGenericSycl<TElem, TDim, TIdx, TTag> const& buf)
49 : m_spBufImpl{buf.m_spBufImpl}
50 {
51 }
52
53 //! Constructor for a ConstBuf from a BufGenericSycl
54 ALPAKA_FN_HOST ConstBufGenericSycl(BufGenericSycl<TElem, TDim, TIdx, TTag>&& buf)
55 : m_spBufImpl{std::move(buf.m_spBufImpl)}
56 {
57 }
58
59 private:
60 std::shared_ptr<detail::BufGenericSyclImpl<TElem, TDim, TIdx, TTag>> m_spBufImpl;
61
66 };
67} // namespace alpaka
68
69#endif
#define ALPAKA_FN_HOST
Definition Common.hpp:40
typename ViewAccessor< TDev >::template AccessorType< TView > ViewAccessorType
The alpaka accelerator library.
STL namespace.
The device get trait.
Definition Traits.hpp:27
The GetExtents trait for getting the extents of an object as an alpaka::Vec.
Definition Traits.hpp:37
The pointer on device get trait.
Definition Traits.hpp:84
The native pointer get trait.
Definition Traits.hpp:80