Arcane  v4.1.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
internal/RunCommandImpl.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* RunCommandImpl.h (C) 2000-2025 */
9/* */
10/* Implémentation de la gestion d'une commande sur accélérateur. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_ACCELERATOR_CORE_INTERNAL_RUNCOMMANDIMPL_H
13#define ARCANE_ACCELERATOR_CORE_INTERNAL_RUNCOMMANDIMPL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arccore/base/TraceInfo.h"
18#include "arccore/base/Profiling.h"
19#include "arccore/base/String.h"
20#include "arccore/base/ParallelLoopOptions.h"
21
23
24#include <set>
25#include <stack>
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30namespace Arcane::Accelerator::impl
31{
32
33/*---------------------------------------------------------------------------*/
34/*---------------------------------------------------------------------------*/
39class RunCommandImpl
40{
41 friend RunCommand;
42 friend RunQueueImpl;
43
44 public:
45
46 explicit RunCommandImpl(RunQueueImpl* queue);
47 ~RunCommandImpl();
48 RunCommandImpl(const RunCommandImpl&) = delete;
49 RunCommandImpl& operator=(const RunCommandImpl&) = delete;
50
51 public:
52
53 static RunCommandImpl* create(RunQueueImpl* r);
54
55 public:
56
57 const TraceInfo& traceInfo() const { return m_trace_info; }
58 const String& kernelName() const { return m_kernel_name; }
59
60 public:
61
65 impl::IReduceMemoryImpl* getOrCreateReduceMemoryImpl();
66 void releaseReduceMemoryImpl(ReduceMemoryImpl* p);
67 IRunQueueStream* internalStream() const;
68 RunnerImpl* runner() const;
69
70 public:
71
72 void notifyLaunchKernelSyclEvent(void* sycl_event_ptr);
73
74 private:
75
76 ReduceMemoryImpl* _getOrCreateReduceMemoryImpl();
77
78 private:
79
80 RunQueueImpl* m_queue;
81 TraceInfo m_trace_info;
82 String m_kernel_name;
83 Int32 m_nb_thread_per_block = 0;
84 ParallelLoopOptions m_parallel_loop_options;
85
86 // NOTE: cette pile gère la mémoire associé à un seul runtime
87 // Si on souhaite un jour supporté plusieurs runtimes il faudra une pile
88 // par runtime. On peut éventuellement limiter cela si on est sur
89 // qu'une commande est associée à un seul type (au sens runtime) de RunQueue.
90 std::stack<ReduceMemoryImpl*> m_reduce_memory_pool;
91
93 std::set<ReduceMemoryImpl*> m_active_reduce_memory_list;
94
96 bool m_has_been_launched = false;
97
99 bool m_use_profiling = false;
100
103
108
111
112 ForLoopOneExecStat m_loop_one_exec_stat;
113 ForLoopOneExecStat* m_loop_one_exec_stat_ptr = nullptr;
114
116 const bool m_use_accelerator = false;
117
126
129
132
135
136 private:
137
138 void _freePools();
139 void _reset();
140 void _init();
141 IRunQueueEventImpl* _createEvent();
143};
144
145/*---------------------------------------------------------------------------*/
146/*---------------------------------------------------------------------------*/
147
148} // namespace Arcane::Accelerator::impl
149
150/*---------------------------------------------------------------------------*/
151/*---------------------------------------------------------------------------*/
152
153#endif
Interface de la gestion mémoire pour les réductions.
Interface de l'implémentation d'un évènement.
Interface d'un flux d'exécution pour une RunQueue.
void notifyEndLaunchKernel()
Notification de la fin de lancement de la commande.
bool m_use_sequential_timer_event
Indique si on utilise les évènements séquentiels pour calculer le temps d'exécution.
void _notifyDestroyRunCommand()
Méthode appelée quand l'instance RunCommand associée est détruite.
void notifyLaunchKernelSyclEvent(void *sycl_event_ptr)
Notification du lancement d'un kernel SYCL.
IRunQueueEventImpl * m_stop_event
Évènements pour la fin de l'exécution.
bool m_has_been_launched
Indique si la commande a été lancée.
IRunQueueEventImpl * m_start_event
Évènements pour le début et la fin de l'exécution.
void notifyBeginLaunchKernel()
Notification du début d'exécution de la commande.
bool m_is_allow_reuse_command
Indique si on autorise à utiliser plusieurs fois la même commande.
Int64 m_begin_time
Temps au lancement de la commande.
bool m_may_be_put_in_pool
Indique si on peut remettre la commande dans le pool associé à la RunQueue.
bool m_has_living_run_command
Indique si une RunCommand a une référence sur cette instance.
Int32 m_shared_memory_size
Taille de la mémoire partagée à allouer.
std::set< ReduceMemoryImpl * > m_active_reduce_memory_list
Liste des réductions actives.
bool m_use_profiling
Indique si on souhaite le profiling.
void notifyEndExecuteKernel()
Notification de la fin d'exécution du noyau.
const bool m_use_accelerator
Indique si la commande s'exécute sur accélérateur.
Classe pour gérer le profiling d'une seule exécution d'une boucle.
Options d'exécution d'une boucle parallèle en multi-thread.
Chaîne de caractères unicode.
std::int64_t Int64
Type entier signé sur 64 bits.
std::int32_t Int32
Type entier signé sur 32 bits.