PandA-2024.02
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
cdfc_module_binding Class Reference

Class managing the module allocation. More...

#include <cdfc_module_binding.hpp>

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

Public Member Functions

 cdfc_module_binding (const ParameterConstRef _parameters, const HLS_managerRef HLSMgr, unsigned int funId, const DesignFlowManagerConstRef design_flow_manager, const HLSFlowStepSpecializationConstRef hls_flow_step_specialization)
 This is the constructor of the class. More...
 
 ~cdfc_module_binding () override
 Destructor. More...
 
DesignFlowStep_Status InternalExec () override
 Execute the step. More...
 
- Public Member Functions inherited from fu_binding_creator
 fu_binding_creator (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...
 
 ~fu_binding_creator () override
 Destructor. More...
 
void Initialize () override
 Initialize the step (i.e., like a constructor, but executed just before exec. 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

bool false_loop_search (cdfc_vertex start, unsigned k, const cdfc_graphConstRef &cdfc, const cdfc_graphConstRef &cg, std::deque< cdfc_edge > &candidate_edges)
 
bool false_loop_search_cdfc_1 (cdfc_vertex src, unsigned int level, unsigned k, cdfc_vertex start, const cdfc_graphConstRef &cdfc, const cdfc_graphConstRef &cg, std::deque< cdfc_edge > &candidate_edges, std::vector< bool > &visited, std::vector< bool > &cg_visited, std::vector< bool > &cdfc_visited)
 
bool false_loop_search_cdfc_more (cdfc_vertex src, unsigned int level, unsigned k, cdfc_vertex start, const cdfc_graphConstRef &cdfc, const cdfc_graphConstRef &cg, std::deque< cdfc_edge > &candidate_edges, std::vector< bool > &visited, std::vector< bool > &cg_visited, std::vector< bool > &cdfc_visited)
 
bool can_be_clustered (vertex v, OpGraphConstRef fsdg, const fu_bindingConstRef fu, const CustomUnorderedMap< vertex, double > &slack_time, const double mux_time)
 
int weight_computation (bool cond1, bool cond2, vertex v1, vertex v2, const double mux_time, const OpGraphConstRef fdfg, const fu_bindingConstRef fu, const CustomUnorderedMap< vertex, double > &slack_time, CustomUnorderedMap< vertex, double > &starting_time, connection_relation &con_rel, double controller_delay, unsigned long long prec)
 
void update_slack_starting_time (const OpGraphConstRef fdfg, OpVertexSet &sorted_vertices, CustomUnorderedMap< vertex, double > &slack_time, CustomUnorderedMap< vertex, double > &starting_time, bool update_starting_time, bool only_backward, bool only_forward)
 
void initialize_connection_relation (connection_relation &con_rel, const OpVertexSet &all_candidate_vertices)
 
- Protected Member Functions inherited from fu_binding_creator
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...
 

Protected Attributes

const double small_normalized_resource_area
 Threshold used in sharing of functional units. More...
 
CustomUnorderedMap< vertex, boolcan_be_clustered_table
 record if a vertex has to be clustered or not More...
 
CustomUnorderedMapUnstable< std::pair< vertex, unsigned int >, boolis_complex
 
- 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

static const int CD_EDGE = 1
 
static const int COMPATIBILITY_EDGE = 2
 
- Static Protected Attributes inherited from HLS_step
static CustomUnorderedMap< std::string, HLSFlowStep_Typecommand_line_name_to_enum
 Map hls step name to enum. More...
 

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

Detailed Description

Class managing the module allocation.

Definition at line 378 of file cdfc_module_binding.hpp.

Constructor & Destructor Documentation

◆ cdfc_module_binding()

cdfc_module_binding::cdfc_module_binding ( const ParameterConstRef  _parameters,
const HLS_managerRef  HLSMgr,
unsigned int  funId,
const DesignFlowManagerConstRef  design_flow_manager,
const HLSFlowStepSpecializationConstRef  hls_flow_step_specialization 
)

This is the constructor of the class.

Definition at line 793 of file cdfc_module_binding.cpp.

References DesignFlowStep::debug_level, GET_CLASS, and ~cdfc_module_binding().

Here is the call graph for this function:

◆ ~cdfc_module_binding()

cdfc_module_binding::~cdfc_module_binding ( )
overridedefault

Destructor.

Referenced by cdfc_module_binding().

Here is the caller graph for this function:

Member Function Documentation

◆ can_be_clustered()

bool cdfc_module_binding::can_be_clustered ( vertex  v,
OpGraphConstRef  fsdg,
const fu_bindingConstRef  fu,
const CustomUnorderedMap< vertex, double > &  slack_time,
const double  mux_time 
)
protected

◆ false_loop_search()

bool cdfc_module_binding::false_loop_search ( cdfc_vertex  start,
unsigned  k,
const cdfc_graphConstRef cdfc,
const cdfc_graphConstRef cg,
std::deque< cdfc_edge > &  candidate_edges 
)
protected

Definition at line 2437 of file cdfc_module_binding.cpp.

References false_loop_search_cdfc_1(), and lenet_tvm::target.

Referenced by InternalExec().

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

◆ false_loop_search_cdfc_1()

bool cdfc_module_binding::false_loop_search_cdfc_1 ( cdfc_vertex  src,
unsigned int  level,
unsigned  k,
cdfc_vertex  start,
const cdfc_graphConstRef cdfc,
const cdfc_graphConstRef cg,
std::deque< cdfc_edge > &  candidate_edges,
std::vector< bool > &  visited,
std::vector< bool > &  cg_visited,
std::vector< bool > &  cdfc_visited 
)
protected

Definition at line 2459 of file cdfc_module_binding.cpp.

References false_loop_search_cdfc_more(), and lenet_tvm::target.

Referenced by false_loop_search(), and false_loop_search_cdfc_more().

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

◆ false_loop_search_cdfc_more()

bool cdfc_module_binding::false_loop_search_cdfc_more ( cdfc_vertex  src,
unsigned int  level,
unsigned  k,
cdfc_vertex  start,
const cdfc_graphConstRef cdfc,
const cdfc_graphConstRef cg,
std::deque< cdfc_edge > &  candidate_edges,
std::vector< bool > &  visited,
std::vector< bool > &  cg_visited,
std::vector< bool > &  cdfc_visited 
)
protected

Definition at line 2494 of file cdfc_module_binding.cpp.

References COMPATIBILITY_EDGE, false_loop_search_cdfc_1(), and lenet_tvm::target.

Referenced by false_loop_search_cdfc_1().

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

◆ initialize_connection_relation()

void cdfc_module_binding::initialize_connection_relation ( connection_relation con_rel,
const OpVertexSet all_candidate_vertices 
)
protected

◆ InternalExec()

DesignFlowStep_Status cdfc_module_binding::InternalExec ( )
overridevirtual

Execute the step.

Returns
the exit status of this step

compute non-shared resources

check easy binding and compute the list of vertices for which a sharing is possible

in case no vertices was left we have done

check for PHIs attached to the ouput. They may require one or more muxes.

rank property map definition

parent property map definition

merge easy bound vertices

add the vertices to the cdfc graph

add the control dependencies edges and the chained edges to the cdfc graph

only the chained operations are relevant

pipelined operations break false loops

add compatibility edge with computed weight on both the directions

compute levels

topologically sort vertex of CD_EDGE based graph

remove all cycles from the cdfc graph

remove the loop

remove both the compatibility edges

search another loop

partition vertices for clique covering or bind the easy functional units

check easy binding

solve the binding problem for all the partitions

build the clique covering solver

add vertex to the clique covering solver

add the edges

only one edge is needed to build the undirected compatibility graph

Specify the minimum number of resources in case we have to use all the memory ports. That is relevant for memories attached to the bus Private memories should use the minimum number of ports to minimize the total area.

performing clique covering

only one edge is needed to build the undirected compatibility graph

Specify the minimum number of resources in case we have to use all the memory ports. That is relevant for memories attached to the bus Private memories should use the minimum number of ports to minimize the total area.

retrieve the solution

compute maximum starting time

storing new binding results

Implements HLSFunctionStep.

Definition at line 932 of file cdfc_module_binding.cpp.

References abs, hls::allocation_information, liveness::are_in_conflict(), fu_binding::bind(), BIPARTITE_MATCHING, C, can_be_clustered(), CD_EDGE, FunctionBehavior::CGetBehavioralHelper(), OpGraph::CGetOperations(), FunctionBehavior::CGetOpGraph(), OpGraph::CGetOpNodeInfo(), hls::chaining_information, CLOCK_MARGIN, COMPATIBILITY_EDGE, compute_condition1(), compute_condition2(), AllocationInformation::compute_normalized_area(), fu_binding::create_fu_binding(), clique_covering< VertexType >::create_solver(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERBOSE, DEBUG_LEVEL_VERY_PEDANTIC, delay(), DesignFlowStep::design_flow_manager, FunctionBehavior::DFG, DFG_SCA_SELECTOR, edges, AllocationInformation::estimate_mux_area(), AllocationInformation::estimate_mux_time(), AllocationInformation::EstimateControllerDelay(), false_loop_search(), FunctionBehavior::FDFG, from_strongtype_cast(), FunctionBehavior::FSDG, hls::functionId, HLSFunctionStep::funId, AllocationInformation::get_area(), fu_binding::get_assign(), Schedule::get_cstep(), Schedule::get_cstep_end(), AllocationInformation::get_cycles(), AllocationInformation::get_DSPs(), Schedule::get_fo_correction(), AllocationInformation::get_fu_name(), BehavioralHelper::get_function_name(), fu_binding::get_index(), AllocationInformation::get_initiation_time(), AllocationInformation::get_memory_var(), GET_NAME, AllocationInformation::get_number_channels(), AllocationInformation::get_number_fu(), AllocationInformation::get_prec(), AllocationInformation::get_proxy_memory_var(), ChainingInformation::get_representative_in(), AllocationInformation::get_setup_hold_time(), liveness::get_state_where_run(), AllocationInformation::get_string_name(), tree_manager::get_tree_node_const(), GET_TYPE, Schedule::GetEndingTime(), graph::GetSelector(), Schedule::GetStartingTime(), HLSFunctionStep::HLS, hls::HLS_C, hls::HLS_D, HLS_step::hls_flow_step_specialization, HLS_step::HLSMgr, INDENT_DBG_MEX, INDENT_OUT_MEX, index, INFINITE_UINT, initialize_connection_relation(), AllocationInformation::is_direct_access_memory_unit(), AllocationInformation::is_memory_unit(), AllocationInformation::is_one_cycle_direct_access_memory_unit(), AllocationInformation::is_proxy_unit(), AllocationInformation::is_readonly_memory_unit(), AllocationInformation::is_vertex_bounded(), k, Wrefcount< T >::lock(), max, ChainingInformation::may_be_chained_ops(), min, MODULE_BINDING_MUX_MARGIN, NULL_VERTEX, OP_THRESHOLD, DesignFlowStep::output_level, OUTPUT_LEVEL_MINIMUM, OUTPUT_LEVEL_PEDANTIC, OUTPUT_LEVEL_VERBOSE, OUTPUT_LEVEL_VERY_PEDANTIC, DesignFlowStep::parameters, print_cpu_time(), PRINT_DBG_MEX, PROXY_LIBRARY, test_panda::restart, hls::Rfu, hls::Rliv, hls::Rsch, FunctionBehavior::SDG, liveness::set_HLS(), small_normalized_resource_area, START_TIME, STOP_TIME, STR, SUCCESS, lenet_tvm::target, THROW_ASSERT, THROW_ERROR, topological_based_sorting(), graph::TopologicalSort(), tree_node::ToString(), TYPE_ENTRY, TYPE_EXIT, TYPE_GOTO, TYPE_LABEL, TYPE_PHI, TYPE_RET, TYPE_SWITCH, TYPE_VPHI, update_slack_starting_time(), weight_computation(), WEIGHTED_CLIQUE_REGISTER_BINDING, WEIGHTED_COLORING, and WORK_LIBRARY.

Here is the call graph for this function:

◆ update_slack_starting_time()

void cdfc_module_binding::update_slack_starting_time ( const OpGraphConstRef  fdfg,
OpVertexSet sorted_vertices,
CustomUnorderedMap< vertex, double > &  slack_time,
CustomUnorderedMap< vertex, double > &  starting_time,
bool  update_starting_time,
bool  only_backward,
bool  only_forward 
)
protected

◆ weight_computation()

int cdfc_module_binding::weight_computation ( bool  cond1,
bool  cond2,
vertex  v1,
vertex  v2,
const double  mux_time,
const OpGraphConstRef  fdfg,
const fu_bindingConstRef  fu,
const CustomUnorderedMap< vertex, double > &  slack_time,
CustomUnorderedMap< vertex, double > &  starting_time,
connection_relation con_rel,
double  controller_delay,
unsigned long long  prec 
)
protected

Definition at line 2632 of file cdfc_module_binding.cpp.

References can_be_clustered(), OpGraph::CGetOpNodeInfo(), DesignFlowStep::debug_level, DEBUG_LEVEL_VERY_PEDANTIC, GET_NAME, HLSFunctionStep::HLS, HLS_step::HLSMgr, INDENT_DBG_MEX, max, and STR.

Referenced by InternalExec().

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

Field Documentation

◆ can_be_clustered_table

CustomUnorderedMap<vertex, bool> cdfc_module_binding::can_be_clustered_table
protected

record if a vertex has to be clustered or not

Definition at line 417 of file cdfc_module_binding.hpp.

Referenced by can_be_clustered().

◆ CD_EDGE

const int cdfc_module_binding::CD_EDGE = 1
staticprotected

Definition at line 413 of file cdfc_module_binding.hpp.

Referenced by InternalExec().

◆ COMPATIBILITY_EDGE

const int cdfc_module_binding::COMPATIBILITY_EDGE = 2
staticprotected

Definition at line 414 of file cdfc_module_binding.hpp.

Referenced by false_loop_search_cdfc_more(), and InternalExec().

◆ is_complex

CustomUnorderedMapUnstable<std::pair<vertex, unsigned int>, bool> cdfc_module_binding::is_complex
protected

Definition at line 418 of file cdfc_module_binding.hpp.

◆ small_normalized_resource_area

const double cdfc_module_binding::small_normalized_resource_area
protected

Threshold used in sharing of functional units.

Definition at line 382 of file cdfc_module_binding.hpp.

Referenced by compute_condition2(), and InternalExec().


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

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