PandA-2024.02
Public Member Functions | Protected Member Functions | Private Types | Private Attributes
port_swapping Class Reference

superclass include More...

#include <port_swapping.hpp>

Inheritance diagram for port_swapping:
Inheritance graph
[legend]
Collaboration diagram for port_swapping:
Collaboration graph
[legend]

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< PSEspt_vector_edges
 
std::vector< PSEco_tree_vector_edges
 
std::vector< PSEodd_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 DesignFlowManagerdesign_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_Typecommand_line_name_to_enum
 Map hls step name to enum. More...
 

Detailed Description

superclass include

Class managing a partial module binding based on simple conditions

Definition at line 53 of file port_swapping.hpp.

Member Typedef Documentation

◆ PSE

using port_swapping::PSE = std::pair<unsigned int, unsigned int>
private

Definition at line 60 of file port_swapping.hpp.

◆ PSEdge

using port_swapping::PSEdge = boost::graph_traits<PSGraph>::edge_descriptor
private

Definition at line 58 of file port_swapping.hpp.

◆ PSGraph

using port_swapping::PSGraph = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, boost::no_property, boost::property<boost::edge_color_t, boost::default_color_type> >
private

Definition at line 57 of file port_swapping.hpp.

◆ PSMultiStart

using port_swapping::PSMultiStart = struct { std::vector<PSVSet> vset
private

Definition at line 69 of file port_swapping.hpp.

◆ PSVertex

using port_swapping::PSVertex = boost::graph_traits<PSGraph>::vertex_descriptor
private

Definition at line 59 of file port_swapping.hpp.

◆ PSVSet

using port_swapping::PSVSet = struct { PSVertex v
private

Definition at line 63 of file port_swapping.hpp.

Constructor & Destructor Documentation

◆ port_swapping()

port_swapping::port_swapping ( const ParameterConstRef  Param,
const HLS_managerRef  HLSMgr,
unsigned int  funId,
const DesignFlowManagerConstRef  design_flow_manager 
)

Constructor.

Parameters
design_flow_manageris the design flow manager

Definition at line 70 of file port_swapping.cpp.

References DesignFlowStep::debug_level, GET_CLASS, PORT_SWAPPING, and ~port_swapping().

Here is the call graph for this function:

◆ ~port_swapping()

port_swapping::~port_swapping ( )
overridedefault

Destructor.

Referenced by port_swapping().

Here is the caller graph for this function:

Member Function Documentation

◆ ComputeHLSRelationships()

const CustomUnorderedSet< std::tuple< HLSFlowStep_Type, HLSFlowStepSpecializationConstRef, HLSFlowStep_Relationship > > port_swapping::ComputeHLSRelationships ( const DesignFlowStep::RelationshipType  relationship_type) const
overrideprotectedvirtual

Compute the relationship of this step.

Parameters
relationship_typeis the type of relationship to be considered
Returns
the steps in relationship with this

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.

◆ find_max_degree()

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.

Parameters
dSetstructure with all the vertices and relative degrees
Returns
Vertex which has the max degree

Definition at line 242 of file port_swapping.cpp.

References max.

Referenced by port_swapping_algorithm().

Here is the caller graph for this function:

◆ get_co_tree_vertex()

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.

Parameters
vertex
edgesvector of edges from which is taken the right one and from that the right vertex
Returns
chosen vertex

Definition at line 266 of file port_swapping.cpp.

Referenced by port_swapping_algorithm().

Here is the caller graph for this function:

◆ get_results()

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.

Parameters
operandwhich represents a vertex in the graph
resultsvector containing all the vertices and relative belonging sets
Returns
belonging set of the operand

Definition at line 479 of file port_swapping.cpp.

Referenced by InternalExec().

Here is the caller graph for this function:

◆ InternalExec()

DesignFlowStep_Status port_swapping::InternalExec ( )
overridevirtual

◆ is_commutative_op()

bool port_swapping::is_commutative_op ( const std::string &  operation)

This function checks if an operation is commutative or not.

Parameters
operationname
Returns
true if it is a commutative binary operation, false otherwise

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

Here is the caller graph for this function:

◆ p_swap()

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.

Parameters
gstarting graph
Returns
vector of vertices and relative results. Each vertex will contain the belonging set (A, B, AB)

Definition at line 443 of file port_swapping.cpp.

References max, and port_swapping_algorithm().

Referenced by InternalExec().

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

◆ port_swapping_algorithm()

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.

Parameters
ggraph on which the algorithm is computed
vector_setsvector that will contain all the runs of the algorithm. It will contain the best solution
num_vertices_gnumber of vertices in the graph
rootvertex 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().

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

◆ update_degree()

void port_swapping::update_degree ( PSGraph  g2,
CustomOrderedSet< std::pair< PSVertex, unsigned int >> &  dSet 
)

This function updates the degree of all the vertices.

Parameters
g2graph on which the degree of the vertices must be calculated
dSetset to be updated with all the vertices and relative degree

Definition at line 257 of file port_swapping.cpp.

Referenced by port_swapping_algorithm().

Here is the caller graph for this function:

◆ vertex_distance()

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.

Parameters
spt_edgesedges of the spanning tree
rootstarting vertex
num_vertices_gnumber of vertices in the graph
vsetstructure 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().

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

◆ vertex_levels()

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.

Parameters
spt_edgesedges of the spanning tree
rootstarting vertex
num_vertices_gnumber of vertices in the graph
vsetstructure 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().

Here is the caller graph for this function:

Field Documentation

◆ belongs

int port_swapping::belongs
private

Definition at line 64 of file port_swapping.hpp.

◆ cardinality

long unsigned int port_swapping::cardinality
private

Definition at line 73 of file port_swapping.hpp.

◆ co_tree_vector_edges

std::vector<PSE> port_swapping::co_tree_vector_edges
private

Definition at line 71 of file port_swapping.hpp.

◆ level

int port_swapping::level
private

Definition at line 65 of file port_swapping.hpp.

Referenced by vertex_levels().

◆ odd_co_tree_vector_edges

std::vector<PSE> port_swapping::odd_co_tree_vector_edges
private

Definition at line 72 of file port_swapping.hpp.

◆ spt_vector_edges

std::vector<PSE> port_swapping::spt_vector_edges
private

Definition at line 70 of file port_swapping.hpp.


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

Generated on Mon Feb 12 2024 13:04:00 for PandA-2024.02 by doxygen 1.8.13