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) || defined(ARCANE_COMPILING_HIP)
27inline __device__ std::byte* _getAcceleratorSharedMemory()
29 extern __shared__
Int64 shared_memory_ptr[];
30 return reinterpret_cast<std::byte*
>(shared_memory_ptr);
50template <
typename T, Int32 Extent>
53 friend ::Arcane::Impl::HostKernelRemainingArgsHelper;
58 static_assert(std::is_trivially_copyable_v<T>,
"type T is not trivially copiable");
69 _addShareMemory(command);
74 _addShareMemory(command);
79 return { m_ptr,
m_size.size() };
84#if defined(ARCANE_COMPILING_CUDA) || defined(ARCANE_COMPILING_HIP)
85 ARCCORE_DEVICE
void _internalExecWorkItemAtBegin(
Int32)
87 std::byte* begin = Impl::_getAcceleratorSharedMemory() +
m_offset;
88 m_ptr =
reinterpret_cast<T*
>(begin);
90 ARCCORE_DEVICE
void _internalExecWorkItemAtEnd(
Int32){};
93#if defined(ARCANE_COMPILING_SYCL)
97 m_ptr =
reinterpret_cast<T*
>(begin);
102 void _internalHostExecWorkItemAtBegin()
104 m_ptr =
new T[
m_size.size()];
106 void _internalHostExecWorkItemAtEnd()
Classe pour appliquer la finalisation pour les arguments supplémentaires.
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.