From fa97eef5b04f21ea65a4786f7c45c1768fcc20c4 Mon Sep 17 00:00:00 2001 From: soheilshahrouz Date: Sun, 3 Mar 2024 15:26:46 -0500 Subject: [PATCH] fix noc unit test compilation erros --- vpr/src/noc/noc_routing.h | 8 +- vpr/test/test_bfs_routing.cpp | 22 +-- vpr/test/test_noc_place_utils.cpp | 232 +++++++++++++++++----------- vpr/test/test_noc_storage.cpp | 2 +- vpr/test/test_noc_traffic_flows.cpp | 8 +- vpr/test/test_xy_routing.cpp | 76 +++++---- 6 files changed, 207 insertions(+), 141 deletions(-) diff --git a/vpr/src/noc/noc_routing.h b/vpr/src/noc/noc_routing.h index fa2152b888c..3f9af36e7b9 100644 --- a/vpr/src/noc/noc_routing.h +++ b/vpr/src/noc/noc_routing.h @@ -30,7 +30,7 @@ class NocRouting { // pure virtual functions that should be implemented in derived classes. public: - virtual ~NocRouting() {} + virtual ~NocRouting() = default; /** * @brief Finds a route that goes from the starting router in a @@ -57,7 +57,11 @@ class NocRouting { * @param noc_model A model of the NoC. This is used to traverse the * NoC and find a route between the two routers. */ - virtual void route_flow(NocRouterId src_router_id, NocRouterId sink_router_id, NocTrafficFlowId traffic_flow_id, std::vector& flow_route, const NocStorage& noc_model) = 0; + virtual void route_flow(NocRouterId src_router_id, + NocRouterId sink_router_id, + NocTrafficFlowId traffic_flow_id, + std::vector& flow_route, + const NocStorage& noc_model) = 0; }; #endif diff --git a/vpr/test/test_bfs_routing.cpp b/vpr/test/test_bfs_routing.cpp index 21d96d75d48..92afda2798c 100644 --- a/vpr/test/test_bfs_routing.cpp +++ b/vpr/test/test_bfs_routing.cpp @@ -62,23 +62,25 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") { SECTION("Test case where the destination router and the starting routers are the same") { // choosing the start eand end routers as router 10 - NocRouterId start_router_id = NocRouterId(10); - NocRouterId sink_router_id = NocRouterId(10); + auto start_router_id = NocRouterId(10); + auto sink_router_id = NocRouterId(10); + auto traffic_flow_id = NocTrafficFlowId(33); // store the route found by the algorithm std::vector found_path; // make sure that a legal route was found (no error should be thrown) - REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model)); + REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model)); // now make sure that the found route is empty, we shouldn't be moving anywhere as the start and end routers are the same REQUIRE(found_path.empty() == true); } SECTION("Test case where there is a single shortest path between the source and destination routers in the NoC.") { // choosing the starting router (source) as the top left corner of the mesh - NocRouterId start_router_id = NocRouterId(12); + auto start_router_id = NocRouterId(12); // choosing the destination router as the bottom right corner of the mesh - NocRouterId sink_router_id = NocRouterId(3); + auto sink_router_id = NocRouterId(3); + auto traffic_flow_id = NocTrafficFlowId(33); // store the route to be found by the algorithm std::vector found_path; @@ -104,7 +106,7 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") { // now run the routinjg algorithm // make sure that a legal route was found (no error should be thrown) - REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model)); + REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model)); // check that the found route has the exact same number of links as the expected path REQUIRE(golden_path.size() == found_path.size()); @@ -116,9 +118,10 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") { } SECTION("Test case where no path could be found") { // choosing the starting router (source) as the top left corner of the mesh - NocRouterId start_router_id = NocRouterId(12); + auto start_router_id = NocRouterId(12); // choosing the destination router as the bottom right corner of the mesh - NocRouterId sink_router_id = NocRouterId(3); + auto sink_router_id = NocRouterId(3); + auto traffic_flow_id = NocTrafficFlowId(33); // Remove any direct links to router 3 noc_model.remove_link(NocRouterId(2), NocRouterId(3)); @@ -128,7 +131,8 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") { std::vector found_path; // run the routing algorithm and we expect ir ro fail - REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model), "No route could be found from starting router with id:'12' and the destination router with id:'3' using the breadth-first search routing algorithm."); + REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model), + "No route could be found from starting router with id:'12' and the destination router with id:'3' using the breadth-first search routing algorithm."); } } diff --git a/vpr/test/test_noc_place_utils.cpp b/vpr/test/test_noc_place_utils.cpp index 8e53ec68ed9..0f0da5a5086 100644 --- a/vpr/test/test_noc_place_utils.cpp +++ b/vpr/test/test_noc_place_utils.cpp @@ -162,7 +162,11 @@ TEST_CASE("test_initial_noc_placement", "[noc_place_utils]") { int source_hard_router_id = (size_t)curr_traffic_flow.source_router_cluster_id; int sink_hard_routed_id = (size_t)curr_traffic_flow.sink_router_cluster_id; // route it - routing_algorithm->route_flow((NocRouterId)source_hard_router_id, (NocRouterId)sink_hard_routed_id, traffic_flow_route, noc_ctx.noc_model); + routing_algorithm->route_flow((NocRouterId)source_hard_router_id, + (NocRouterId)sink_hard_routed_id, + (NocTrafficFlowId) traffic_flow_number, + traffic_flow_route, + noc_ctx.noc_model); } /* in the test function we will be routing all the traffic flows and then updating their link usages. So we will be generating a vector of all links @@ -360,7 +364,11 @@ TEST_CASE("test_initial_comp_cost_functions", "[noc_place_utils]") { int source_hard_router_id = (size_t)curr_traffic_flow.source_router_cluster_id; int sink_hard_routed_id = (size_t)curr_traffic_flow.sink_router_cluster_id; // route it - routing_algorithm->route_flow((NocRouterId)source_hard_router_id, (NocRouterId)sink_hard_routed_id, traffic_flow_route, noc_ctx.noc_model); + routing_algorithm->route_flow((NocRouterId)source_hard_router_id, + (NocRouterId)sink_hard_routed_id, + (NocTrafficFlowId)traffic_flow_number, + traffic_flow_route, + noc_ctx.noc_model); // store the number of links in the traffic flow golden_traffic_flow_route_sizes[traffic_flow_number] = traffic_flow_route.size(); @@ -647,7 +655,11 @@ TEST_CASE("test_find_affected_noc_routers_and_update_noc_costs, test_commit_noc_ int source_hard_router_id = (size_t)curr_traffic_flow.source_router_cluster_id; int sink_hard_routed_id = (size_t)curr_traffic_flow.sink_router_cluster_id; // route it - routing_algorithm->route_flow((NocRouterId)source_hard_router_id, (NocRouterId)sink_hard_routed_id, golden_traffic_flow_routes[(NocTrafficFlowId)traffic_flow_number], noc_ctx.noc_model); + routing_algorithm->route_flow((NocRouterId)source_hard_router_id, + (NocRouterId)sink_hard_routed_id, + (NocTrafficFlowId)traffic_flow_number, + golden_traffic_flow_routes[(NocTrafficFlowId)traffic_flow_number], + noc_ctx.noc_model); } // assume this works @@ -756,78 +768,86 @@ TEST_CASE("test_find_affected_noc_routers_and_update_noc_costs, test_commit_noc_ place_ctx.block_locs[swap_router_block_two].loc = blocks_affected.moved_blocks[1].new_loc; // get all the associated traffic flows of the moved cluster blocks - const std::vector* assoc_traffic_flows_block_one = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_one); - const std::vector* assoc_traffic_flows_block_two = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); + const std::vector& assoc_traffic_flows_block_one = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_one); + const std::vector& assoc_traffic_flows_block_two = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); // now go through the traffic flows and update the link bandwidths and traffic flow routes locally - for (auto& traffic_flow : *assoc_traffic_flows_block_one) { - if (routed_traffic_flows.find(traffic_flow) == routed_traffic_flows.end()) { + for (auto traffic_flow_id : assoc_traffic_flows_block_one) { + if (routed_traffic_flows.find(traffic_flow_id) == routed_traffic_flows.end()) { // get the current traffic flow - const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow); + const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id); // go through the current traffic flow and reduce the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] -= curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // re-route the traffic flow - routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], golden_traffic_flow_routes[traffic_flow], noc_ctx.noc_model); + routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], + router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], + traffic_flow_id, + golden_traffic_flow_routes[traffic_flow_id], + noc_ctx.noc_model); // go through the current traffic flow and increase the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] += curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // update the costs now - golden_traffic_flow_bandwidth_costs[traffic_flow] = golden_traffic_flow_routes[traffic_flow].size() * curr_traffic_flow.traffic_flow_bandwidth; - golden_traffic_flow_bandwidth_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] = golden_traffic_flow_routes[traffic_flow_id].size() * curr_traffic_flow.traffic_flow_bandwidth; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; - double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow].size()); + double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow_id].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow_id].size()); - golden_traffic_flow_latency_costs[traffic_flow] = curr_traffic_flow_latency; - golden_traffic_flow_latency_overrun_costs[traffic_flow] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); - golden_traffic_flow_latency_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; - golden_traffic_flow_latency_overrun_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_costs[traffic_flow_id] = curr_traffic_flow_latency; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); + golden_traffic_flow_latency_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; - routed_traffic_flows.insert(traffic_flow); + routed_traffic_flows.insert(traffic_flow_id); } } // this is for the second swapped block - for (auto& traffic_flow : *assoc_traffic_flows_block_two) { - if (routed_traffic_flows.find(traffic_flow) == routed_traffic_flows.end()) { + for (auto traffic_flow_id : assoc_traffic_flows_block_two) { + if (routed_traffic_flows.find(traffic_flow_id) == routed_traffic_flows.end()) { // get the current traffic flow - const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow); + const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id); // go through the current traffic flow and reduce the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] -= curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // re-route the traffic flow - routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], golden_traffic_flow_routes[traffic_flow], noc_ctx.noc_model); + routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], + router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], + traffic_flow_id, + golden_traffic_flow_routes[traffic_flow_id], + noc_ctx.noc_model); // go through the current traffic flow and increase the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] += curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // update the costs now - golden_traffic_flow_bandwidth_costs[traffic_flow] = golden_traffic_flow_routes[traffic_flow].size() * curr_traffic_flow.traffic_flow_bandwidth; - golden_traffic_flow_bandwidth_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] = golden_traffic_flow_routes[traffic_flow_id].size() * curr_traffic_flow.traffic_flow_bandwidth; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; - double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow].size()); + double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow_id].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow_id].size()); - golden_traffic_flow_latency_costs[traffic_flow] = curr_traffic_flow_latency; - golden_traffic_flow_latency_overrun_costs[traffic_flow] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); - golden_traffic_flow_latency_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; - golden_traffic_flow_latency_overrun_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_costs[traffic_flow_id] = curr_traffic_flow_latency; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); + golden_traffic_flow_latency_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; - routed_traffic_flows.insert(traffic_flow); + routed_traffic_flows.insert(traffic_flow_id); } } @@ -904,71 +924,79 @@ TEST_CASE("test_find_affected_noc_routers_and_update_noc_costs, test_commit_noc_ place_ctx.block_locs[swap_router_block_two].loc = blocks_affected.moved_blocks[1].new_loc; // get all the associated traffic flows of the moved cluster blocks - const std::vector* assoc_traffic_flows_block_one = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_one); - const std::vector* assoc_traffic_flows_block_two = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); + const std::vector& assoc_traffic_flows_block_one = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_one); + const std::vector& assoc_traffic_flows_block_two = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); // now go through the traffic flows and update the link bandwidths and traffic flow routes locally - for (auto& traffic_flow : *assoc_traffic_flows_block_one) { + for (auto traffic_flow_id : assoc_traffic_flows_block_one) { // get the current traffic flow - const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow); + const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id); // go through the current traffic flow and reduce the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] -= curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // re-route the traffic flow - routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], golden_traffic_flow_routes[traffic_flow], noc_ctx.noc_model); + routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], + router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], + traffic_flow_id, + golden_traffic_flow_routes[traffic_flow_id], + noc_ctx.noc_model); // go through the current traffic flow and increase the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] += curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // update the costs now - golden_traffic_flow_bandwidth_costs[traffic_flow] = golden_traffic_flow_routes[traffic_flow].size() * curr_traffic_flow.traffic_flow_bandwidth; - golden_traffic_flow_bandwidth_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] = golden_traffic_flow_routes[traffic_flow_id].size() * curr_traffic_flow.traffic_flow_bandwidth; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; - double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow].size()); + double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow_id].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow_id].size()); - golden_traffic_flow_latency_costs[traffic_flow] = curr_traffic_flow_latency; - golden_traffic_flow_latency_overrun_costs[traffic_flow] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); - golden_traffic_flow_latency_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; - golden_traffic_flow_latency_overrun_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_costs[traffic_flow_id] = curr_traffic_flow_latency; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); + golden_traffic_flow_latency_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; } // this is for the second swapped block - for (auto& traffic_flow : *assoc_traffic_flows_block_two) { + for (auto traffic_flow_id : assoc_traffic_flows_block_two) { // get the current traffic flow - const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow); + const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id); // go through the current traffic flow and reduce the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] -= curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // re-route the traffic flow - routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], golden_traffic_flow_routes[traffic_flow], noc_ctx.noc_model); + routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], + router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], + traffic_flow_id, + golden_traffic_flow_routes[traffic_flow_id], + noc_ctx.noc_model); // go through the current traffic flow and increase the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] += curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // update the costs now - golden_traffic_flow_bandwidth_costs[traffic_flow] = golden_traffic_flow_routes[traffic_flow].size() * curr_traffic_flow.traffic_flow_bandwidth; - golden_traffic_flow_bandwidth_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] = golden_traffic_flow_routes[traffic_flow_id].size() * curr_traffic_flow.traffic_flow_bandwidth; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; - double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow].size()); + double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow_id].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow_id].size()); - golden_traffic_flow_latency_costs[traffic_flow] = curr_traffic_flow_latency; - golden_traffic_flow_latency_overrun_costs[traffic_flow] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); - golden_traffic_flow_latency_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; - golden_traffic_flow_latency_overrun_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_costs[traffic_flow_id] = curr_traffic_flow_latency; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); + golden_traffic_flow_latency_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; } NocCostTerms delta_cost; @@ -1033,38 +1061,42 @@ TEST_CASE("test_find_affected_noc_routers_and_update_noc_costs, test_commit_noc_ // get all the associated traffic flows of the moved cluster blocks // remember that the first cluster block doesn't have any traffic flows associated to it - assoc_traffic_flows_block_two = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); + const auto& assoc_traffic_flows_block_2 = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); // this is for the second swapped block - for (auto& traffic_flow : *assoc_traffic_flows_block_two) { + for (auto traffic_flow_id : assoc_traffic_flows_block_2) { // get the current traffic flow - const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow); + const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id); // go through the current traffic flow and reduce the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] -= curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // re-route the traffic flow - routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], golden_traffic_flow_routes[traffic_flow], noc_ctx.noc_model); + routing_algorithm->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], + router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], + traffic_flow_id, + golden_traffic_flow_routes[traffic_flow_id], + noc_ctx.noc_model); // go through the current traffic flow and increase the bandwidths of the links - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { golden_link_bandwidths[link] += curr_traffic_flow.traffic_flow_bandwidth; golden_link_congestion_costs[link] = std::max(golden_link_bandwidths[link] - link_bandwidth, 0.0); } // update the costs now - golden_traffic_flow_bandwidth_costs[traffic_flow] = golden_traffic_flow_routes[traffic_flow].size() * curr_traffic_flow.traffic_flow_bandwidth; - golden_traffic_flow_bandwidth_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] = golden_traffic_flow_routes[traffic_flow_id].size() * curr_traffic_flow.traffic_flow_bandwidth; + golden_traffic_flow_bandwidth_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; - double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow].size()); + double curr_traffic_flow_latency = (router_latency * (golden_traffic_flow_routes[traffic_flow_id].size() + 1)) + (link_latency * golden_traffic_flow_routes[traffic_flow_id].size()); - golden_traffic_flow_latency_costs[traffic_flow] = curr_traffic_flow_latency; - golden_traffic_flow_latency_overrun_costs[traffic_flow] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); - golden_traffic_flow_latency_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; - golden_traffic_flow_latency_overrun_costs[traffic_flow] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_costs[traffic_flow_id] = curr_traffic_flow_latency; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] = std::max(curr_traffic_flow_latency - curr_traffic_flow.max_traffic_flow_latency, 0.); + golden_traffic_flow_latency_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; + golden_traffic_flow_latency_overrun_costs[traffic_flow_id] *= curr_traffic_flow.traffic_flow_priority; } // reset the delta costs @@ -1480,7 +1512,11 @@ TEST_CASE("test_revert_noc_traffic_flow_routes", "[noc_place_utils]") { int sink_hard_routed_id = (size_t)curr_traffic_flow.sink_router_cluster_id; // route it - routing_algorithm->route_flow((NocRouterId)source_hard_router_id, (NocRouterId)sink_hard_routed_id, golden_traffic_flow_routes[(NocTrafficFlowId)traffic_flow_number], noc_ctx.noc_model); + routing_algorithm->route_flow((NocRouterId)source_hard_router_id, + (NocRouterId)sink_hard_routed_id, + (NocTrafficFlowId)traffic_flow_number, + golden_traffic_flow_routes[(NocTrafficFlowId)traffic_flow_number], + noc_ctx.noc_model); } const vtr::vector> initial_golden_traffic_flow_routes = golden_traffic_flow_routes; @@ -1560,72 +1596,80 @@ TEST_CASE("test_revert_noc_traffic_flow_routes", "[noc_place_utils]") { router_where_cluster_is_placed[swap_router_block_two] = router_first_swap_cluster_location; // get all the associated traffic flows of the moved cluster blocks - const std::vector* assoc_traffic_flows_block_one = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_one); - const std::vector* assoc_traffic_flows_block_two = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); + const std::vector& assoc_traffic_flows_block_one = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_one); + const std::vector& assoc_traffic_flows_block_two = noc_ctx.noc_traffic_flows_storage.get_traffic_flows_associated_to_router_block(swap_router_block_two); // now go through the traffic flows and update the link bandwidths and traffic flow routes locally - for (auto& traffic_flow : *assoc_traffic_flows_block_one) { - if (routed_traffic_flows.find(traffic_flow) == routed_traffic_flows.end()) { + for (auto traffic_flow_id : assoc_traffic_flows_block_one) { + if (routed_traffic_flows.find(traffic_flow_id) == routed_traffic_flows.end()) { // get the current traffic flow - const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow); + const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id); - std::vector& traffic_flow_route = noc_ctx.noc_traffic_flows_storage.get_mutable_traffic_flow_route(traffic_flow); + std::vector& traffic_flow_route = noc_ctx.noc_traffic_flows_storage.get_mutable_traffic_flow_route(traffic_flow_id); traffic_flow_route.clear(); // go through the current traffic flow and reduce the bandwidths of the links (we only update this in the NoC, since these changes should be rectified by the test function) // This shouldn't be updated in the golden bandwidths since we are imitating a swap of blocks and not having a real swap of blocks - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { // update the link bandwidth in the NoC datastructure double current_link_bandwidth = noc_ctx.noc_model.get_single_noc_link(link).get_bandwidth_usage(); noc_ctx.noc_model.get_single_mutable_noc_link(link).set_bandwidth_usage(current_link_bandwidth - curr_traffic_flow.traffic_flow_bandwidth); } // re-route the traffic flow - noc_ctx.noc_flows_router->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], golden_traffic_flow_routes[traffic_flow], noc_ctx.noc_model); + noc_ctx.noc_flows_router->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], + router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], + traffic_flow_id, + golden_traffic_flow_routes[traffic_flow_id], + noc_ctx.noc_model); // go through the current traffic flow and reduce the bandwidths of the links (we only update this in the NoC, since these changes should be rectified by the test function) // This shouldn't be updated in the golden bandwidths since we are imitating a swap of blocks and not having a real swap of blocks - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { // update the link bandwidth in the NoC datastructure double current_link_bandwidth = noc_ctx.noc_model.get_single_noc_link(link).get_bandwidth_usage(); noc_ctx.noc_model.get_single_mutable_noc_link(link).set_bandwidth_usage(current_link_bandwidth + curr_traffic_flow.traffic_flow_bandwidth); traffic_flow_route.push_back(link); } - routed_traffic_flows.insert(traffic_flow); + routed_traffic_flows.insert(traffic_flow_id); } } // now go through the traffic flows associated with the second swapped block - for (auto& traffic_flow : *assoc_traffic_flows_block_two) { - if (routed_traffic_flows.find(traffic_flow) == routed_traffic_flows.end()) { + for (auto traffic_flow_id : assoc_traffic_flows_block_two) { + if (routed_traffic_flows.find(traffic_flow_id) == routed_traffic_flows.end()) { // get the current traffic flow - const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow); + const t_noc_traffic_flow& curr_traffic_flow = noc_ctx.noc_traffic_flows_storage.get_single_noc_traffic_flow(traffic_flow_id); - std::vector& traffic_flow_route = noc_ctx.noc_traffic_flows_storage.get_mutable_traffic_flow_route(traffic_flow); + std::vector& traffic_flow_route = noc_ctx.noc_traffic_flows_storage.get_mutable_traffic_flow_route(traffic_flow_id); traffic_flow_route.clear(); // go through the current traffic flow and reduce the bandwidths of the links (we only update this in the NoC, since these changes should be rectified by the test function) // This shouldn't be updated in the golden bandwidths since we are imitating a swap of blocks and not having a real swap of blocks - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { // update the link bandwidth in the NoC datastructure double current_link_bandwidth = noc_ctx.noc_model.get_single_noc_link(link).get_bandwidth_usage(); noc_ctx.noc_model.get_single_mutable_noc_link(link).set_bandwidth_usage(current_link_bandwidth - curr_traffic_flow.traffic_flow_bandwidth); } // re-route the traffic flow - noc_ctx.noc_flows_router->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id],router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], golden_traffic_flow_routes[traffic_flow], noc_ctx.noc_model); + noc_ctx.noc_flows_router->route_flow(router_where_cluster_is_placed[curr_traffic_flow.source_router_cluster_id], + router_where_cluster_is_placed[curr_traffic_flow.sink_router_cluster_id], + traffic_flow_id, + golden_traffic_flow_routes[traffic_flow_id], + noc_ctx.noc_model); // go through the current traffic flow and reduce the bandwidths of the links (we only update this in the NoC, since these changes should be rectified by the test function) // This shouldn't be updated in the golden bandwidths since we are imitating a swap of blocks and not having a real swap of blocks - for (auto& link : golden_traffic_flow_routes[traffic_flow]) { + for (auto& link : golden_traffic_flow_routes[traffic_flow_id]) { // update the link bandwidth in the NoC datastructure double current_link_bandwidth = noc_ctx.noc_model.get_single_noc_link(link).get_bandwidth_usage(); noc_ctx.noc_model.get_single_mutable_noc_link(link).set_bandwidth_usage(current_link_bandwidth + curr_traffic_flow.traffic_flow_bandwidth); traffic_flow_route.push_back(link); } - routed_traffic_flows.insert(traffic_flow); + routed_traffic_flows.insert(traffic_flow_id); } } @@ -1829,7 +1873,11 @@ TEST_CASE("test_check_noc_placement_costs", "[noc_place_utils]") { double traffic_flow_bandwidth = curr_traffic_flow.traffic_flow_bandwidth; // route it - routing_algorithm->route_flow((NocRouterId)source_hard_router_id, (NocRouterId)sink_hard_routed_id, traffic_flow_route, noc_ctx.noc_model); + routing_algorithm->route_flow((NocRouterId)source_hard_router_id, + (NocRouterId)sink_hard_routed_id, + (NocTrafficFlowId)traffic_flow_number, + traffic_flow_route, + noc_ctx.noc_model); // update link bandwidth utilization for (auto link_id : traffic_flow_route) { diff --git a/vpr/test/test_noc_storage.cpp b/vpr/test/test_noc_storage.cpp index a1255d31930..834d81b88a6 100644 --- a/vpr/test/test_noc_storage.cpp +++ b/vpr/test/test_noc_storage.cpp @@ -438,7 +438,7 @@ TEST_CASE("test_generate_router_key_from_grid_location", "[vpr_noc]") { // the grid locations go from 0 to the total number of routers in the NoC for (int grid_location = 0; grid_location < NUM_OF_ROUTERS; grid_location++) { // contains the grid location of a router block seen during placement - // we dont care about the subtile so give it a arbritary value + // we don't care about the subtile so give it an arbitrary value t_pl_loc placement_router_grid_location = t_pl_loc(grid_location, grid_location, -1, diff --git a/vpr/test/test_noc_traffic_flows.cpp b/vpr/test/test_noc_traffic_flows.cpp index 30791599805..1ee20f0aefc 100644 --- a/vpr/test/test_noc_traffic_flows.cpp +++ b/vpr/test/test_noc_traffic_flows.cpp @@ -104,14 +104,14 @@ TEST_CASE("test_adding_traffic_flows", "[vpr_noc_traffic_flows]") { int number_of_traffic_flows_associated_with_current_router = golden_list_of_associated_traffic_flows_to_routers[router_id].size(); // get the traffic flows associated to the current router from the test datastructure - const std::vector* associated_traffic_flows_to_router = traffic_flow_storage.get_traffic_flows_associated_to_router_block(router_id); + const std::vector& associated_traffic_flows_to_router = traffic_flow_storage.get_traffic_flows_associated_to_router_block(router_id); // make sure that the number of traffic flows associated to each router within the NocTrafficFlows data structure matches the golden set - REQUIRE((int)associated_traffic_flows_to_router->size() == number_of_traffic_flows_associated_with_current_router); + REQUIRE((int)associated_traffic_flows_to_router.size() == number_of_traffic_flows_associated_with_current_router); // now go through the associated traffic flows and make sure the correct ones were added to the current router for (int router_traffic_flow = 0; router_traffic_flow < number_of_traffic_flows_associated_with_current_router; router_traffic_flow++) { - REQUIRE((size_t)golden_list_of_associated_traffic_flows_to_routers[router_id][router_traffic_flow] == (size_t)(*associated_traffic_flows_to_router)[router_traffic_flow]); + REQUIRE((size_t)golden_list_of_associated_traffic_flows_to_routers[router_id][router_traffic_flow] == (size_t)associated_traffic_flows_to_router[router_traffic_flow]); } } @@ -130,7 +130,7 @@ TEST_CASE("test_adding_traffic_flows", "[vpr_noc_traffic_flows]") { ClusterBlockId invalid_block = (ClusterBlockId)(NUM_OF_ROUTERS + 1); // check that this router has no traffic flows associated with it - REQUIRE(traffic_flow_storage.get_traffic_flows_associated_to_router_block(invalid_block) == nullptr); + REQUIRE(traffic_flow_storage.get_traffic_flows_associated_to_router_block(invalid_block).empty()); } } } // namespace \ No newline at end of file diff --git a/vpr/test/test_xy_routing.cpp b/vpr/test/test_xy_routing.cpp index 49b58662ca2..e968f74de70 100644 --- a/vpr/test/test_xy_routing.cpp +++ b/vpr/test/test_xy_routing.cpp @@ -11,7 +11,7 @@ namespace { * verifies whether the two routers are the exact same or not. * */ -void compare_routes(const std::vector& golden_path, const std::vector& found_path, const NocStorage& noc_model) { +static void compare_routes(const std::vector& golden_path, const std::vector& found_path, const NocStorage& noc_model) { // make sure that size of the found route and golden route match REQUIRE(found_path.size() == golden_path.size()); @@ -22,12 +22,11 @@ void compare_routes(const std::vector& golden_path, const std::vector found_path; // make sure that a legal route was found (no error should be thrown) - REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model)); + REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model)); // now make sure that the found route is empty, we shouldn't be moving anywhere as the start and end routers are the same REQUIRE(found_path.empty() == true); } SECTION("Test case where the destination router and the starting routers are located on the same row within the FPGA device.") { // choose start router as 7, and choose the destination router as 4 - NocRouterId start_router_id = NocRouterId(7); - NocRouterId sink_router_id = NocRouterId(4); + auto start_router_id = NocRouterId(7); + auto sink_router_id = NocRouterId(4); + auto traffic_flow_id = NocTrafficFlowId (34); // build the golden route that we expect the algorithm to produce // the expectation is a number of links that path horizontally from router 7 to router 4 @@ -118,15 +119,16 @@ TEST_CASE("test_route_flow", "[vpr_noc_xy_routing]") { std::vector found_path; // now run the algorithm to find a route, once again we expect no errors and a legal path to be found - REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model)); + REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model)); // make sure that size of the found route and golden route match compare_routes(golden_path, found_path, noc_model); } SECTION("Test case where the destination router and the starting routers are located on the same column within the FPGA device.") { // choose start router as 2, and choose the destination router as 14 - NocRouterId start_router_id = NocRouterId(2); - NocRouterId sink_router_id = NocRouterId(14); + auto start_router_id = NocRouterId(2); + auto sink_router_id = NocRouterId(14); + auto traffic_flow_id = NocTrafficFlowId (35); // build the golden route that we expect the algorithm to produce // the expectation is a number of links that path vertically from router 2 to router 14 @@ -142,15 +144,16 @@ TEST_CASE("test_route_flow", "[vpr_noc_xy_routing]") { std::vector found_path; // now run the algorithm to find a route, once again we expect no errors and a legal path to be found - REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model)); + REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model)); // make sure that size of the found route and golden route match compare_routes(golden_path, found_path, noc_model); } SECTION("Test case where the destination router and the starting routers are located on different columns and rows within the FPGA device. In this test the path moves left and then up.") { // choose start router as 3, and choose the destination router as 14 - NocRouterId start_router_id = NocRouterId(3); - NocRouterId sink_router_id = NocRouterId(12); + auto start_router_id = NocRouterId(3); + auto sink_router_id = NocRouterId(12); + auto traffic_flow_id = NocTrafficFlowId (37); // build the golden route that we expect the algorithm to produce // the expectation is a number of links that path horizontally from router 3 to router 0 and then vertically from router 0 to 12 @@ -174,7 +177,7 @@ TEST_CASE("test_route_flow", "[vpr_noc_xy_routing]") { std::vector found_path; // now run the algorithm to find a route, once again we expect no errors and a legal path to be found - REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model)); + REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model)); // make sure that size of the found route and golden route match compare_routes(golden_path, found_path, noc_model); @@ -184,8 +187,9 @@ TEST_CASE("test_route_flow", "[vpr_noc_xy_routing]") { // These directions had not been tested yet. // choose start router as 12, and choose the destination router as 3 - NocRouterId start_router_id = NocRouterId(12); - NocRouterId sink_router_id = NocRouterId(3); + auto start_router_id = NocRouterId(12); + auto sink_router_id = NocRouterId(3); + auto traffic_flow_id = NocTrafficFlowId(38); // build the golden route that we expect the algorithm to produce // the expectation is a number of links that path horizontally from router 12 to router 15 and then vertically from router 15 to 3 @@ -209,7 +213,7 @@ TEST_CASE("test_route_flow", "[vpr_noc_xy_routing]") { std::vector found_path; // now run the algorithm to find a route, once again we expect no errors and a legal path to be found - REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model)); + REQUIRE_NOTHROW(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model)); // make sure that size of the found route and golden route match compare_routes(golden_path, found_path, noc_model); @@ -278,12 +282,13 @@ TEST_CASE("test_route_flow when it fails in a mesh topology.", "[vpr_noc_xy_rout */ // store the source and destination routers - NocRouterId start_router_id = NocRouterId(3); - NocRouterId sink_router_id = NocRouterId(0); + auto start_router_id = NocRouterId(3); + auto sink_router_id = NocRouterId(0); + auto traffic_flow_id = NocTrafficFlowId (39); // routers associated to the link to remove - NocRouterId link_to_remove_src_router_id = NocRouterId(2); - NocRouterId link_to_remove_sink_router_id = NocRouterId(1); + auto link_to_remove_src_router_id = NocRouterId(2); + auto link_to_remove_sink_router_id = NocRouterId(1); // start by deleting the link that connects router 2 to router 1 noc_model.remove_link(link_to_remove_src_router_id, link_to_remove_sink_router_id); @@ -292,7 +297,8 @@ TEST_CASE("test_route_flow when it fails in a mesh topology.", "[vpr_noc_xy_rout std::vector found_path; // now use the XY router to find a route, we expect it to fail - REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model), "No route could be found from starting router with ID:'3' and the destination router with ID:'0' using the XY-Routing algorithm."); + REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model), + "No route could be found from starting router with ID:'3' and the destination router with ID:'0' using the XY-Routing algorithm."); } SECTION("Test case where the xy routing algorithm fails to find a vertical link to traverse.") { /* @@ -302,12 +308,13 @@ TEST_CASE("test_route_flow when it fails in a mesh topology.", "[vpr_noc_xy_rout */ // store the source and destination routers - NocRouterId start_router_id = NocRouterId(3); - NocRouterId sink_router_id = NocRouterId(15); + auto start_router_id = NocRouterId(3); + auto sink_router_id = NocRouterId(15); + auto traffic_flow_id = NocTrafficFlowId (41); // routers associated to the link to remove - NocRouterId link_to_remove_src_router_id = NocRouterId(11); - NocRouterId link_to_remove_sink_router_id = NocRouterId(15); + auto link_to_remove_src_router_id = NocRouterId(11); + auto link_to_remove_sink_router_id = NocRouterId(15); // start by deleting the link that connects router 11 to router 15 noc_model.remove_link(link_to_remove_src_router_id, link_to_remove_sink_router_id); @@ -316,7 +323,8 @@ TEST_CASE("test_route_flow when it fails in a mesh topology.", "[vpr_noc_xy_rout std::vector found_path; // now use the XY router to find a route, we expect it to fail - REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model), "No route could be found from starting router with ID:'3' and the destination router with ID:'15' using the XY-Routing algorithm."); + REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model), + "No route could be found from starting router with ID:'3' and the destination router with ID:'15' using the XY-Routing algorithm."); } } TEST_CASE("test_route_flow when it fails in a non mesh topology.", "[vpr_noc_xy_routing]") { @@ -358,8 +366,9 @@ TEST_CASE("test_route_flow when it fails in a non mesh topology.", "[vpr_noc_xy_ noc_model.add_link((NocRouterId)2, (NocRouterId)1); // now create the start and the destination routers of the route we want to test - NocRouterId start_router_id = NocRouterId(3); - NocRouterId sink_router_id = NocRouterId(1); + auto start_router_id = NocRouterId(3); + auto sink_router_id = NocRouterId(1); + auto traffic_flow_id = NocTrafficFlowId (40); // creating the XY routing object XYRouting routing_algorithm; @@ -368,7 +377,8 @@ TEST_CASE("test_route_flow when it fails in a non mesh topology.", "[vpr_noc_xy_ std::vector found_path; // now use the XY router to find a route. We expect this to fail to check that. - REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model), "No route could be found from starting router with ID:'3' and the destination router with ID:'1' using the XY-Routing algorithm."); + REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, traffic_flow_id, found_path, noc_model), + "No route could be found from starting router with ID:'3' and the destination router with ID:'1' using the XY-Routing algorithm."); } } // namespace \ No newline at end of file