@@ -70,15 +70,15 @@ class NestedNetlistRouter : public NetlistRouter {
70
70
/* * Route all nets in a PartitionTree node and add its children to the task queue. */
71
71
void route_partition_tree_node (PartitionTreeNode& node);
72
72
73
- std::shared_ptr <ConnectionRouterInterface> _make_router (const RouterLookahead* router_lookahead,
73
+ std::unique_ptr <ConnectionRouterInterface> _make_router (const RouterLookahead* router_lookahead,
74
74
const t_router_opts& router_opts,
75
75
bool is_flat) {
76
76
auto & device_ctx = g_vpr_ctx.device ();
77
77
auto & route_ctx = g_vpr_ctx.mutable_routing ();
78
78
79
79
if (!router_opts.enable_parallel_connection_router ) {
80
80
// Serial Connection Router
81
- return std::make_shared <SerialConnectionRouter<HeapType>>(
81
+ return std::make_unique <SerialConnectionRouter<HeapType>>(
82
82
device_ctx.grid ,
83
83
*router_lookahead,
84
84
device_ctx.rr_graph .rr_nodes (),
@@ -89,7 +89,7 @@ class NestedNetlistRouter : public NetlistRouter {
89
89
is_flat);
90
90
} else {
91
91
// Parallel Connection Router
92
- return std::make_shared <ParallelConnectionRouter<HeapType>>(
92
+ return std::make_unique <ParallelConnectionRouter<HeapType>>(
93
93
device_ctx.grid ,
94
94
*router_lookahead,
95
95
device_ctx.rr_graph .rr_nodes (),
@@ -131,19 +131,19 @@ class NestedNetlistRouter : public NetlistRouter {
131
131
132
132
/* Thread-local storage.
133
133
* These are maps because thread::id is a random integer instead of 1, 2, ... */
134
- std::unordered_map<std::thread::id, std::shared_ptr <ConnectionRouterInterface>> _routers_th;
134
+ std::unordered_map<std::thread::id, std::unique_ptr <ConnectionRouterInterface>> _routers_th;
135
135
std::unordered_map<std::thread::id, RouteIterResults> _results_th;
136
136
std::mutex _storage_mutex;
137
137
138
138
/* * Get a thread-local ConnectionRouter. We lock the id->router lookup, but this is
139
139
* accessed once per partition so the overhead should be small */
140
- std::shared_ptr< ConnectionRouterInterface> get_thread_router () {
140
+ ConnectionRouterInterface& get_thread_router () {
141
141
auto id = std::this_thread::get_id ();
142
142
std::lock_guard<std::mutex> lock (_storage_mutex);
143
143
if (!_routers_th.count (id)) {
144
144
_routers_th.emplace (id, _make_router (_router_lookahead, _router_opts, _is_flat));
145
145
}
146
- return _routers_th.at (id);
146
+ return * _routers_th.at (id);
147
147
}
148
148
149
149
RouteIterResults& get_thread_results () {
0 commit comments