Skip to content

Commit 46d6c2c

Browse files
committed
[Router] Finally fixed the weird bug in parallel connection router
Fixed the weird bug in parallel connection router as mentioned in commit f73212c. The bug occurred because two function parameters 'num_threads' and 'num_queues' have been misplaced when instantiating the MQ_IO. This took two weeks to figure out exactly. The VTR benchmark (`vtr_reg_qor_chain` task) has been tested/passed for different cases (1) 'serial mode' 1T+2Q (1 thread, 2 queues), (2) 2T+4Q, and (3) 4T+2Q. The determinism has also been verified for the VTR benchmark.
1 parent f73212c commit 46d6c2c

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

vpr/src/route/multi_queue_d_ary_heap.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MultiQueueDAryHeap {
4141
using MQ_IO = MultiQueueIO<D, MQHeapNode, MQHeapNodeTupleComparator, HeapNodePriority>;
4242

4343
MultiQueueDAryHeap() {
44-
set_num_threads_and_queues(2, 1); // Serial (#threads=1, #queues=2) by default
44+
set_num_threads_and_queues(1, 2); // Serial (#threads=1, #queues=2) by default
4545
}
4646

4747
MultiQueueDAryHeap(size_t num_threads, size_t num_queues) {
@@ -52,7 +52,8 @@ class MultiQueueDAryHeap {
5252

5353
void set_num_threads_and_queues(size_t num_threads, size_t num_queues) {
5454
pq_.reset();
55-
pq_ = std::make_unique<MQ_IO>(num_threads, num_queues, 0 /*Dont care (batch size for only popBatch)*/);
55+
// Note: BE AWARE that in MQ_IO interface, `num_queues` comes first, then `num_threads`!
56+
pq_ = std::make_unique<MQ_IO>(num_queues, num_threads, 0 /*Dont care (batch size for only popBatch)*/);
5657
}
5758

5859
void init_heap(const DeviceGrid& grid) {

vpr/src/route/parallel_connection_router.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,9 @@ class ParallelConnectionRouter : public ConnectionRouter<MultiQueueDAryHeap<Heap
207207
* @brief Resets modified data in rr_node_route_inf based on modified_rr_node_inf
208208
*/
209209
void reset_path_costs() final {
210-
auto& route_ctx = g_vpr_ctx.mutable_routing();
210+
// Reset the node info stored in rr_node_route_inf variable
211211
for (const auto& thread_visited_rr_nodes : this->modified_rr_node_inf_) {
212-
for (const auto node : thread_visited_rr_nodes) {
213-
route_ctx.rr_node_route_inf[node].path_cost = std::numeric_limits<float>::infinity();
214-
route_ctx.rr_node_route_inf[node].backward_path_cost = std::numeric_limits<float>::infinity();
215-
route_ctx.rr_node_route_inf[node].prev_edge = RREdgeId::INVALID();
216-
}
212+
::reset_path_costs(thread_visited_rr_nodes);
217213
}
218214
}
219215

0 commit comments

Comments
 (0)