PandA-2024.02
|
superclass include More...
#include <port_swapping.hpp>
Public Member Functions | |
port_swapping (const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager) | |
Constructor. More... | |
~port_swapping () override | |
Destructor. More... | |
void | vertex_levels (const std::vector< PSE > &spt_edges, PSVertex root, size_t num_vertices_g, std::vector< PSVSet > &vset) |
This function calculates the levels of all te vertices starting from root. More... | |
int | vertex_distance (const std::vector< PSE > &spt_edges, PSVertex root, PSVertex dest, std::vector< PSVSet > &vset) |
This function calculates the distances between two vertices in a spanning tree. More... | |
PSVertex | find_max_degree (const CustomOrderedSet< std::pair< PSVertex, unsigned int >> &dSet) |
This function finds the maximum degree (out_edges) of a vertex. More... | |
void | update_degree (PSGraph g2, CustomOrderedSet< std::pair< PSVertex, unsigned int >> &dSet) |
This function updates the degree of all the vertices. More... | |
PSVertex | get_co_tree_vertex (PSVertex vertex, const std::vector< PSE > &edges) |
This function selects the right vertex from the co_tree_edges vector. More... | |
void | port_swapping_algorithm (PSGraph &g, std::vector< PSMultiStart > &vector_sets, size_t num_vertices_g, PSVertex root) |
This function computes the port_swapping. More... | |
std::vector< std::pair< PSVertex, unsigned int > > | p_swap (PSGraph &g) |
This function is the wrapper that executes port_swapping_algorithms and extracts the best solution. More... | |
bool | is_commutative_op (const std::string &operation) |
This function checks if an operation is commutative or not. More... | |
unsigned int | get_results (PSVertex operand, const std::vector< std::pair< PSVertex, unsigned int >> &results) |
This function returns the belonging set of a given vertex. More... | |
DesignFlowStep_Status | InternalExec () override |
Execute the step. More... | |
Public Member Functions inherited from HLSFunctionStep | |
HLSFunctionStep (const ParameterConstRef Param, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization=HLSFlowStepSpecializationConstRef()) | |
Constructor. More... | |
~HLSFunctionStep () override | |
Destructor. More... | |
bool | HasToBeExecuted () const override |
Check if this step has actually to be executed. More... | |
void | Initialize () override |
Initialize the step (i.e., like a constructor, but executed just before exec. More... | |
std::string | GetSignature () const final |
Return a unified identifier of this design step. More... | |
std::string | GetName () const final |
Return the name of this design step. More... | |
DesignFlowStep_Status | Exec () final |
Execute the step. More... | |
Public Member Functions inherited from HLS_step | |
HLS_step (const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization=HLSFlowStepSpecializationConstRef()) | |
Constructor. More... | |
~HLS_step () override | |
Destructor. More... | |
std::string | GetSignature () const override |
Return a unified identifier of this design step. More... | |
std::string | GetName () const override |
Return the name of this design step. More... | |
virtual std::string | GetKindText () const |
Return the name of the type of this frontend flow step. More... | |
DesignFlowStepFactoryConstRef | CGetDesignFlowStepFactory () const final |
Return the factory to create this type of steps. More... | |
void | ComputeRelationships (DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override |
Compute the relationships of a step with other steps. More... | |
Public Member Functions inherited from DesignFlowStep | |
DesignFlowStep (const DesignFlowManagerConstRef design_flow_manager, const ParameterConstRef parameters) | |
Constructor. More... | |
virtual | ~DesignFlowStep () |
Destructor. More... | |
DesignFlowStep_Status | GetStatus () const |
Return the status of this design step. More... | |
virtual void | WriteDot (std::ostream &out) const |
Write the label for a dot graph. More... | |
bool | IsComposed () const |
Returns if this step is composed. More... | |
int | CGetDebugLevel () const |
Return the debug level of the step. More... | |
virtual void | PrintInitialIR () const |
Dump the initial intermediate representation. More... | |
virtual void | PrintFinalIR () const |
Dump the final intermediate representation. More... | |
Protected Member Functions | |
const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > | ComputeHLSRelationships (const DesignFlowStep::RelationshipType relationship_type) const override |
Compute the relationship of this step. More... | |
Protected Member Functions inherited from HLSFunctionStep | |
void | ComputeRelationships (DesignFlowStepSet &design_flow_step_set, const DesignFlowStep::RelationshipType relationship_type) override |
Compute the relationships of a step with other steps. More... | |
Private Types | |
using | PSGraph = boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::property< boost::edge_color_t, boost::default_color_type > > |
using | PSEdge = boost::graph_traits< PSGraph >::edge_descriptor |
using | PSVertex = boost::graph_traits< PSGraph >::vertex_descriptor |
using | PSE = std::pair< unsigned int, unsigned int > |
using | PSVSet = struct { PSVertex v |
using | PSMultiStart = struct { std::vector< PSVSet > vset |
Private Attributes | |
int | belongs |
int | level |
std::vector< PSE > | spt_vector_edges |
std::vector< PSE > | co_tree_vector_edges |
std::vector< PSE > | odd_co_tree_vector_edges |
long unsigned int | cardinality |
Additional Inherited Members | |
Public Types inherited from DesignFlowStep | |
enum | RelationshipType { DEPENDENCE_RELATIONSHIP, INVALIDATION_RELATIONSHIP, PRECEDENCE_RELATIONSHIP } |
The relationship type. More... | |
Static Public Member Functions inherited from HLSFunctionStep | |
static std::string | ComputeSignature (const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization, const unsigned int function_id) |
Compute the signature of a hls flow step. More... | |
Static Public Member Functions inherited from HLS_step | |
static std::string | EnumToName (const HLSFlowStep_Type hls_flow_step_type) |
Given a HLS flow step type, return the name of the type. More... | |
static const std::string | ComputeSignature (const HLSFlowStep_Type hls_flow_step_type, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization) |
Compute the signature of a hls flow step. More... | |
Protected Attributes inherited from HLSFunctionStep | |
std::map< unsigned int, unsigned int > | last_bb_ver |
last bb version of the called functions More... | |
std::map< unsigned int, unsigned int > | last_bitvalue_ver |
The version of bit value IR representation on which this step was applied. More... | |
const unsigned int | funId |
identifier of the function to be processed (0 means that it is a global step) More... | |
hlsRef | HLS |
HLS data structure of the function to be analyzed. More... | |
unsigned int | bb_version |
The version of bb intermediate representation on which this step was applied. More... | |
unsigned int | bitvalue_version |
The version of bitvalue on which this step was applied. More... | |
unsigned int | memory_version |
The version of memory representation on which this step was applied. More... | |
Protected Attributes inherited from HLS_step | |
const HLS_managerRef | HLSMgr |
information about all the HLS synthesis More... | |
const HLSFlowStep_Type | hls_flow_step_type |
The type of this step. More... | |
const HLSFlowStepSpecializationConstRef | hls_flow_step_specialization |
The information about specialization. More... | |
Protected Attributes inherited from DesignFlowStep | |
bool | composed |
True if this step represents a composition of design flow steps (e.g., a flow); must be set by specialized constructors. More... | |
const Wrefcount< const DesignFlowManager > | design_flow_manager |
The design flow manager. More... | |
const ParameterConstRef | parameters |
Set of input parameters. More... | |
int | debug_level |
The debug level. More... | |
const int | output_level |
The output level. More... | |
Static Protected Attributes inherited from HLS_step | |
static CustomUnorderedMap< std::string, HLSFlowStep_Type > | command_line_name_to_enum |
Map hls step name to enum. More... | |
superclass include
Class managing a partial module binding based on simple conditions
Definition at line 53 of file port_swapping.hpp.
|
private |
Definition at line 60 of file port_swapping.hpp.
|
private |
Definition at line 58 of file port_swapping.hpp.
|
private |
Definition at line 57 of file port_swapping.hpp.
|
private |
Definition at line 69 of file port_swapping.hpp.
|
private |
Definition at line 59 of file port_swapping.hpp.
|
private |
Definition at line 63 of file port_swapping.hpp.
port_swapping::port_swapping | ( | const ParameterConstRef | Param, |
const HLS_managerRef | HLSMgr, | ||
unsigned int | funId, | ||
const DesignFlowManagerConstRef | design_flow_manager | ||
) |
Constructor.
design_flow_manager | is the design flow manager |
Definition at line 70 of file port_swapping.cpp.
References DesignFlowStep::debug_level, GET_CLASS, PORT_SWAPPING, and ~port_swapping().
|
overridedefault |
|
overrideprotectedvirtual |
Compute the relationship of this step.
relationship_type | is the type of relationship to be considered |
Reimplemented from HLS_step.
Definition at line 80 of file port_swapping.cpp.
References DesignFlowStep::DEPENDENCE_RELATIONSHIP, HLSFunctionStep::funId, HLS_step::HLSMgr, DesignFlowStep::INVALIDATION_RELATIONSHIP, DesignFlowStep::parameters, DesignFlowStep::PRECEDENCE_RELATIONSHIP, SAME_FUNCTION, THROW_UNREACHABLE, UNIQUE_MODULE_BINDING, and UNIQUE_REGISTER_BINDING.
port_swapping::PSVertex port_swapping::find_max_degree | ( | const CustomOrderedSet< std::pair< PSVertex, unsigned int >> & | dSet | ) |
This function finds the maximum degree (out_edges) of a vertex.
dSet | structure with all the vertices and relative degrees |
Definition at line 242 of file port_swapping.cpp.
References max.
Referenced by port_swapping_algorithm().
port_swapping::PSVertex port_swapping::get_co_tree_vertex | ( | PSVertex | vertex, |
const std::vector< PSE > & | edges | ||
) |
This function selects the right vertex from the co_tree_edges vector.
vertex | |
edges | vector of edges from which is taken the right one and from that the right vertex |
Definition at line 266 of file port_swapping.cpp.
Referenced by port_swapping_algorithm().
unsigned int port_swapping::get_results | ( | PSVertex | operand, |
const std::vector< std::pair< PSVertex, unsigned int >> & | results | ||
) |
This function returns the belonging set of a given vertex.
operand | which represents a vertex in the graph |
results | vector containing all the vertices and relative belonging sets |
Definition at line 479 of file port_swapping.cpp.
Referenced by InternalExec().
|
overridevirtual |
Execute the step.
no more than one running state could be considered
TOBEFIXED
Implements HLSFunctionStep.
Definition at line 491 of file port_swapping.cpp.
References hls::allocation_information, FunctionBehavior::CGetBehavioralHelper(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpNodeInfo(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, FunctionBehavior::FDFG, lenet_tvm::file, hls::functionId, HLSFunctionStep::funId, fu_binding::get_assign(), fu_binding::get_index(), GET_NAME, liveness::get_op_where_defined(), reg_binding::get_register(), get_results(), liveness::get_state_where_end(), liveness::get_state_where_run(), StorageValueInformation::get_storage_value_index(), AllocationInformation::get_string_name(), GET_TYPE, GetPath(), liveness::has_op_where_defined(), HLSFunctionStep::HLS, HLS_step::HLSMgr, INDENT_DBG_MEX, INDENT_OUT_MEX, INFINITE_UINT, StorageValueInformation::is_a_storage_value(), is_commutative_op(), tree_helper::is_parameter(), DesignFlowStep::output_level, OUTPUT_LEVEL_VERBOSE, p_swap(), BehavioralHelper::PrintVariable(), hls::Rfu, hls::Rliv, hls::Rreg, SET_A, SET_AB, SET_B, fu_binding::set_ports_are_swapped(), hls::storage_value_information, STR, SUCCESS, THROW_ASSERT, THROW_UNREACHABLE, TYPE_PHI, and UNCHANGED.
bool port_swapping::is_commutative_op | ( | const std::string & | operation | ) |
This function checks if an operation is commutative or not.
operation | name |
Definition at line 470 of file port_swapping.cpp.
References STOK, TOK_BIT_AND_EXPR, TOK_BIT_IOR_EXPR, TOK_BIT_XOR_EXPR, TOK_EQ_EXPR, TOK_MULT_EXPR, TOK_NE_EXPR, TOK_PLUS_EXPR, TOK_POINTER_PLUS_EXPR, TOK_WIDEN_MULT_EXPR, and TOK_WIDEN_SUM_EXPR.
Referenced by InternalExec().
std::vector< std::pair< port_swapping::PSVertex, unsigned int > > port_swapping::p_swap | ( | PSGraph & | g | ) |
This function is the wrapper that executes port_swapping_algorithms and extracts the best solution.
g | starting graph |
Definition at line 443 of file port_swapping.cpp.
References max, and port_swapping_algorithm().
Referenced by InternalExec().
void port_swapping::port_swapping_algorithm | ( | PSGraph & | g, |
std::vector< PSMultiStart > & | vector_sets, | ||
size_t | num_vertices_g, | ||
PSVertex | root | ||
) |
This function computes the port_swapping.
g | graph on which the algorithm is computed |
vector_sets | vector that will contain all the runs of the algorithm. It will contain the best solution |
num_vertices_g | number of vertices in the graph |
root | vertex from which the spanning tree is calculated |
Definition at line 282 of file port_swapping.cpp.
References edges, find_max_degree(), get_co_tree_vertex(), DesignFlowStep::parameters, SET_AB, lenet_tvm::target, update_degree(), vertex_distance(), and vertex_levels().
Referenced by p_swap().
void port_swapping::update_degree | ( | PSGraph | g2, |
CustomOrderedSet< std::pair< PSVertex, unsigned int >> & | dSet | ||
) |
This function updates the degree of all the vertices.
g2 | graph on which the degree of the vertices must be calculated |
dSet | set to be updated with all the vertices and relative degree |
Definition at line 257 of file port_swapping.cpp.
Referenced by port_swapping_algorithm().
int port_swapping::vertex_distance | ( | const std::vector< PSE > & | spt_edges, |
PSVertex | root, | ||
PSVertex | dest, | ||
std::vector< PSVSet > & | vset | ||
) |
This function calculates the distances between two vertices in a spanning tree.
spt_edges | edges of the spanning tree |
root | starting vertex |
num_vertices_g | number of vertices in the graph |
vset | structure that contains the vertices and the relative level and the belongings |
Definition at line 181 of file port_swapping.cpp.
References distance(), SET_A, and THROW_ASSERT.
Referenced by port_swapping_algorithm().
void port_swapping::vertex_levels | ( | const std::vector< PSE > & | spt_edges, |
PSVertex | root, | ||
size_t | num_vertices_g, | ||
std::vector< PSVSet > & | vset | ||
) |
This function calculates the levels of all te vertices starting from root.
spt_edges | edges of the spanning tree |
root | starting vertex |
num_vertices_g | number of vertices in the graph |
vset | structure that contains the vertices and the relative level and the belongings |
Definition at line 130 of file port_swapping.cpp.
References level, SET_A, and SET_B.
Referenced by port_swapping_algorithm().
|
private |
Definition at line 64 of file port_swapping.hpp.
|
private |
Definition at line 73 of file port_swapping.hpp.
|
private |
Definition at line 71 of file port_swapping.hpp.
|
private |
Definition at line 65 of file port_swapping.hpp.
Referenced by vertex_levels().
|
private |
Definition at line 72 of file port_swapping.hpp.
|
private |
Definition at line 70 of file port_swapping.hpp.