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 : public internal::ViewAccessOps<ConstBufGenericSycl<TElem, TDim, TIdx, TTag>>
33 {
34 public:
35 //! Constructor
36 template<typename TExtent, typename Deleter>
37 ConstBufGenericSycl(DevGenericSycl<TTag> const& dev, TElem* pMem, Deleter deleter, TExtent const& extent)
38 : m_spBufImpl{std::make_shared<detail::BufGenericSyclImpl<TElem, TDim, TIdx, TTag>>(
39 dev,
40 pMem,
41 std::move(deleter),
42 extent)}
43 {
44 }
45
46 //! Constructor for a ConstBuf from a BufGenericSycl
47 ALPAKA_FN_HOST ConstBufGenericSycl(BufGenericSycl<TElem, TDim, TIdx, TTag> const& buf)
48 : m_spBufImpl{buf.m_spBufImpl}
49 {
50 }
51
52 //! Constructor for a ConstBuf from a BufGenericSycl
53 ALPAKA_FN_HOST ConstBufGenericSycl(BufGenericSycl<TElem, TDim, TIdx, TTag>&& buf)
54 : m_spBufImpl{std::move(buf.m_spBufImpl)}
55 {
56 }
57
58 private:
59 std::shared_ptr<detail::BufGenericSyclImpl<TElem, TDim, TIdx, TTag>> m_spBufImpl;
60
65 };
66} // namespace alpaka
67
68#endif
#define ALPAKA_FN_HOST
Definition Common.hpp:40
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:58
The native pointer get trait.
Definition Traits.hpp:54