12#ifndef ARCANE_ACCELERATOR_LOCALMEMORY_H
13#define ARCANE_ACCELERATOR_LOCALMEMORY_H
17#include "arcane/accelerator/core/RunCommand.h"
19#include "arccore/base/Span.h"
24namespace Arcane::Accelerator::Impl
26#if defined(ARCANE_COMPILING_CUDA_OR_HIP)
27inline __device__ std::byte* _getAcceleratorSharedMemory()
29 extern __shared__
Int64 shared_memory_ptr[];
30 return reinterpret_cast<std::byte*
>(shared_memory_ptr);
52template <
typename T, Int32 Extent>
59 static_assert(std::is_trivially_copyable_v<T>,
"type T is not trivially copiable");
71 _addShareMemory(command);
76 _addShareMemory(command);
81 return { m_ptr,
m_size.size() };
106namespace Arcane::Accelerator::Impl
118 template <
typename T, Int32 Extent>
static void
121 local_memory.m_ptr =
new T[local_memory.
m_size.size()];
123 template <
typename T, Int32 Extent>
static void
126 delete[] local_memory.m_ptr;
129#if defined(ARCANE_COMPILING_CUDA_OR_HIP)
130 template <
typename T, Int32 Extent>
static ARCCORE_DEVICE
void
133 std::byte* begin = Impl::_getAcceleratorSharedMemory() + local_memory.
m_offset;
134 local_memory.m_ptr =
reinterpret_cast<T*
>(begin);
136 template <
typename T, Int32 Extent>
static ARCCORE_DEVICE
void
142#if defined(ARCANE_COMPILING_SYCL)
143 template <
typename T, Int32 Extent>
static void
149 local_memory.m_ptr =
reinterpret_cast<T*
>(begin);
151 template <
typename T, Int32 Extent>
static void
Handler pour LocalMemory appelés en début et fin d'exécution de noyau.
Mémoire locale (shared) à une RunCommand.
Int32 m_offset
Offset depuis le début de la mémoire shared
::Arcane::Impl::ExtentStorage< Int32, Extent > m_size
Nombre d'éléments du tableau.
Gestion d'une commande sur accélérateur.
Spécialisation pour le nombre d'éléments connu à la compilation.
Vue d'un tableau d'éléments de type T.
constexpr __host__ __device__ pointer ptrAt(SizeType index) const
Adresse du index-ème élément.
Espace de nom pour l'utilisation des accélérateurs.
std::int64_t Int64
Type entier signé sur 64 bits.
constexpr Int32 DynExtent
Constante pour indiquer que la dimension d'un tableau est dynamique.
std::int32_t Int32
Type entier signé sur 32 bits.