Skip to content

Commit 414088c

Browse files
[ParallelRouter] Fixed Bitcoin Bug
The bug in bitcoin_miner was caused by a precision issue where the congestion cost would get so large that the delay cost would not matter. This creates zero-cost cycles which the deterministic parallel router cannot handle. There was a PR on VTR Master which fixed this by preventing the pres_fac from going over 1000. Bringing that change in early. This change will fully be brought in the next time this branch is rebased onto master.
1 parent 55a254a commit 414088c

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

vpr/src/route/parallel_connection_router.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ void ParallelConnectionRouter::add_route_tree_node_to_heap(
881881
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, inode, is_flat_).c_str());
882882

883883

884-
if (tot_cost >= rr_node_route_inf_[inode].path_cost)
884+
if (prune_node(inode, tot_cost, backward_path_cost, RREdgeId::INVALID(), target_node, rr_node_route_inf_, cost_params))
885885
return ;
886886
add_to_mod_list(inode, 0/*main thread*/);
887887
rr_node_route_inf_[inode].path_cost = tot_cost;

vpr/src/route/route.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ bool route(const Netlist<>& net_list,
440440
pres_fac = update_draw_pres_fac(router_opts.initial_pres_fac);
441441
} else {
442442
pres_fac *= router_opts.pres_fac_mult;
443-
443+
pres_fac = std::min(pres_fac, 1000.f);
444444
/* Avoid overflow for high iteration counts, even if acc_cost is big */
445445
pres_fac = update_draw_pres_fac(std::min(pres_fac, static_cast<float>(HUGE_POSITIVE_FLOAT / 1e5)));
446446

vpr/src/route/route_tree.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "rr_graph_fwd.h"
88
#include "vtr_math.h"
99

10+
// #define DEBUG_CHECK_FOR_LOOP
11+
1012
/* Construct a new RouteTreeNode.
1113
* Doesn't add the node to parent's child_nodes! (see add_child) */
1214
RouteTreeNode::RouteTreeNode(RRNodeId _inode, RRSwitchId _parent_switch, RouteTreeNode* parent)
@@ -535,9 +537,25 @@ RouteTree::add_subtree_from_heap(t_heap* hptr, int target_net_pin_index, bool is
535537
RRNodeId new_inode = rr_graph.edge_src_node(edge);
536538
RRSwitchId new_iswitch = RRSwitchId(rr_graph.rr_nodes().edge_switch(edge));
537539

540+
#ifdef DEBUG_CHECK_FOR_LOOP
541+
std::unordered_set<RRNodeId> seen_nodes;
542+
#endif
543+
538544
/* build a path, looking up rr nodes and switches from rr_node_route_inf */
539545
new_branch_inodes.push_back(sink_inode);
540546
while (!_rr_node_to_rt_node.count(new_inode)) {
547+
#ifdef DEBUG_CHECK_FOR_LOOP
548+
VTR_ASSERT(new_inode.is_valid() && "Invalid node being added to path!");
549+
if (seen_nodes.count(new_inode) != 0) {
550+
for (const RRNodeId &n : new_branch_inodes) {
551+
VTR_LOG("%zu (%.20e), ", (size_t)n, route_ctx.rr_node_route_inf[n].backward_path_cost);
552+
}
553+
VTR_LOG("\n");
554+
VTR_LOG("Duplicate node: %zu\n", new_inode);
555+
VTR_ASSERT(false && "Duplicate node in path!");
556+
}
557+
seen_nodes.insert(new_inode);
558+
#endif
541559
new_branch_inodes.push_back(new_inode);
542560
new_branch_iswitches.push_back(new_iswitch);
543561
edge = route_ctx.rr_node_route_inf[new_inode].prev_edge;

0 commit comments

Comments
 (0)