alpaka
Abstraction Library for Parallel Kernel Acceleration
BlockSharedMemDynGenericSycl.hpp
Go to the documentation of this file.
1 /* Copyright 2023 Jan Stephan, Andrea Bocci
2  * SPDX-License-Identifier: MPL-2.0
3  */
4 
5 #pragma once
6 
8 
9 #include <cstddef>
10 
11 #ifdef ALPAKA_ACC_SYCL_ENABLED
12 # include <sycl/sycl.hpp>
13 
14 namespace alpaka
15 {
16  //! The SYCL block shared memory allocator.
17  class BlockSharedMemDynGenericSycl
18  : public concepts::Implements<ConceptBlockSharedDyn, BlockSharedMemDynGenericSycl>
19  {
20  public:
21  using BlockSharedMemDynBase = BlockSharedMemDynGenericSycl;
22 
23  BlockSharedMemDynGenericSycl(sycl::local_accessor<std::byte> accessor) : m_accessor{accessor}
24  {
25  }
26 
27  sycl::local_accessor<std::byte> m_accessor;
28  };
29 } // namespace alpaka
30 
31 namespace alpaka::trait
32 {
33  template<typename T>
34  struct GetDynSharedMem<T, BlockSharedMemDynGenericSycl>
35  {
36  static auto getMem(BlockSharedMemDynGenericSycl const& shared) -> T*
37  {
38  return reinterpret_cast<T*>(shared.m_accessor.get_pointer().get());
39  }
40  };
41 } // namespace alpaka::trait
42 
43 #endif
The accelerator traits.
The alpaka accelerator library.