@@ -190,6 +190,28 @@ void pathfinder_update_acc_cost_and_overuse_info(float acc_fac, OveruseInfo& ove
190
190
auto & device_ctx = g_vpr_ctx.device ();
191
191
const auto & rr_graph = device_ctx.rr_graph ;
192
192
auto & route_ctx = g_vpr_ctx.mutable_routing ();
193
+
194
+ #ifdef VPR_USE_TBB
195
+ tbb::combinable<size_t > overused_nodes (0 ), total_overuse (0 ), worst_overuse (0 );
196
+ tbb::parallel_for_each (rr_graph.nodes ().begin (), rr_graph.nodes ().end (), [&](RRNodeId rr_id) {
197
+ int overuse = route_ctx.rr_node_route_inf [rr_id].occ () - rr_graph.node_capacity (rr_id);
198
+
199
+ // If overused, update the acc_cost and add this node to the overuse info
200
+ // If not, do nothing
201
+ if (overuse > 0 ) {
202
+ route_ctx.rr_node_route_inf [rr_id].acc_cost += overuse * acc_fac;
203
+
204
+ ++overused_nodes.local ();
205
+ total_overuse.local () += overuse;
206
+ worst_overuse.local () = std::max (worst_overuse.local (), size_t (overuse));
207
+ }
208
+ });
209
+
210
+ // Update overuse info
211
+ overuse_info.overused_nodes = overused_nodes.combine (std::plus<size_t >());
212
+ overuse_info.total_overuse = total_overuse.combine (std::plus<size_t >());
213
+ overuse_info.worst_overuse = worst_overuse.combine ([](size_t a, size_t b) { return std::max (a, b); });
214
+ #else
193
215
size_t overused_nodes = 0 , total_overuse = 0 , worst_overuse = 0 ;
194
216
195
217
for (const RRNodeId& rr_id : rr_graph.nodes ()) {
@@ -210,6 +232,7 @@ void pathfinder_update_acc_cost_and_overuse_info(float acc_fac, OveruseInfo& ove
210
232
overuse_info.overused_nodes = overused_nodes;
211
233
overuse_info.total_overuse = total_overuse;
212
234
overuse_info.worst_overuse = worst_overuse;
235
+ #endif
213
236
}
214
237
215
238
/* * Update pathfinder cost of all nodes rooted at rt_node, including rt_node itself */
0 commit comments