PandA-2024.02
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
DesignFlowManager Class Referencefinal

#include <design_flow_manager.hpp>

Collaboration diagram for DesignFlowManager:
Collaboration graph
[legend]

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, DesignFlowStepNecessitySorterpossibly_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_tsuccess_executions
 The number of times each step is executed with success. More...
 
CustomMap< vertex, size_tunchanged_executions
 The number of times each step is executed with unchanged exit. More...
 
CustomMap< vertex, size_tskipped_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...
 

Detailed Description

Definition at line 88 of file design_flow_manager.hpp.

Constructor & Destructor Documentation

◆ DesignFlowManager()

DesignFlowManager::DesignFlowManager ( const ParameterConstRef  parameters)
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().

Here is the call graph for this function:

◆ ~DesignFlowManager()

DesignFlowManager::~DesignFlowManager ( )
virtualdefault

Destructor.

Referenced by DesignFlowManager().

Here is the caller graph for this function:

Member Function Documentation

◆ AddStep()

void DesignFlowManager::AddStep ( const DesignFlowStepRef  step)

Add step and corresponding dependencies to the design flow.

Parameters
stepis the step to be added

Definition at line 158 of file design_flow_manager.cpp.

References RecursivelyAddSteps().

Here is the call graph for this function:

◆ AddSteps()

void DesignFlowManager::AddSteps ( const DesignFlowStepSet steps)

Add steps and corresponding dependencies to the design flow.

Parameters
stepsis the set of steps to be added

Definition at line 165 of file design_flow_manager.cpp.

References RecursivelyAddSteps().

Here is the call graph for this function:

◆ CGetDesignFlowGraph()

const DesignFlowGraphConstRef DesignFlowManager::CGetDesignFlowGraph ( ) const

Return the design flow graph.

Returns
the design flow graph

Definition at line 368 of file design_flow_manager.cpp.

References design_flow_graph.

◆ CGetDesignFlowStepFactory()

DesignFlowStepFactoryConstRef DesignFlowManager::CGetDesignFlowStepFactory ( const std::string &  prefix) const

Return the factory which can create design flow step with signature beginning with prefix.

Parameters
prefixis the beginning of the steps that the factory should be created
Returns
the corresponding factory

Definition at line 955 of file design_flow_manager.cpp.

References design_flow_step_factories, and THROW_ASSERT.

Referenced by CreateFlowStep().

Here is the caller graph for this function:

◆ Consolidate()

void DesignFlowManager::Consolidate ( )
private

Connect source and sink vertices to entry and exit.

◆ CreateFlowStep()

const DesignFlowStepRef DesignFlowManager::CreateFlowStep ( const std::string &  signature) const

Create a design flow step.

Parameters
signatureis the signature of the step to be created
Returns
the created design flow step

Definition at line 1102 of file design_flow_manager.cpp.

References CGetDesignFlowStepFactory(), and THROW_ASSERT.

Here is the call graph for this function:

◆ DeExecute()

void DesignFlowManager::DeExecute ( const vertex  starting_vertex,
bool  force_execution 
)
private

Recursively remove executed flag starting from a vertex.

Parameters
starting_vertexis the starting vertex
force_executionspecifies 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().

Here is the caller graph for this function:

◆ Exec()

void DesignFlowManager::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().

Here is the call graph for this function:

◆ GetDesignFlowStep()

vertex DesignFlowManager::GetDesignFlowStep ( const std::string &  signature) const

Return the vertex associated with a design step if exists, NULL_VERTEX otherwise.

Parameters
signatureis 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().

Here is the caller graph for this function:

◆ GetStatus()

DesignFlowStep_Status DesignFlowManager::GetStatus ( const std::string &  signature) const

Return the status of a design step (if it does not exist return NONEXISTENT)

Parameters
signatureis 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.

Here is the call graph for this function:

◆ RecursivelyAddSteps()

void DesignFlowManager::RecursivelyAddSteps ( const DesignFlowStepSet steps,
const bool  unnecessary 
)
private

Recursively add steps and corresponding dependencies to the design flow.

Parameters
stepsis the set of steps to be added
unnecessaryspecify 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterFactory()

void DesignFlowManager::RegisterFactory ( const DesignFlowStepFactoryConstRef  factory)

Register a design flow step factory.

Parameters
factoryis the factory to be registered

Definition at line 962 of file design_flow_manager.cpp.

References design_flow_step_factories.

◆ WriteLoopDot()

void DesignFlowManager::WriteLoopDot ( ) const
private

Field Documentation

◆ accumulated_execution_time

CustomMap<vertex, long> DesignFlowManager::accumulated_execution_time
private

The accumulated times of each step.

Definition at line 130 of file design_flow_manager.hpp.

Referenced by Exec().

◆ debug_level

int DesignFlowManager::debug_level
private

The debug level.

Definition at line 149 of file design_flow_manager.hpp.

Referenced by DeExecute(), DesignFlowManager(), Exec(), and RecursivelyAddSteps().

◆ design_flow_graph

const DesignFlowGraphRef DesignFlowManager::design_flow_graph
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().

◆ design_flow_graphs_collection

const DesignFlowGraphsCollectionRef DesignFlowManager::design_flow_graphs_collection
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().

◆ design_flow_step_factories

CustomUnorderedMap<std::string, DesignFlowStepFactoryConstRef> DesignFlowManager::design_flow_step_factories
private

The registered factories.

Definition at line 109 of file design_flow_manager.hpp.

Referenced by CGetDesignFlowStepFactory(), and RegisterFactory().

◆ edge_history

CustomMap<size_t, CustomUnorderedMapStable<EdgeDescriptor, int> > DesignFlowManager::edge_history
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().

◆ feedback_design_flow_graph

const DesignFlowGraphConstRef DesignFlowManager::feedback_design_flow_graph
private

The design flow graph with feedback edges.

Definition at line 102 of file design_flow_manager.hpp.

Referenced by Exec(), RecursivelyAddSteps(), and WriteLoopDot().

◆ output_level

const int DesignFlowManager::output_level
private

The output level.

Definition at line 146 of file design_flow_manager.hpp.

Referenced by Exec().

◆ parameters

const ParameterConstRef DesignFlowManager::parameters
private

The set of input parameters.

Definition at line 143 of file design_flow_manager.hpp.

Referenced by DesignFlowManager(), Exec(), and RecursivelyAddSteps().

◆ possibly_ready

std::set<vertex, DesignFlowStepNecessitySorter> DesignFlowManager::possibly_ready
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().

◆ skipped_executions

CustomMap<vertex, size_t> DesignFlowManager::skipped_executions
private

The number of times the execution of a step is skipped.

Definition at line 139 of file design_flow_manager.hpp.

Referenced by Exec().

◆ step_counter

size_t DesignFlowManager::step_counter = 0
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().

◆ step_names

CustomMap<vertex, std::string> DesignFlowManager::step_names
private

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().

◆ success_executions

CustomMap<vertex, size_t> DesignFlowManager::success_executions
private

The number of times each step is executed with success.

Definition at line 133 of file design_flow_manager.hpp.

Referenced by Exec().

◆ unchanged_executions

CustomMap<vertex, size_t> DesignFlowManager::unchanged_executions
private

The number of times each step is executed with unchanged exit.

Definition at line 136 of file design_flow_manager.hpp.

Referenced by Exec().

◆ vertex_history

CustomMap<size_t, CustomMap<vertex, DesignFlowStep_Status> > DesignFlowManager::vertex_history
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().


The documentation for this class was generated from the following files:

Generated on Mon Feb 12 2024 13:03:49 for PandA-2024.02 by doxygen 1.8.13