diff --git a/vpr/src/noc/noc_traffic_flows.cpp b/vpr/src/noc/noc_traffic_flows.cpp index 9d80f4c692f..795a0316cb6 100644 --- a/vpr/src/noc/noc_traffic_flows.cpp +++ b/vpr/src/noc/noc_traffic_flows.cpp @@ -9,7 +9,7 @@ NocTrafficFlows::NocTrafficFlows() { // getters for the traffic flows -int NocTrafficFlows::get_number_of_traffic_flows(void) const { +int NocTrafficFlows::get_number_of_traffic_flows() const { return noc_traffic_flows.size(); } @@ -33,7 +33,7 @@ const std::vector& NocTrafficFlows::get_traffic_flows_associat } } -int NocTrafficFlows::get_number_of_routers_used_in_traffic_flows(void) { +int NocTrafficFlows::get_number_of_routers_used_in_traffic_flows() { return traffic_flows_associated_to_router_blocks.size(); } @@ -49,11 +49,11 @@ const vtr::vector>& NocTrafficFlows::ge return traffic_flow_routes; } -const std::vector& NocTrafficFlows::get_router_clusters_in_netlist(void) const { +const std::vector& NocTrafficFlows::get_router_clusters_in_netlist() const { return router_cluster_in_netlist; } -const std::vector& NocTrafficFlows::get_all_traffic_flow_id(void) const { +const std::vector& NocTrafficFlows::get_all_traffic_flow_id() const { return noc_traffic_flows_ids; } @@ -84,8 +84,6 @@ void NocTrafficFlows::create_noc_traffic_flow(const std::string& source_router_m // now add the new traffic flow to flows associated with the current source and sink router add_traffic_flow_to_associated_routers(curr_traffic_flow_id, source_router_cluster_id); add_traffic_flow_to_associated_routers(curr_traffic_flow_id, sink_router_cluster_id); - - return; } void NocTrafficFlows::set_router_cluster_in_netlist(const std::vector& routers_cluster_id_in_netlist) { @@ -98,18 +96,16 @@ void NocTrafficFlows::set_router_cluster_in_netlist(const std::vectorsecond.emplace_back(traffic_flow_id); } - - return; } void NocTrafficFlows::echo_noc_traffic_flows(char* file_name) { @@ -208,6 +200,4 @@ void NocTrafficFlows::echo_noc_traffic_flows(char* file_name) { } vtr::fclose(fp); - - return; } \ No newline at end of file diff --git a/vpr/src/noc/noc_traffic_flows.h b/vpr/src/noc/noc_traffic_flows.h index dac054d4bef..7db9041a05d 100644 --- a/vpr/src/noc/noc_traffic_flows.h +++ b/vpr/src/noc/noc_traffic_flows.h @@ -154,7 +154,7 @@ class NocTrafficFlows { * @return int An integer that represents the number of unique traffic * flows within the NoC. */ - int get_number_of_traffic_flows(void) const; + int get_number_of_traffic_flows() const; /** * @brief Given a unique id of a traffic flow (t_noc_traffic_flow) @@ -192,7 +192,7 @@ class NocTrafficFlows { * @return int The total number of unique routers used in * the traffic flows provided by the user. */ - int get_number_of_routers_used_in_traffic_flows(void); + int get_number_of_routers_used_in_traffic_flows(); /** * @brief Gets the routed path of traffic flow. This cannot be @@ -229,13 +229,13 @@ class NocTrafficFlows { * @return a vector ([0..num_logical_router-1]) where each entry gives the clusterBlockId * of a logical NoC router. Used for fast lookups in the placer. */ - const std::vector& get_router_clusters_in_netlist(void) const; + const std::vector& get_router_clusters_in_netlist() const; /** * @return provides access to all traffic flows' ids to allow a range-based * loop through all traffic flows, used in noc_place_utils.cpp functions. */ - const std::vector& get_all_traffic_flow_id(void) const; + const std::vector& get_all_traffic_flow_id() const; // setters @@ -294,14 +294,14 @@ class NocTrafficFlows { * */ - void finished_noc_traffic_flows_setup(void); + void finished_noc_traffic_flows_setup(); /** * @brief Resets the class by clearing internal * datastructures. * */ - void clear_traffic_flows(void); + void clear_traffic_flows(); /** * @brief Given a block from the clustered netlist, determine @@ -331,6 +331,20 @@ class NocTrafficFlows { * traffic flow information */ void echo_noc_traffic_flows(char* file_name); + + + /** + * @brief Defines the latency constraint of a traffic flow + * when not provided by the user. + * + * This value has to be significantly larger than latencies + * seen within the NoC so that the net effect in the placement + * cost is 0 (the latency constraint has no effect since there is none). + * Since the traffic flow latencies will be in nanoseconds, + * setting this value to 1 second which is significantly larger + * than what will be seen in the NoC. + */ + static constexpr double DEFAULT_MAX_TRAFFIC_FLOW_LATENCY = 1.; }; #endif \ No newline at end of file diff --git a/vpr/src/noc/read_xml_noc_traffic_flows_file.cpp b/vpr/src/noc/read_xml_noc_traffic_flows_file.cpp index 07bd53be7ce..3f12c02ed2d 100644 --- a/vpr/src/noc/read_xml_noc_traffic_flows_file.cpp +++ b/vpr/src/noc/read_xml_noc_traffic_flows_file.cpp @@ -3,7 +3,7 @@ void read_xml_noc_traffic_flows_file(const char* noc_flows_file) { // start by checking that the provided file is a ".flows" file - if (vtr::check_file_name_extension(noc_flows_file, ".flows") == false) { + if (!vtr::check_file_name_extension(noc_flows_file, ".flows")) { VPR_FATAL_ERROR(VPR_ERROR_OTHER, "NoC traffic flows file '%s' has an unknown extension. Expecting .flows for NoC traffic flow files.", noc_flows_file); } @@ -72,8 +72,6 @@ void read_xml_noc_traffic_flows_file(const char* noc_flows_file) { if (getEchoEnabled() && isEchoFileEnabled(E_ECHO_NOC_TRAFFIC_FLOWS)) { noc_ctx.noc_traffic_flows_storage.echo_noc_traffic_flows(getEchoFileName(E_ECHO_NOC_TRAFFIC_FLOWS)); } - - return; } void process_single_flow(pugi::xml_node single_flow_tag, @@ -125,8 +123,6 @@ void process_single_flow(pugi::xml_node single_flow_tag, traffic_flow_bandwidth, max_traffic_flow_latency, traffic_flow_priority); - - return; } double get_traffic_flow_bandwidth(pugi::xml_node single_flow_tag, const pugiutil::loc_data& loc_data) { @@ -144,7 +140,7 @@ double get_traffic_flow_bandwidth(pugi::xml_node single_flow_tag, const pugiutil double get_max_traffic_flow_latency(pugi::xml_node single_flow_tag, const pugiutil::loc_data& loc_data) { // "set to large value, indicating no constraint - double max_traffic_flow_latency = DEFAULT_MAX_TRAFFIC_FLOW_LATENCY; + double max_traffic_flow_latency = NocTrafficFlows::DEFAULT_MAX_TRAFFIC_FLOW_LATENCY; // holds the latency value as a string so that it can be used to convert to a floating point value (this is done so that scientific notation is supported) std::string max_traffic_flow_latency_intermediate_val; @@ -194,8 +190,6 @@ void verify_traffic_flow_router_modules(const std::string& source_router_name, c // Cannot have the source and sink routers have the same name (they need to be different). A flow cant go to a single router. vpr_throw(VPR_ERROR_OTHER, loc_data.filename_c_str(), loc_data.line(single_flow_tag), "Source and sink NoC routers cannot be the same modules."); } - - return; } void verify_traffic_flow_properties(double traffic_flow_bandwidth, double max_traffic_flow_latency, int traffic_flow_priority, pugi::xml_node single_flow_tag, const pugiutil::loc_data& loc_data) { @@ -213,8 +207,6 @@ void verify_traffic_flow_properties(double traffic_flow_bandwidth, double max_tr if (traffic_flow_priority <= 0) { vpr_throw(VPR_ERROR_OTHER, loc_data.filename_c_str(), loc_data.line(single_flow_tag), "The traffic flow priorities expected to be positive, non-zero integer values."); } - - return; } ClusterBlockId get_router_module_cluster_id(const std::string& router_module_name, @@ -254,8 +246,6 @@ void check_traffic_flow_router_module_type(const std::string& router_module_name if (!is_tile_compatible(noc_router_tile_type, router_module_logical_type)) { vpr_throw(VPR_ERROR_OTHER, loc_data.filename_c_str(), loc_data.line(single_flow_tag), "The supplied module name '%s' is not a NoC router.", router_module_name.c_str()); } - - return; } t_physical_tile_type_ptr get_physical_type_of_noc_router_tile(const DeviceContext& device_ctx, NocContext& noc_ctx) { diff --git a/vpr/src/noc/read_xml_noc_traffic_flows_file.h b/vpr/src/noc/read_xml_noc_traffic_flows_file.h index 55cecc38bc1..7abd685d82e 100644 --- a/vpr/src/noc/read_xml_noc_traffic_flows_file.h +++ b/vpr/src/noc/read_xml_noc_traffic_flows_file.h @@ -39,11 +39,6 @@ // identifier when an integer conversion failed while reading an attribute value in an xml file constexpr int NUMERICAL_ATTRIBUTE_CONVERSION_FAILURE = -1; -// defines the latency constraint of a traffic flow when not provided by the user -// This value has to be significantly larger than latencies seen within the NoC so that the net effect in the placement cost is 0 (the latency constraint has no effect since there is none) -// Since the traffic flow latencies will be in nanoseconds, setting this value to 1 second which is significantly larger that what will be seen in the NoC -constexpr double DEFAULT_MAX_TRAFFIC_FLOW_LATENCY = 1.; - // defines the priority of a traffic flow when not specified by a user constexpr int DEFAULT_TRAFFIC_FLOW_PRIORITY = 1; diff --git a/vpr/src/noc/sat_routing.cpp b/vpr/src/noc/sat_routing.cpp index fe8d1ae093a..dad1fe22251 100644 --- a/vpr/src/noc/sat_routing.cpp +++ b/vpr/src/noc/sat_routing.cpp @@ -482,7 +482,7 @@ static void create_flow_link_vars(orsat::CpModelBuilder& cp_model, const auto& traffic_flow = traffic_flow_storage.get_single_noc_traffic_flow(traffic_flow_id); // create an integer variable for each latency-constrained traffic flow - if (traffic_flow.max_traffic_flow_latency < 0.1) { + if (traffic_flow.max_traffic_flow_latency < NocTrafficFlows::DEFAULT_MAX_TRAFFIC_FLOW_LATENCY) { latency_overrun_vars[traffic_flow_id] = cp_model.NewIntVar(latency_overrun_domain); } @@ -530,7 +530,7 @@ static int comp_max_number_of_traversed_links(NocTrafficFlowId traffic_flow_id) const double traffic_flow_latency_constraint = traffic_flow.max_traffic_flow_latency; - VTR_ASSERT(traffic_flow_latency_constraint < 0.1); + VTR_ASSERT(traffic_flow_latency_constraint < NocTrafficFlows::DEFAULT_MAX_TRAFFIC_FLOW_LATENCY); int n_max_links = std::floor((traffic_flow_latency_constraint - noc_router_latency) / (noc_link_latency + noc_router_latency));