diff --git a/src/BambuParameter.cpp b/src/BambuParameter.cpp index d8b1df23d..2f969d8d7 100644 --- a/src/BambuParameter.cpp +++ b/src/BambuParameter.cpp @@ -334,8 +334,6 @@ void BambuParameter::PrintHelp(std::ostream& os) const << " The speculative SDC is more conservative, in case \n" << " --panda-parameter=enable-conservative-sdc=1 is passed.\n\n" #endif - << " --pipelining,-p\n" - << " Perform functional pipelining starting from the top function.\n\n" << " --pipelining,-p=[=][,[=]]*\n" << " Perform pipelining of comma separated list of specified functions with optional \n" << " initiation interval (default II=1).\n" diff --git a/src/HLS/binding/register/algorithms/chordal_coloring_register.cpp b/src/HLS/binding/register/algorithms/chordal_coloring_register.cpp index 598305778..2854d5da0 100644 --- a/src/HLS/binding/register/algorithms/chordal_coloring_register.cpp +++ b/src/HLS/binding/register/algorithms/chordal_coloring_register.cpp @@ -196,7 +196,7 @@ DesignFlowStep_Status chordal_coloring_register::RegisterBinding() const auto vEnd = support.end(); for(auto vIt = support.begin(); vIt != vEnd; ++vIt) { - const CustomOrderedSet& live = HLS->Rliv->get_live_in(*vIt); + const auto& live = HLS->Rliv->get_live_in(*vIt); auto k_end = live.end(); for(auto k = live.begin(); k != k_end; ++k) { diff --git a/src/HLS/binding/register/algorithms/conflict_based_register.cpp b/src/HLS/binding/register/algorithms/conflict_based_register.cpp index f0bda7a32..8db36bd61 100644 --- a/src/HLS/binding/register/algorithms/conflict_based_register.cpp +++ b/src/HLS/binding/register/algorithms/conflict_based_register.cpp @@ -82,9 +82,9 @@ void conflict_based_register::create_conflict_graph() const auto vEnd = support.end(); for(auto vIt = support.begin(); vIt != vEnd; ++vIt) { - const CustomOrderedSet& live = HLS->Rliv->get_live_in(*vIt); + const auto& live = HLS->Rliv->get_live_in(*vIt); register_lower_bound = std::max(static_cast(live.size()), register_lower_bound); - const CustomOrderedSet::const_iterator k_end = live.end(); + const auto k_end = live.end(); for(auto k = live.begin(); k != k_end; ++k) { auto k_inner = k; diff --git a/src/HLS/binding/register/algorithms/vertex_coloring_register.cpp b/src/HLS/binding/register/algorithms/vertex_coloring_register.cpp index bd2432089..045a813d4 100644 --- a/src/HLS/binding/register/algorithms/vertex_coloring_register.cpp +++ b/src/HLS/binding/register/algorithms/vertex_coloring_register.cpp @@ -85,7 +85,7 @@ DesignFlowStep_Status vertex_coloring_register::RegisterBinding() const auto vEnd = support.end(); for(auto vIt = support.begin(); vIt != vEnd; ++vIt) { - const CustomOrderedSet& live = HLS->Rliv->get_live_in(*vIt); + const auto& live = HLS->Rliv->get_live_in(*vIt); auto k_end = live.end(); for(auto k = live.begin(); k != k_end; ++k) { diff --git a/src/HLS/binding/register/algorithms/weighted_clique_register.cpp b/src/HLS/binding/register/algorithms/weighted_clique_register.cpp index 326f1de27..21af93eb7 100644 --- a/src/HLS/binding/register/algorithms/weighted_clique_register.cpp +++ b/src/HLS/binding/register/algorithms/weighted_clique_register.cpp @@ -130,11 +130,11 @@ DesignFlowStep_Status weighted_clique_register::RegisterBinding() { if(clique_covering_algorithm == CliqueCovering_Algorithm::BIPARTITE_MATCHING) { - const std::list& support = HLS->Rliv->get_support(); + const auto& support = HLS->Rliv->get_support(); unsigned current_partition = 0; for(auto vState : support) { - const CustomOrderedSet& live = HLS->Rliv->get_live_in(vState); + const auto& live = HLS->Rliv->get_live_in(vState); for(auto l : live) { unsigned int sv = HLS->storage_value_information->get_storage_value_index(vState, l); @@ -175,7 +175,7 @@ DesignFlowStep_Status weighted_clique_register::RegisterBinding() HLS->Rreg = reg_binding::create_reg_binding(HLS, HLSMgr); for(const auto v : HLS->Rliv->get_support()) { - for(const auto k : HLS->Rliv->get_live_in(v)) + for(const auto& k : HLS->Rliv->get_live_in(v)) { unsigned int storage_value_index = HLS->storage_value_information->get_storage_value_index(v, k); HLS->Rreg->bind(storage_value_index, v2c[verts[storage_value_index]]); @@ -207,6 +207,7 @@ DesignFlowStep_Status weighted_clique_register::RegisterBinding() (num_registers == register_lower_bound ? "" : ("(LB:" + STR(register_lower_bound) + ")"))); if(output_level >= OUTPUT_LEVEL_VERY_PEDANTIC) { + THROW_ASSERT(HLS->Rreg, "unexpected condition"); HLS->Rreg->print(); } if(output_level >= OUTPUT_LEVEL_MINIMUM && output_level <= OUTPUT_LEVEL_PEDANTIC) diff --git a/src/HLS/binding/register/reg_binding.cpp b/src/HLS/binding/register/reg_binding.cpp index c784112d2..b0f9b6780 100644 --- a/src/HLS/binding/register/reg_binding.cpp +++ b/src/HLS/binding/register/reg_binding.cpp @@ -190,7 +190,7 @@ void reg_binding::compute_is_without_enable() { const auto dummy_offset = HLS->Rliv->is_a_dummy_state(v) ? 1U : 0U; const auto& live_in = HLS->Rliv->get_live_in(v); - for(const auto li : live_in) + for(const auto& li : live_in) { if(n_in.find(li) == n_in.end()) { @@ -202,7 +202,7 @@ void reg_binding::compute_is_without_enable() } } const auto& live_out = HLS->Rliv->get_live_out(v); - for(const auto lo : live_out) + for(const auto& lo : live_out) { if(!n_out.count(lo)) { @@ -222,8 +222,8 @@ void reg_binding::compute_is_without_enable() for(auto i = 0U; i < get_used_regs(); i++) { const auto all_woe = [&]() { - const auto store_vars_set = get_vars(i); - for(const auto sv : store_vars_set) + const auto& store_vars_set = get_vars(i); + for(const auto& sv : store_vars_set) { if(n_in.find(sv) == n_in.end() || n_in.find(sv)->second != 1 || n_out.find(sv) == n_out.end() || n_out.find(sv)->second != 1) diff --git a/src/HLS/hls_manager.hpp b/src/HLS/hls_manager.hpp index a75c5c861..852635eed 100644 --- a/src/HLS/hls_manager.hpp +++ b/src/HLS/hls_manager.hpp @@ -35,6 +35,7 @@ * @brief Data structure representing the entire HLS information * * @author Christian Pilato + * @author Fabrizio Ferrandi * $Revision$ * $Date$ * Last modified by $Author$ diff --git a/src/HLS/module_allocation/allocation_information.cpp b/src/HLS/module_allocation/allocation_information.cpp index f2a6a7a18..01b857376 100644 --- a/src/HLS/module_allocation/allocation_information.cpp +++ b/src/HLS/module_allocation/allocation_information.cpp @@ -1681,7 +1681,7 @@ void AllocationInformation::GetNodeTypePrec(const vertex node, const OpGraphCons info->real_output_nelem = 0; info->base128_output_nelem = 0; } - if(current_op == "cond_expr" && max_size_in > 64 && info->node_kind == "VECTOR_BOOL") + if(current_op == "cond_expr" && max_size_in > 64) { max_size_in = 64; } diff --git a/src/HLS/virtual_components/commandport_obj.hpp b/src/HLS/virtual_components/commandport_obj.hpp index 4a83d18bb..d713ae631 100644 --- a/src/HLS/virtual_components/commandport_obj.hpp +++ b/src/HLS/virtual_components/commandport_obj.hpp @@ -77,8 +77,7 @@ class commandport_obj : public generic_obj SWITCH, /// switch value, it represents the value of the switch statement MULTIIF, /// represents the multi conditions SELECTOR, /// mux selector - ALUSELECTOR, /// ALU selector - UNBOUNDED, /// signal representing a communication for an unbounded object (function call) + UNBOUNDED, /// signal representing a communication for an unbounded object (function call) MULTI_UNBOUNDED, /// signal representing when a multi unbounded call ends MULTI_UNBOUNDED_ENABLE, /// signal enabling the multi unbounded component WRENABLE /// enable for register writing @@ -123,8 +122,7 @@ class commandport_obj : public generic_obj commandport_obj(generic_objRef _elem, unsigned int _mode, const std::string& _name) : generic_obj(COMMAND_PORT, _name), elem(_elem), mode(_mode), is_a_phi_write_enable(false) { - THROW_ASSERT(mode == SELECTOR || mode == WRENABLE || mode == ALUSELECTOR or mode == MULTI_UNBOUNDED or - mode == MULTI_UNBOUNDED_ENABLE, + THROW_ASSERT(mode == SELECTOR || mode == WRENABLE || mode == MULTI_UNBOUNDED or mode == MULTI_UNBOUNDED_ENABLE, "Selector port is wrong"); } @@ -183,8 +181,7 @@ class commandport_obj : public generic_obj const generic_objRef& get_elem() const { - THROW_ASSERT(mode == SELECTOR || mode == WRENABLE || mode == ALUSELECTOR || mode == MULTI_UNBOUNDED or - mode == MULTI_UNBOUNDED_ENABLE, + THROW_ASSERT(mode == SELECTOR || mode == WRENABLE || mode == MULTI_UNBOUNDED or mode == MULTI_UNBOUNDED_ENABLE, "Selector port is wrong"); return elem; } diff --git a/src/behavior/behavioral_writer_helper.cpp b/src/behavior/behavioral_writer_helper.cpp index 389691584..0c63b81d4 100644 --- a/src/behavior/behavioral_writer_helper.cpp +++ b/src/behavior/behavioral_writer_helper.cpp @@ -321,10 +321,6 @@ void OpEdgeWriter::operator()(std::ostream& out, const EdgeDescriptor& e) const { out << "[color=gold"; } - else if((FB_DFG_SELECTOR)&selector & printing_graph->GetSelector(e)) - { - out << "[color=lightblue"; - } else if((FLG_SELECTOR)&selector & printing_graph->GetSelector(e)) { out << "[color=red3"; diff --git a/src/design_flows/backend/ToC/source_code_writers/basic_blocks_profiling_c_writer.hpp b/src/design_flows/backend/ToC/source_code_writers/basic_blocks_profiling_c_writer.hpp index c92643408..51fc6d310 100644 --- a/src/design_flows/backend/ToC/source_code_writers/basic_blocks_profiling_c_writer.hpp +++ b/src/design_flows/backend/ToC/source_code_writers/basic_blocks_profiling_c_writer.hpp @@ -53,33 +53,33 @@ class BasicBlocksProfilingCWriter final : public EdgeCWriter * Dump operations requested for record information about a loop path which ends * @param e is the feedback or outgoing edge */ - void print_loop_ending(EdgeDescriptor e) override; + void print_loop_ending(EdgeDescriptor e) final; /** * Dump operations requested for record information about a path which exit from a loop * @param e is the feedback or outgoing edge */ - void print_loop_escaping(EdgeDescriptor e) override; + void print_loop_escaping(EdgeDescriptor e) final; /** * Dump initializations of variable for recording a loop path * @param e is the incoming edged */ - void print_loop_starting(EdgeDescriptor e) override; + void print_loop_starting(EdgeDescriptor e) final; /** * Dump operation requested for instrument an edges * @param e is the edge * @param index is the index of the variable to be incremented */ - void print_edge(EdgeDescriptor e, unsigned int index) override; + void print_edge(EdgeDescriptor e, unsigned int index) final; /** * Print operation requested for record information about a path which exit from a loop and immediately enter in * another * @param e is the edge */ - void print_loop_switching(EdgeDescriptor e) override; + void print_loop_switching(EdgeDescriptor e) final; void InternalWriteGlobalDeclarations() final; diff --git a/src/frontend_analysis/IR_analysis/loops_analysis_bambu.cpp b/src/frontend_analysis/IR_analysis/loops_analysis_bambu.cpp index fad1869dc..a7549ce9a 100644 --- a/src/frontend_analysis/IR_analysis/loops_analysis_bambu.cpp +++ b/src/frontend_analysis/IR_analysis/loops_analysis_bambu.cpp @@ -128,13 +128,16 @@ DesignFlowStep_Status LoopsAnalysisBambu::InternalExec() } #endif const auto nexit = loop->num_exits(); - if(nexit != 1) + if(nexit == 0) { - INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Multiple exits loop"); + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--No loop"); continue; } - INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Single exit loop considered"); - loop->loop_type |= SINGLE_EXIT_LOOP; + if(nexit == 1) + { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Single exit loop considered"); + loop->loop_type |= SINGLE_EXIT_LOOP; + } const auto exit_vertex = *loop->exit_block_iter_begin(); bool do_while = false; if(exit_vertex == header && loop->num_blocks() != 1) @@ -150,6 +153,12 @@ DesignFlowStep_Status LoopsAnalysisBambu::InternalExec() loop->loop_type |= DO_WHILE_LOOP; do_while = true; } + /// very simple condition + if(do_while && loop->is_innermost() && loop->num_blocks() == 1) + { + loop->loop_type |= PIPELINABLE_LOOP; + } + /// Get exit condition of the loop const tree_nodeRef last_stmt = GET_NODE(fbb->CGetBBNodeInfo(exit_vertex)->block->CGetStmtList().back()); if(last_stmt->get_kind() != gimple_cond_K) @@ -326,9 +335,9 @@ DesignFlowStep_Status LoopsAnalysisBambu::InternalExec() "---Comparison is " + STR(cond) + " (" + cond->get_kind_text() + ")"); if(GET_NODE(init)->get_kind() == integer_cst_K && GET_NODE(cond_be->op1)->get_kind() == integer_cst_K) { - const auto cond_type = cond_be->get_kind(); loop->lower_bound = tree_helper::GetConstValue(init); loop->upper_bound = tree_helper::GetConstValue(cond_be->op1); + const auto cond_type = cond_be->get_kind(); if(cond_type == ge_expr_K || cond_type == le_expr_K || cond_type == unge_expr_K || cond_type == unle_expr_K) { INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Close interval"); @@ -343,11 +352,6 @@ DesignFlowStep_Status LoopsAnalysisBambu::InternalExec() INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Bound " + GET_NODE(loop->upper_bound_tn)->ToString()); INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "---Increment " + GET_NODE(loop->increment_tn)->ToString()); - /// very simple condition - if(do_while && loop->is_innermost() && loop->num_blocks() == 1) - { - loop->loop_type |= PIPELINABLE_LOOP; - } return_value = DesignFlowStep_Status::SUCCESS; INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, "<--Analyzed loop " + STR(loop->GetId())); diff --git a/src/frontend_analysis/behavior_analysis/data_dependence_computation.cpp b/src/frontend_analysis/behavior_analysis/data_dependence_computation.cpp index 46fd88212..d9c2f228c 100644 --- a/src/frontend_analysis/behavior_analysis/data_dependence_computation.cpp +++ b/src/frontend_analysis/behavior_analysis/data_dependence_computation.cpp @@ -262,9 +262,12 @@ DesignFlowStep_Status DataDependenceComputation::Computedependencies(const int d function_behavior->ogc->add_edge_info(this_def, *vi, DFG_SELECTOR, local_use); if(function_behavior->CheckFeedbackReachability(*vi, this_def)) { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, + "---Adding fb_adg_selector dependence " + GET_NAME(cfg, *vi) + "-->" + + GET_NAME(cfg, this_def)); function_behavior->ogc->AddEdge(*vi, this_def, fb_adg_selector); /// NOTE: label associated with forward selector also on feedback edge - function_behavior->ogc->add_edge_info(this_def, *vi, ADG_SELECTOR, local_use); + function_behavior->ogc->add_edge_info(*vi, this_def, ADG_SELECTOR, local_use); } } @@ -275,19 +278,30 @@ DesignFlowStep_Status DataDependenceComputation::Computedependencies(const int d GET_NAME(cfg, *vi)); if(*vi != this_def) { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, + "---Adding adg_selector dependence " + GET_NAME(cfg, *vi) + "-->" + + GET_NAME(cfg, this_def)); function_behavior->ogc->AddEdge(*vi, this_def, adg_selector); function_behavior->ogc->add_edge_info(*vi, this_def, ADG_SELECTOR, local_use); } if(function_behavior->CheckFeedbackReachability(this_def, *vi)) { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, + "---Adding fb_dfg_selector dependence " + GET_NAME(cfg, this_def) + "-->" + + GET_NAME(cfg, *vi)); function_behavior->ogc->AddEdge(this_def, *vi, fb_dfg_selector); - /// NOTE: label associated with forward selector also on feedback edge + /// NOTE: label associated with forward selector also on feedback edgeADG_SELECTOR + /// (ADG_SCA_SELECTADG_SELECTOR (ADG_SCA_SELECTOR | ADG_AGG_SELECTOR) FeedOR | ADG_AGG_SELECTOR) + /// Feed function_behavior->ogc->add_edge_info(this_def, *vi, DFG_SELECTOR, local_use); } } if(*vi == this_def) { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, + "---Adding2 fb_dfg_selector dependence " + GET_NAME(cfg, *vi) + "-->" + + GET_NAME(cfg, *vi)); function_behavior->ogc->AddEdge(*vi, *vi, fb_dfg_selector); function_behavior->ogc->add_edge_info(*vi, *vi, DFG_SELECTOR, local_use); } @@ -301,7 +315,8 @@ DesignFlowStep_Status DataDependenceComputation::Computedependencies(const int d if(dependence) { INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, - "---Adding anti dependence " + GET_NAME(cfg, *vi) + "-->" + GET_NAME(cfg, this_over)); + "---Adding adg_selector dependence " + GET_NAME(cfg, *vi) + "-->" + + GET_NAME(cfg, this_over)); function_behavior->ogc->AddEdge(*vi, this_over, adg_selector); function_behavior->ogc->add_edge_info(*vi, this_over, ADG_SELECTOR, local_use); } @@ -322,10 +337,15 @@ DesignFlowStep_Status DataDependenceComputation::Computedependencies(const int d const bool forward_dependence = function_behavior->CheckReachability(this_def, *vi); if(forward_dependence) { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, + "---Adding output dependence " + GET_NAME(cfg, this_def) + "-->" + GET_NAME(cfg, *vi)); function_behavior->ogc->AddEdge(this_def, *vi, ODG_AGG_SELECTOR); function_behavior->ogc->add_edge_info(this_def, *vi, ODG_SELECTOR, local_def); if(function_behavior->CheckFeedbackReachability(*vi, this_def)) { + INDENT_DBG_MEX(DEBUG_LEVEL_VERY_PEDANTIC, debug_level, + "---Adding FB_ODG_AGG_SELECTOR dependence " + GET_NAME(cfg, *vi) + "-->" + + GET_NAME(cfg, this_def)); function_behavior->ogc->AddEdge(*vi, this_def, FB_ODG_AGG_SELECTOR); /// NOTE: label associated with forward selector also on feedback edge function_behavior->ogc->add_edge_info(*vi, this_def, ODG_SELECTOR, local_def); diff --git a/src/utility/utility.hpp b/src/utility/utility.hpp index ca56cc2b7..e940bfecc 100644 --- a/src/utility/utility.hpp +++ b/src/utility/utility.hpp @@ -157,7 +157,7 @@ constexpr void string_to_container(_OutputIt first, const std::string& str, cons } last += _len + 1; curr += _len + 1; - } while(last < str.size()); + } while(last <= str.size()); } template