PandA-2024.02
|
#include <design_flow_manager.hpp>
Public Member Functions | |
DesignFlowManager (const ParameterConstRef parameters) | |
Constructor. More... | |
virtual | ~DesignFlowManager () |
Destructor. More... | |
virtual void | Exec () final |
Execute the design flow. More... | |
void | AddStep (const DesignFlowStepRef step) |
Add step and corresponding dependencies to the design flow. More... | |
void | AddSteps (const DesignFlowStepSet &steps) |
Add steps and corresponding dependencies to the design flow. More... | |
const DesignFlowGraphConstRef | CGetDesignFlowGraph () const |
Return the design flow graph. More... | |
vertex | GetDesignFlowStep (const std::string &signature) const |
Return the vertex associated with a design step if exists, NULL_VERTEX otherwise. More... | |
DesignFlowStep_Status | GetStatus (const std::string &signature) const |
Return the status of a design step (if it does not exist return NONEXISTENT) More... | |
DesignFlowStepFactoryConstRef | CGetDesignFlowStepFactory (const std::string &prefix) const |
Return the factory which can create design flow step with signature beginning with prefix. More... | |
void | RegisterFactory (const DesignFlowStepFactoryConstRef factory) |
Register a design flow step factory. More... | |
const DesignFlowStepRef | CreateFlowStep (const std::string &signature) const |
Create a design flow step. More... | |
Private Member Functions | |
void | RecursivelyAddSteps (const DesignFlowStepSet &steps, const bool unnecessary) |
Recursively add steps and corresponding dependencies to the design flow. More... | |
void | DeExecute (const vertex starting_vertex, bool force_execution) |
Recursively remove executed flag starting from a vertex. More... | |
void | Consolidate () |
Connect source and sink vertices to entry and exit. More... | |
void | WriteLoopDot () const |
Private Attributes | |
const DesignFlowGraphsCollectionRef | design_flow_graphs_collection |
The bulk graph of steps composing the design flow. More... | |
const DesignFlowGraphRef | design_flow_graph |
The graph of steps composing the design flow. More... | |
const DesignFlowGraphConstRef | feedback_design_flow_graph |
The design flow graph with feedback edges. More... | |
std::set< vertex, DesignFlowStepNecessitySorter > | possibly_ready |
The set of potentially ready steps; when a step is added to set is ready to be executed, but it can become unready because of new added vertices. More... | |
CustomUnorderedMap< std::string, DesignFlowStepFactoryConstRef > | design_flow_step_factories |
The registered factories. More... | |
CustomMap< size_t, CustomMap< vertex, DesignFlowStep_Status > > | vertex_history |
This structure stores "history of design flow graph manager - vertices" First key is the iteration Second key is the vertex If a vertex is not present in a iteration, it was not yet been created The first value is the status. More... | |
CustomMap< size_t, CustomUnorderedMapStable< EdgeDescriptor, int > > | edge_history |
This structure stores "history of design flow graph manager - edges" First key is the iteration Second key is the edge Value is the selector. More... | |
CustomMap< vertex, std::string > | step_names |
The name of each vertex (we have to store since it is possible that it cannot be recomputed at the end - for example because the corresponding task graph has been deallocated) More... | |
CustomMap< vertex, long > | accumulated_execution_time |
The accumulated times of each step. More... | |
CustomMap< vertex, size_t > | success_executions |
The number of times each step is executed with success. More... | |
CustomMap< vertex, size_t > | unchanged_executions |
The number of times each step is executed with unchanged exit. More... | |
CustomMap< vertex, size_t > | skipped_executions |
The number of times the execution of a step is skipped. More... | |
const ParameterConstRef | parameters |
The set of input parameters. More... | |
const int | output_level |
The output level. More... | |
int | debug_level |
The debug level. More... | |
Static Private Attributes | |
static size_t | step_counter = 0 |
NOTE: static should be removed when all the design flow managers will be merged Counter of current iteration. More... | |
Definition at line 88 of file design_flow_manager.hpp.
|
explicit |
Constructor.
Definition at line 114 of file design_flow_manager.cpp.
References debug_level, DEBUG_LEVEL_PARANOIC, design_flow_graph, design_flow_graphs_collection, EMPTY, GET_CLASS, parameters, step_counter, step_names, and ~DesignFlowManager().
|
virtualdefault |
void DesignFlowManager::AddStep | ( | const DesignFlowStepRef | step | ) |
Add step and corresponding dependencies to the design flow.
step | is the step to be added |
Definition at line 158 of file design_flow_manager.cpp.
References RecursivelyAddSteps().
void DesignFlowManager::AddSteps | ( | const DesignFlowStepSet & | steps | ) |
Add steps and corresponding dependencies to the design flow.
steps | is the set of steps to be added |
Definition at line 165 of file design_flow_manager.cpp.
References RecursivelyAddSteps().
const DesignFlowGraphConstRef DesignFlowManager::CGetDesignFlowGraph | ( | ) | const |
Return the design flow graph.
Definition at line 368 of file design_flow_manager.cpp.
References design_flow_graph.
DesignFlowStepFactoryConstRef DesignFlowManager::CGetDesignFlowStepFactory | ( | const std::string & | prefix | ) | const |
Return the factory which can create design flow step with signature beginning with prefix.
prefix | is the beginning of the steps that the factory should be created |
Definition at line 955 of file design_flow_manager.cpp.
References design_flow_step_factories, and THROW_ASSERT.
Referenced by CreateFlowStep().
|
private |
Connect source and sink vertices to entry and exit.
const DesignFlowStepRef DesignFlowManager::CreateFlowStep | ( | const std::string & | signature | ) | const |
Create a design flow step.
signature | is the signature of the step to be created |
Definition at line 1102 of file design_flow_manager.cpp.
References CGetDesignFlowStepFactory(), and THROW_ASSERT.
Recursively remove executed flag starting from a vertex.
starting_vertex | is the starting vertex |
force_execution | specifies if a skipped vertex has to be changed into a unexecuted |
Set not executed on the starting vertex
Check if the vertex is already ready
Propagating to successor
Definition at line 967 of file design_flow_manager.cpp.
References ABORTED, debug_level, DEBUG_LEVEL_PARANOIC, design_flow_graph, EMPTY, INDENT_DBG_MEX, NONEXISTENT, possibly_ready, SKIPPED, SUCCESS, lenet_tvm::target, THROW_UNREACHABLE, UNCHANGED, UNEXECUTED, and UNNECESSARY.
Referenced by Exec().
|
finalvirtual |
Execute the design flow.
Now check if next is actually ready First of all check if there are new dependence to add
Now iterate on ingoing precedence edge
Save the current status of the graph in history
Add steps and edges from post dependencies
Post dependence previously required and previously executed; Now it is not more required, otherwise execution flag should just invalidated
Save the current status of the graph in history
Definition at line 373 of file design_flow_manager.cpp.
References ABORTED, accumulated_execution_time, DesignFlowGraph::AUX_SELECTOR, debug_level, DEBUG_LEVEL_PARANOIC, DEBUG_LEVEL_VERY_PEDANTIC, DeExecute(), DesignFlowGraph::DEPENDENCE_FEEDBACK_SELECTOR, DesignFlowStep::DEPENDENCE_RELATIONSHIP, DesignFlowGraph::DEPENDENCE_SELECTOR, design_flow_graph, design_flow_graphs_collection, edge_history, edges, EMPTY, feedback_design_flow_graph, GetDesignFlowStep(), INDENT_DBG_MEX, INDENT_OUT_MEX, indentation, DesignFlowStep::INVALIDATION_RELATIONSHIP, NONEXISTENT, offset, output_level, OUTPUT_LEVEL_NONE, OUTPUT_LEVEL_VERY_PEDANTIC, parameters, possibly_ready, DesignFlowStep::PRECEDENCE_RELATIONSHIP, DesignFlowGraph::PRECEDENCE_SELECTOR, print_cpu_time(), PrintVirtualDataMemoryUsage(), RecursivelyAddSteps(), SKIPPED, skipped_executions, START_TIME, step_counter, step_names, STOP_TIME, STR, SUCCESS, success_executions, lenet_tvm::target, THROW_ASSERT, THROW_UNREACHABLE, UNCHANGED, unchanged_executions, UNEXECUTED, UNNECESSARY, vertex_history, and WriteLoopDot().
vertex DesignFlowManager::GetDesignFlowStep | ( | const std::string & | signature | ) | const |
Return the vertex associated with a design step if exists, NULL_VERTEX otherwise.
signature | is the signature of the design step |
Definition at line 950 of file design_flow_manager.cpp.
References design_flow_graphs_collection.
Referenced by Exec(), GetStatus(), and RecursivelyAddSteps().
DesignFlowStep_Status DesignFlowManager::GetStatus | ( | const std::string & | signature | ) | const |
Return the status of a design step (if it does not exist return NONEXISTENT)
signature | is the signature of the design step |
Definition at line 1089 of file design_flow_manager.cpp.
References design_flow_graph, GetDesignFlowStep(), NONEXISTENT, and NULL_VERTEX.
|
private |
Recursively add steps and corresponding dependencies to the design flow.
steps | is the set of steps to be added |
unnecessary | specify if the steps have to be added only as a possible precedence of other steps (i.e., they could be not executed if no step depends on them) |
Get vertex from design flow graph; there are four cases
The step already exists
The step already exists and we are trying to re-add as unnecessary; both if now it is unnecessary or not, nothing has to be done
The step already exists and it was unnecessary; now we are switching to necessary; note that computation of relationships of this node is performed to propagate the necessity If design flow step was ready I have to reinsert it into the set because of the ordering; so the setting of the unnecessary flag can not be factorized
The step already exists and it is already necessary; nothing to do
Add edges from dependencies
Add steps from precedences
Check if the added step is already ready
Definition at line 170 of file design_flow_manager.cpp.
References ABORTED, DesignFlowGraph::AUX_SELECTOR, debug_level, DEBUG_LEVEL_PARANOIC, DesignFlowStep::DEPENDENCE_RELATIONSHIP, DesignFlowGraph::DEPENDENCE_SELECTOR, design_flow_graph, design_flow_graphs_collection, EMPTY, feedback_design_flow_graph, GetDesignFlowStep(), INDENT_DBG_MEX, NONEXISTENT, parameters, possibly_ready, DesignFlowStep::PRECEDENCE_RELATIONSHIP, DesignFlowGraph::PRECEDENCE_SELECTOR, SKIPPED, step_counter, step_names, STR, SUCCESS, THROW_ASSERT, THROW_UNREACHABLE, UNCHANGED, UNEXECUTED, UNNECESSARY, and WriteLoopDot().
Referenced by AddStep(), AddSteps(), and Exec().
void DesignFlowManager::RegisterFactory | ( | const DesignFlowStepFactoryConstRef | factory | ) |
Register a design flow step factory.
factory | is the factory to be registered |
Definition at line 962 of file design_flow_manager.cpp.
References design_flow_step_factories.
|
private |
Definition at line 1110 of file design_flow_manager.cpp.
References DesignFlowGraph::AUX_SELECTOR, DesignFlowGraph::DEPENDENCE_FEEDBACK_SELECTOR, DesignFlowGraph::DEPENDENCE_SELECTOR, design_flow_graphs_collection, feedback_design_flow_graph, DesignFlowGraph::PRECEDENCE_SELECTOR, STR, and DesignFlowGraph::WriteDot().
Referenced by Exec(), and RecursivelyAddSteps().
The accumulated times of each step.
Definition at line 130 of file design_flow_manager.hpp.
Referenced by Exec().
|
private |
The debug level.
Definition at line 149 of file design_flow_manager.hpp.
Referenced by DeExecute(), DesignFlowManager(), Exec(), and RecursivelyAddSteps().
|
private |
The graph of steps composing the design flow.
Definition at line 99 of file design_flow_manager.hpp.
Referenced by CGetDesignFlowGraph(), DeExecute(), DesignFlowManager(), Exec(), GetStatus(), and RecursivelyAddSteps().
|
private |
The bulk graph of steps composing the design flow.
Definition at line 96 of file design_flow_manager.hpp.
Referenced by DesignFlowManager(), Exec(), GetDesignFlowStep(), RecursivelyAddSteps(), and WriteLoopDot().
|
private |
The registered factories.
Definition at line 109 of file design_flow_manager.hpp.
Referenced by CGetDesignFlowStepFactory(), and RegisterFactory().
|
private |
This structure stores "history of design flow graph manager - edges" First key is the iteration Second key is the edge Value is the selector.
Definition at line 123 of file design_flow_manager.hpp.
Referenced by Exec().
|
private |
The design flow graph with feedback edges.
Definition at line 102 of file design_flow_manager.hpp.
Referenced by Exec(), RecursivelyAddSteps(), and WriteLoopDot().
|
private |
|
private |
The set of input parameters.
Definition at line 143 of file design_flow_manager.hpp.
Referenced by DesignFlowManager(), Exec(), and RecursivelyAddSteps().
|
private |
The set of potentially ready steps; when a step is added to set is ready to be executed, but it can become unready because of new added vertices.
Definition at line 106 of file design_flow_manager.hpp.
Referenced by DeExecute(), Exec(), and RecursivelyAddSteps().
The number of times the execution of a step is skipped.
Definition at line 139 of file design_flow_manager.hpp.
Referenced by Exec().
|
staticprivate |
NOTE: static should be removed when all the design flow managers will be merged Counter of current iteration.
Definition at line 93 of file design_flow_manager.hpp.
Referenced by DesignFlowManager(), Exec(), and RecursivelyAddSteps().
The name of each vertex (we have to store since it is possible that it cannot be recomputed at the end - for example because the corresponding task graph has been deallocated)
Definition at line 127 of file design_flow_manager.hpp.
Referenced by DesignFlowManager(), Exec(), and RecursivelyAddSteps().
The number of times each step is executed with success.
Definition at line 133 of file design_flow_manager.hpp.
Referenced by Exec().
The number of times each step is executed with unchanged exit.
Definition at line 136 of file design_flow_manager.hpp.
Referenced by Exec().
|
private |
This structure stores "history of design flow graph manager - vertices" First key is the iteration Second key is the vertex If a vertex is not present in a iteration, it was not yet been created The first value is the status.
Definition at line 117 of file design_flow_manager.hpp.
Referenced by Exec().