14#include "arcane/accelerator/core/internal/RunCommandImpl.h"
15#include "arcane/accelerator/core/internal/AcceleratorCoreGlobalInternal.h"
17#include "arcane/utils/ForLoopTraceInfo.h"
19#include "arcane/utils/PlatformUtils.h"
21#include "arcane/accelerator/core/Runner.h"
22#include "arcane/accelerator/core/internal/IRunQueueEventImpl.h"
23#include "arcane/accelerator/core/internal/IRunQueueStream.h"
24#include "arcane/accelerator/core/internal/IRunnerRuntime.h"
25#include "arcane/accelerator/core/internal/RunQueueImpl.h"
26#include "arcane/accelerator/core/internal/ReduceMemoryImpl.h"
27#include "arcane/accelerator/core/internal/RunnerImpl.h"
32namespace Arcane::Accelerator::impl
42RunCommandImpl(RunQueueImpl* queue)
66 while (!m_reduce_memory_pool.empty()) {
67 delete m_reduce_memory_pool.top();
68 m_reduce_memory_pool.pop();
75IRunQueueEventImpl* RunCommandImpl::
78 if (m_use_sequential_timer_event)
79 return getSequentialRunQueueRuntime()->createEventImplWithTimer();
80 return runner()->_createEventWithTimer();
97 if (m_use_accelerator && !ProfilingRegistry::hasProfiling())
98 m_use_sequential_timer_event =
true;
100 m_start_event = _createEvent();
101 m_stop_event = _createEvent();
107RunCommandImpl* RunCommandImpl::
108create(RunQueueImpl* r)
110 return r->_internalCreateOrGetRunCommandImpl();
119notifyBeginLaunchKernel()
124 m_start_event->recordQueue(stream);
125 m_has_been_launched =
true;
126 if (ProfilingRegistry::hasProfiling()) {
127 m_begin_time = platform::getRealTimeNS();
128 m_loop_one_exec_stat_ptr = &m_loop_one_exec_stat;
129 m_loop_one_exec_stat.setBeginTime(m_begin_time);
141notifyEndLaunchKernel()
145 m_stop_event->recordQueue(stream);
166 m_start_event->recordQueue(stream);
179notifyEndExecuteKernel()
182 if (!m_has_been_launched)
194 ProfilingRegistry::_threadLocalForLoopInstance()->merge(*
exec_info,
flti);
208 m_nb_thread_per_block = 0;
209 m_parallel_loop_options = TaskFactory::defaultParallelLoopOptions();
211 m_loop_one_exec_stat.reset();
212 m_loop_one_exec_stat_ptr =
nullptr;
213 m_has_been_launched =
false;
219IReduceMemoryImpl* RunCommandImpl::
220getOrCreateReduceMemoryImpl()
222 ReduceMemoryImpl*
p = _getOrCreateReduceMemoryImpl();
224 m_active_reduce_memory_list.insert(
p);
233releaseReduceMemoryImpl(ReduceMemoryImpl* p)
235 auto x = m_active_reduce_memory_list.find(p);
236 if (x == m_active_reduce_memory_list.end())
238 m_active_reduce_memory_list.erase(x);
239 m_reduce_memory_pool.push(p);
245IRunQueueStream* RunCommandImpl::
246internalStream()
const
248 return m_queue->_internalStream();
254RunnerImpl* RunCommandImpl::
257 return m_queue->runner();
263ReduceMemoryImpl* RunCommandImpl::
264_getOrCreateReduceMemoryImpl()
268 if (!m_use_accelerator)
271 auto& pool = m_reduce_memory_pool;
274 ReduceMemoryImpl* p = pool.top();
278 return new ReduceMemoryImpl(
this);
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Classes, Types et macros pour gérer la concurrence.
Interface d'un flux d'exécution pour une RunQueue.
virtual void notifyBeginLaunchKernel(impl::RunCommandImpl &command)=0
Notification avant le lancement de la commande.
virtual void _setSyclLastCommandEvent(void *sycl_event_ptr)
Pour SYCL, positionne l'évènement associé à la dernière commande exécutée.
virtual void notifyEndLaunchKernel(impl::RunCommandImpl &command)=0
Notification de fin de lancement de la commande.
Classe pour gérer le profiling d'une seule exécution d'une boucle.
Informations de trace pour une boucle 'for'.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Chaîne de caractères unicode.
bool isAcceleratorPolicy(eExecutionPolicy exec_policy)
Indique si exec_policy correspond à un accélérateur.
std::int64_t Int64
Type entier signé sur 64 bits.