Spot a bug in lb router where path finder fail to use low-occupancy node when expanding the tree
This commit is contained in:
parent
f90dc5c296
commit
773e6da308
|
@ -94,6 +94,11 @@ bool LbRouter::is_route_success(const LbRRGraph& lb_rr_graph) const {
|
||||||
|
|
||||||
for (const LbRRNodeId& inode : lb_rr_graph.nodes()) {
|
for (const LbRRNodeId& inode : lb_rr_graph.nodes()) {
|
||||||
if (routing_status_[inode].occ > lb_rr_graph.node_capacity(inode)) {
|
if (routing_status_[inode].occ > lb_rr_graph.node_capacity(inode)) {
|
||||||
|
VTR_LOGV(lb_rr_graph.node_pb_graph_pin(inode),
|
||||||
|
"Route failed due to overuse pin '%s': occupancy '%ld' > capacity '%ld'!\n",
|
||||||
|
lb_rr_graph.node_pb_graph_pin(inode)->to_string().c_str(),
|
||||||
|
routing_status_[inode].occ,
|
||||||
|
lb_rr_graph.node_capacity(inode));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,18 +248,22 @@ bool LbRouter::try_route_net(const LbRRGraph& lb_rr_graph,
|
||||||
*/
|
*/
|
||||||
sink_routed[isink] = !try_expand_nodes(atom_nlist, lb_rr_graph, net_idx, exp_node, isrc, isink, mode_status_.expand_all_modes, verbosity);
|
sink_routed[isink] = !try_expand_nodes(atom_nlist, lb_rr_graph, net_idx, exp_node, isrc, isink, mode_status_.expand_all_modes, verbosity);
|
||||||
|
|
||||||
|
/* TODO: Debug codes, to be removed
|
||||||
if (true == sink_routed[isink]) {
|
if (true == sink_routed[isink]) {
|
||||||
VTR_LOGV(verbosity,
|
VTR_LOGV(verbosity,
|
||||||
"Succeed to expand routing tree from source pin '%s' to sink pin '%s'!\n",
|
"Succeed to expand routing tree from source pin '%s' to sink pin '%s'!\n",
|
||||||
lb_rr_graph.node_pb_graph_pin(lb_net_sources_[net_idx][isrc])->to_string().c_str(),
|
lb_rr_graph.node_pb_graph_pin(lb_net_sources_[net_idx][isrc])->to_string().c_str(),
|
||||||
lb_rr_graph.node_pb_graph_pin(lb_net_sinks_[net_idx][isink])->to_string().c_str());
|
lb_rr_graph.node_pb_graph_pin(lb_net_sinks_[net_idx][isink])->to_string().c_str());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* IMPORTANT: We do not need expand all the modes for physical repack
|
||||||
if (false == sink_routed[isink] && false == mode_status_.expand_all_modes) {
|
if (false == sink_routed[isink] && false == mode_status_.expand_all_modes) {
|
||||||
mode_status_.try_expand_all_modes = true;
|
mode_status_.try_expand_all_modes = true;
|
||||||
mode_status_.expand_all_modes = true;
|
mode_status_.expand_all_modes = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (exp_node.node_index == lb_net_sinks_[net_idx][isink]) {
|
if (exp_node.node_index == lb_net_sinks_[net_idx][isink]) {
|
||||||
/* Net terminal is routed, add this to the route tree, clear data structures, and keep going */
|
/* Net terminal is routed, add this to the route tree, clear data structures, and keep going */
|
||||||
|
@ -274,13 +283,17 @@ bool LbRouter::try_route_net(const LbRRGraph& lb_rr_graph,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (true == sink_routed[isink]) {
|
if (true == sink_routed[isink]) {
|
||||||
VTR_LOGV(verbosity,
|
VTR_LOGV(verbosity,
|
||||||
"Routing succeeded from source pin '%s' to sink pin '%s'!\n",
|
"Routing succeeded from source pin '%s' to sink pin '%s'!\n",
|
||||||
lb_rr_graph.node_pb_graph_pin(lb_net_sources_[net_idx][isrc])->to_string().c_str(),
|
lb_rr_graph.node_pb_graph_pin(lb_net_sources_[net_idx][isrc])->to_string().c_str(),
|
||||||
lb_rr_graph.node_pb_graph_pin(lb_net_sinks_[net_idx][isink])->to_string().c_str());
|
lb_rr_graph.node_pb_graph_pin(lb_net_sinks_[net_idx][isink])->to_string().c_str());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Increment explored node indices only when routing is successful */
|
||||||
|
if (true == sink_routed[isink]) {
|
||||||
explore_id_index_++;
|
explore_id_index_++;
|
||||||
if (explore_id_index_ > 2000000000) {
|
if (explore_id_index_ > 2000000000) {
|
||||||
/* overflow protection */
|
/* overflow protection */
|
||||||
|
@ -290,21 +303,44 @@ bool LbRouter::try_route_net(const LbRRGraph& lb_rr_graph,
|
||||||
explore_id_index_ = 1;
|
explore_id_index_ = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* Route failed, reset the explore id index */
|
||||||
|
reset_explored_node_tb();
|
||||||
|
for (const LbRRNodeId& id : lb_rr_graph.nodes()) {
|
||||||
|
explored_node_tb_[id].explored_id = OPEN;
|
||||||
|
explored_node_tb_[id].enqueue_id = OPEN;
|
||||||
|
explore_id_index_ = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If routing succeed so far, we will try to save(commit) results
|
/* If any sinks are managed to be routed, we will try to save(commit) results
|
||||||
* to route tree.
|
* to route tree.
|
||||||
* During this process, we will check if there is any
|
* During this process, we will check if there is any
|
||||||
* nodes using different modes under the same pb_type
|
* nodes using different modes under the same pb_type
|
||||||
* If so, we have conflicts and routing is considered to be failure
|
* If so, we have conflicts and routing is considered to be failure
|
||||||
*/
|
*/
|
||||||
|
bool any_sink_routed = false;
|
||||||
|
for (size_t isink = 0; isink < sink_routed.size(); ++isink) {
|
||||||
if (true == sink_routed[isink]) {
|
if (true == sink_routed[isink]) {
|
||||||
|
any_sink_routed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (true == any_sink_routed) {
|
||||||
commit_remove_rt(lb_rr_graph, lb_net_rt_trees_[net_idx][isrc], RT_COMMIT, mode_map);
|
commit_remove_rt(lb_rr_graph, lb_net_rt_trees_[net_idx][isrc], RT_COMMIT, mode_map);
|
||||||
if (true == mode_status_.is_mode_conflict) {
|
if (true == mode_status_.is_mode_conflict) {
|
||||||
|
VTR_LOGV(verbosity,
|
||||||
|
"Route fail due to mode conflicts when commiting the routing tree!\n");
|
||||||
|
for (size_t isink = 0; isink < sink_routed.size(); ++isink) {
|
||||||
|
/* Change routed sinks to failure */
|
||||||
|
if (true == sink_routed[isink]) {
|
||||||
sink_routed[isink] = false;
|
sink_routed[isink] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Check the routing status for all the sinks */
|
/* Check the routing status for all the sinks */
|
||||||
bool route_succeed = true;
|
bool route_succeed = true;
|
||||||
|
@ -526,6 +562,11 @@ void LbRouter::commit_remove_rt(const LbRRGraph& lb_rr_graph,
|
||||||
explored_node_tb_[inode].inet = NetId::INVALID();
|
explored_node_tb_[inode].inet = NetId::INVALID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op == RT_COMMIT) {
|
||||||
|
VTR_LOGV(lb_rr_graph.node_pb_graph_pin(inode),
|
||||||
|
"Commit node '%s' to routing tree\n",
|
||||||
|
lb_rr_graph.node_pb_graph_pin(inode)->to_string().c_str());
|
||||||
|
}
|
||||||
routing_status_[inode].occ += incr;
|
routing_status_[inode].occ += incr;
|
||||||
VTR_ASSERT(routing_status_[inode].occ >= 0);
|
VTR_ASSERT(routing_status_[inode].occ >= 0);
|
||||||
|
|
||||||
|
@ -702,11 +743,23 @@ void LbRouter::expand_edges(const LbRRGraph& lb_rr_graph,
|
||||||
if (explored_node_tb_[enode.node_index].enqueue_id == explore_id_index_) {
|
if (explored_node_tb_[enode.node_index].enqueue_id == explore_id_index_) {
|
||||||
if (enode.cost < explored_node_tb_[enode.node_index].enqueue_cost) {
|
if (enode.cost < explored_node_tb_[enode.node_index].enqueue_cost) {
|
||||||
pq_.push(enode);
|
pq_.push(enode);
|
||||||
|
/*
|
||||||
|
if (nullptr != lb_rr_graph.node_pb_graph_pin(enode.node_index)) {
|
||||||
|
VTR_LOG("Added node '%s' to priority queue\n",
|
||||||
|
lb_rr_graph.node_pb_graph_pin(enode.node_index)->to_string().c_str());
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
explored_node_tb_[enode.node_index].enqueue_id = explore_id_index_;
|
explored_node_tb_[enode.node_index].enqueue_id = explore_id_index_;
|
||||||
explored_node_tb_[enode.node_index].enqueue_cost = enode.cost;
|
explored_node_tb_[enode.node_index].enqueue_cost = enode.cost;
|
||||||
pq_.push(enode);
|
pq_.push(enode);
|
||||||
|
/*
|
||||||
|
if (nullptr != lb_rr_graph.node_pb_graph_pin(enode.node_index)) {
|
||||||
|
VTR_LOG("Added node '%s' to priority queue\n",
|
||||||
|
lb_rr_graph.node_pb_graph_pin(enode.node_index)->to_string().c_str());
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -732,6 +785,14 @@ void LbRouter::expand_node(const LbRRGraph& lb_rr_graph,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (nullptr != mode) {
|
||||||
|
VTR_LOGV(lb_rr_graph.node_pb_graph_pin(cur_node),
|
||||||
|
"Expand node '%s' by considering mode '%s'\n",
|
||||||
|
lb_rr_graph.node_pb_graph_pin(cur_node)->to_string().c_str(),
|
||||||
|
mode->name);
|
||||||
|
}
|
||||||
|
*/
|
||||||
expand_edges(lb_rr_graph, mode, cur_node, cur_cost, net_fanout);
|
expand_edges(lb_rr_graph, mode, cur_node, cur_cost, net_fanout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -782,7 +843,7 @@ bool LbRouter::try_expand_nodes(const AtomNetlist& atom_nlist,
|
||||||
const int& isrc,
|
const int& isrc,
|
||||||
const int& itarget,
|
const int& itarget,
|
||||||
const bool& try_other_modes,
|
const bool& try_other_modes,
|
||||||
const int& verbosity) {
|
const bool& verbosity) {
|
||||||
bool is_impossible = false;
|
bool is_impossible = false;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -790,7 +851,7 @@ bool LbRouter::try_expand_nodes(const AtomNetlist& atom_nlist,
|
||||||
/* No connection possible */
|
/* No connection possible */
|
||||||
is_impossible = true;
|
is_impossible = true;
|
||||||
|
|
||||||
if (verbosity > 3) {
|
if (true == verbosity) {
|
||||||
//Print detailed debug info
|
//Print detailed debug info
|
||||||
AtomNetId net_id = lb_net_atom_net_ids_[lb_net];
|
AtomNetId net_id = lb_net_atom_net_ids_[lb_net];
|
||||||
AtomPinId driver_pin = lb_net_atom_source_pins_[lb_net][isrc];
|
AtomPinId driver_pin = lb_net_atom_source_pins_[lb_net][isrc];
|
||||||
|
|
|
@ -321,7 +321,7 @@ class LbRouter {
|
||||||
const int& isrc,
|
const int& isrc,
|
||||||
const int& itarget,
|
const int& itarget,
|
||||||
const bool& try_other_modes,
|
const bool& try_other_modes,
|
||||||
const int& verbosity);
|
const bool& verbosity);
|
||||||
|
|
||||||
bool try_route_net(const LbRRGraph& lb_rr_graph,
|
bool try_route_net(const LbRRGraph& lb_rr_graph,
|
||||||
const AtomNetlist& atom_nlist,
|
const AtomNetlist& atom_nlist,
|
||||||
|
|
|
@ -3,3 +3,4 @@ b 0.502000 0.197200
|
||||||
clk 0.500000 2.000000
|
clk 0.500000 2.000000
|
||||||
d 0.240200 0.171200
|
d 0.240200 0.171200
|
||||||
c 0.240200 0.044100
|
c 0.240200 0.044100
|
||||||
|
n1 0.240200 0.044100
|
||||||
|
|
|
@ -3,9 +3,12 @@
|
||||||
.inputs a b clk
|
.inputs a b clk
|
||||||
.outputs c d
|
.outputs c d
|
||||||
|
|
||||||
.latch c d re clk 0
|
.latch n1 d re clk 0
|
||||||
|
|
||||||
.names a b c
|
.names a b c
|
||||||
11 1
|
11 1
|
||||||
|
|
||||||
|
.names c n1
|
||||||
|
1 1
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
|
Loading…
Reference in New Issue