Skip to content

Commit f2783e2

Browse files
authored
Merge pull request #2337 from verilog-to-routing/par_router
This commit has a bunch of cleanups piggybacked onto the baseline parallel router: * Use RRNodeId where possible * Remove dead code and docs left from breadth-first router * Fix nondeterminism in parallel tatum * Fix performance penalty from NetPinTimingInvalidator
2 parents 9479f9d + 33e9014 commit f2783e2

File tree

92 files changed

+3215
-1817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3215
-1817
lines changed

abc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.3.0)
1+
cmake_minimum_required(VERSION 3.3.0...3.13) # ! This line is edited to get rid of a CMake deprecation error
22

33
include(CMakeParseArguments)
44
include(CheckCCompilerFlag)

doc/src/vpr/command_line_usage.rst

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ VPR uses a negotiated congestion algorithm (based on Pathfinder) to perform rout
11271127

11281128
* ``delay_normalized_length_frequency`` like ``delay_normalized``, but scaled by routing resource length and scaled inversely by routing resource frequency.
11291129

1130-
**Default:** ``delay_normalized_length`` for the timing-driven router and ``demand_only`` for the breadth-first router
1130+
**Default:** ``delay_normalized_length``
11311131

11321132
.. option:: --bend_cost <float>
11331133

@@ -1172,22 +1172,13 @@ VPR uses a negotiated congestion algorithm (based on Pathfinder) to perform rout
11721172

11731173
This option attempts to verify the minimum by routing at successively lower channel widths until two consecutive routing failures are observed.
11741174

1175-
.. option:: --router_algorithm {breadth_first | timing_driven}
1175+
.. option:: --router_algorithm {parallel | timing_driven}
11761176

11771177
Selects which router algorithm to use.
11781178

11791179
.. warning::
11801180

1181-
The ``breadth_first`` router **should NOT be used to compare the run-time/quality** of alternate routing algorithms.
1182-
1183-
It is inferrior to the ``timing_driven`` router from a circuit speed (2x - 10x slower) and run-time perspective (takes 10-100x longer on the large benchmarks).
1184-
The ``breadth_first`` router is deprecated and may be removed in a future release.
1185-
1186-
The ``breadth_first`` router :cite:`betz_arch_cad` focuses solely on routing a design successfully, while the ``timing_driven`` router :cite:`betz_arch_cad,murray_air` focuses both on achieving a successful route and achieving good circuit speed.
1187-
1188-
The breadth-first router is capable of routing a design using slightly fewer tracks than the timing-driving router (typically 5% if the timing-driven router uses its default parameters.
1189-
This can be reduced to about 2% if the router parameters are set so the timing-driven router pays more attention to routability and less to area).
1190-
The designs produced by the timing-driven router are much faster, however, (2x - 10x) and it uses less CPU time to route.
1181+
The ``parallel`` router is experimental. (TODO: more explanation)
11911182

11921183
**Default:** ``timing_driven``
11931184

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
cmake_minimum_required(VERSION 3.4)
1+
cmake_minimum_required(VERSION 3.4...3.13) # ! This line is edited to get rid of a CMake deprecation error
22
project("Cap'n Proto Root" CXX)
33
add_subdirectory(c++)

libs/EXTERNAL/capnproto/c++/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.4)
1+
cmake_minimum_required(VERSION 3.4...3.13) # ! This line is edited to get rid of a CMake deprecation error
22
project("Cap'n Proto" CXX)
33
set(VERSION 0.9.1)
44

libs/EXTERNAL/libargparse/argparse_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ int main(
399399
.show_in(argparse::ShowIn::HELP_ONLY);
400400
route_grp.add_argument(args.router_algorithm, "--router_algorithm")
401401
.help("Specifies the router algorithm to use.\n"
402-
" * breadth_first: focuses solely on routability\n"
402+
" * parallel: timing_driven with tricks to run on multiple cores (may be worse)\n"
403403
" * timing driven: focuses on routability and circuit speed\n")
404404
.default_value("timing_driven")
405-
.choices({"breadth_first", "timing_driven"})
405+
.choices({"parallel", "timing_driven"})
406406
.show_in(argparse::ShowIn::HELP_ONLY);
407407
route_grp.add_argument(args.min_incremental_reroute_fanout, "--min_incremental_reroute_fanout")
408408
.help("The net fanout thershold above which nets will be re-routed incrementally.")

libs/EXTERNAL/libtatum/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ cmake_minimum_required(VERSION 3.16)
22

33
project("tatum")
44

5-
# Parallel tatum gives non-deterministic results. Use serial by default until resolved
6-
set(TATUM_EXECUTION_ENGINE "serial" CACHE STRING "Specify the framework for (potential) parallel execution")
5+
set(TATUM_EXECUTION_ENGINE "auto" CACHE STRING "Specify the framework for (potential) parallel execution")
76
set_property(CACHE TATUM_EXECUTION_ENGINE PROPERTY STRINGS auto serial tbb)
87

98
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

libs/EXTERNAL/libtatum/libtatum/tatum/graph_walkers/SerialIncrWalker.hpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#pragma once
22
#include <algorithm>
3+
4+
#ifdef TATUM_USE_TBB
5+
#include <tbb/concurrent_vector.h>
6+
#endif
7+
38
#include "tatum/graph_walkers/TimingGraphWalker.hpp"
49
#include "tatum/TimingGraph.hpp"
510
#include "tatum/delay_calc/DelayCalculator.hpp"
@@ -431,9 +436,16 @@ class SerialIncrWalker : public TimingGraphWalker {
431436
t_incr_traversal_update incr_arr_update_;
432437
t_incr_traversal_update incr_req_update_;
433438

434-
//Set of invalidated edges, and bitset for membership
439+
/** Set of invalidated edges, and bitset for membership.
440+
* Use thread safe alternatives when TBB is on, since invalidate_edge_impl
441+
* may be called concurrently */
442+
#ifdef TATUM_USE_TBB
443+
tbb::concurrent_vector<EdgeId> invalidated_edges_;
444+
tatum::util::linear_map<EdgeId, size_t> edge_invalidated_;
445+
#else
435446
std::vector<EdgeId> invalidated_edges_;
436-
tatum::util::linear_map<EdgeId,bool> edge_invalidated_;
447+
tatum::util::linear_map<EdgeId, bool> edge_invalidated_;
448+
#endif
437449

438450
//Nodes which have been modified during timing update, and bitset for membership
439451
std::vector<NodeId> nodes_modified_;

libs/EXTERNAL/libtatum/libtatum/tatum/util/tatum_strong_id.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,22 +176,24 @@ class StrongId {
176176
//Default to the sentinel value
177177
constexpr StrongId() : id_(sentinel) {}
178178

179-
//Only allow explict constructions from a raw Id (no automatic conversions)
180-
explicit StrongId(T id) noexcept : id_(id) {}
179+
//Only allow explicit constructions from a raw Id (no automatic conversions)
180+
explicit constexpr StrongId(T id) noexcept : id_(id) {}
181181

182182
//Allow some explicit conversion to useful types
183183

184184
//Allow explicit conversion to bool (e.g. if(id))
185-
explicit operator bool() const { return *this != INVALID(); }
185+
explicit operator bool() const { return id_ != sentinel; }
186+
187+
/// @brief Another name for the bool cast
188+
constexpr bool is_valid() const { return id_ != sentinel; }
186189

187190
//Allow explicit conversion to size_t (e.g. my_vector[size_t(strong_id)])
188191
explicit operator std::size_t() const { return static_cast<std::size_t>(id_); }
189192

190-
191-
//To enable hasing Ids
193+
//To enable hashing Ids
192194
friend std::hash<StrongId<tag,T,sentinel>>;
193195

194-
//To enable comparisions between Ids
196+
//To enable comparisons between Ids
195197
// Note that since these are templated functions we provide an empty set of template parameters
196198
// after the function name (i.e. <>)
197199
friend bool operator== <>(const StrongId<tag,T,sentinel>& lhs, const StrongId<tag,T,sentinel>& rhs);

libs/librrgraph/src/base/check_rr_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ static void check_rr_edge(const RRGraphView& rr_graph,
608608
std::string msg = "Non-configurable BUFFER type switch must have only one driver. ";
609609
msg += vtr::string_fmt(" Actual fan-in was %d (expected 1).\n", to_fanin);
610610
msg += " Possible cause is complex block output pins connecting to:\n";
611-
msg += " " + describe_rr_node(rr_graph, grid, rr_indexed_data, to_node, is_flat);
611+
msg += " " + describe_rr_node(rr_graph, grid, rr_indexed_data, RRNodeId(to_node), is_flat);
612612
VPR_FATAL_ERROR(VPR_ERROR_ROUTE, msg.c_str());
613613
}
614614
break;

libs/librrgraph/src/base/rr_graph_fwd.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#ifndef RR_GRAPH_OBJ_FWD_H
22
#define RR_GRAPH_OBJ_FWD_H
3+
4+
#include <cstdint>
5+
36
#include "vtr_strong_id.h"
47

58
/***************************************************************
@@ -20,11 +23,11 @@ struct rr_switch_id_tag;
2023
struct rr_segment_id_tag;
2124
struct rc_index_tag;
2225

23-
typedef vtr::StrongId<rr_node_id_tag, unsigned int> RRNodeId;
24-
typedef vtr::StrongId<rr_edge_id_tag, unsigned int> RREdgeId;
25-
typedef vtr::StrongId<rr_indexed_data_id_tag, unsigned int> RRIndexedDataId;
26-
typedef vtr::StrongId<rr_switch_id_tag, short> RRSwitchId;
27-
typedef vtr::StrongId<rr_segment_id_tag, short> RRSegmentId;
28-
typedef vtr::StrongId<rc_index_tag, short> NodeRCIndex;
26+
typedef vtr::StrongId<rr_node_id_tag, uint32_t> RRNodeId;
27+
typedef vtr::StrongId<rr_edge_id_tag, uint32_t> RREdgeId;
28+
typedef vtr::StrongId<rr_indexed_data_id_tag, uint32_t> RRIndexedDataId;
29+
typedef vtr::StrongId<rr_switch_id_tag, uint16_t> RRSwitchId;
30+
typedef vtr::StrongId<rr_segment_id_tag, uint16_t> RRSegmentId;
31+
typedef vtr::StrongId<rc_index_tag, uint16_t> NodeRCIndex;
2932

3033
#endif

libs/librrgraph/src/utils/describe_rr_node.cpp

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,50 @@
44
#include "physical_types_util.h"
55
#include "vtr_util.h"
66

7-
/* TODO: This function should adapt RRNodeId */
87
std::string describe_rr_node(const RRGraphView& rr_graph,
98
const DeviceGrid& grid,
109
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
11-
int inode,
10+
RRNodeId inode,
1211
bool is_flat) {
1312

1413
std::string msg = vtr::string_fmt("RR node: %d", inode);
1514

16-
if (rr_graph.node_type(RRNodeId(inode)) == CHANX || rr_graph.node_type(RRNodeId(inode)) == CHANY) {
17-
auto cost_index = rr_graph.node_cost_index(RRNodeId(inode));
15+
if (rr_graph.node_type(inode) == CHANX || rr_graph.node_type(inode) == CHANY) {
16+
auto cost_index = rr_graph.node_cost_index(inode);
1817

1918
int seg_index = rr_indexed_data[cost_index].seg_index;
20-
std::string rr_node_direction_string = rr_graph.node_direction_string(RRNodeId(inode));
19+
std::string rr_node_direction_string = rr_graph.node_direction_string(inode);
2120

2221
if (seg_index < (int)rr_graph.num_rr_segments()) {
2322
msg += vtr::string_fmt(" track: %d longline: %d",
24-
rr_graph.node_track_num(RRNodeId(inode)),
23+
rr_graph.node_track_num(inode),
2524
rr_graph.rr_segments(RRSegmentId(seg_index)).longline);
2625
} else {
2726
msg += vtr::string_fmt(" track: %d seg_type: ILLEGAL_SEG_INDEX %d",
28-
rr_graph.node_track_num(RRNodeId(inode)),
27+
rr_graph.node_track_num(inode),
2928
seg_index);
3029
}
31-
} else if (rr_graph.node_type(RRNodeId(inode)) == IPIN || rr_graph.node_type(RRNodeId(inode)) == OPIN) {
32-
auto type = grid.get_physical_type({rr_graph.node_xlow(RRNodeId(inode)),
33-
rr_graph.node_ylow(RRNodeId(inode)),
34-
rr_graph.node_layer(RRNodeId(inode))});
30+
} else if (rr_graph.node_type(inode) == IPIN || rr_graph.node_type(inode) == OPIN) {
31+
auto type = grid.get_physical_type({rr_graph.node_xlow(inode),
32+
rr_graph.node_ylow(inode),
33+
rr_graph.node_layer(inode)});
3534

36-
std::string pin_name = block_type_pin_index_to_name(type, rr_graph.node_pin_num(RRNodeId(inode)), is_flat);
35+
std::string pin_name = block_type_pin_index_to_name(type, rr_graph.node_pin_num(inode), is_flat);
3736

3837
msg += vtr::string_fmt(" pin: %d pin_name: %s",
39-
rr_graph.node_pin_num(RRNodeId(inode)),
38+
rr_graph.node_pin_num(inode),
4039
pin_name.c_str());
4140
} else {
42-
VTR_ASSERT(rr_graph.node_type(RRNodeId(inode)) == SOURCE || rr_graph.node_type(RRNodeId(inode)) == SINK);
41+
VTR_ASSERT(rr_graph.node_type(inode) == SOURCE || rr_graph.node_type(inode) == SINK);
4342

44-
msg += vtr::string_fmt(" class: %d", rr_graph.node_class_num(RRNodeId(inode)));
43+
msg += vtr::string_fmt(" class: %d", rr_graph.node_class_num(inode));
4544
}
4645

47-
msg += vtr::string_fmt(" capacity: %d", rr_graph.node_capacity(RRNodeId(inode)));
48-
msg += vtr::string_fmt(" fan-in: %d", rr_graph.node_fan_in(RRNodeId(inode)));
49-
msg += vtr::string_fmt(" fan-out: %d", rr_graph.num_edges(RRNodeId(inode)));
46+
msg += vtr::string_fmt(" capacity: %d", rr_graph.node_capacity(inode));
47+
msg += vtr::string_fmt(" fan-in: %d", rr_graph.node_fan_in(inode));
48+
msg += vtr::string_fmt(" fan-out: %d", rr_graph.num_edges(inode));
5049

51-
msg += " " + rr_graph.node_coordinate_to_string(RRNodeId(inode));
50+
msg += " " + rr_graph.node_coordinate_to_string(inode);
5251

5352
return msg;
5453
}

libs/librrgraph/src/utils/describe_rr_node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
std::string describe_rr_node(const RRGraphView& rr_graph,
1010
const DeviceGrid& grid,
1111
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
12-
int inode,
12+
RRNodeId inode,
1313
bool is_flat);
1414

1515
#endif

libs/libvtrutil/src/vtr_range.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ template<typename T>
4141
class Range {
4242
public:
4343
///@brief constructor
44-
Range(T b, T e)
44+
constexpr Range(T b, T e)
4545
: begin_(b)
4646
, end_(e) {}
4747
///@brief Return an iterator to the start of the range
48-
T begin() { return begin_; }
48+
constexpr T begin() { return begin_; }
4949
///@brief Return an iterator to the end of the range
50-
T end() { return end_; }
50+
constexpr T end() { return end_; }
5151
///@brief Return an iterator to the start of the range (immutable)
52-
const T begin() const { return begin_; }
52+
constexpr const T begin() const { return begin_; }
5353
///@brief Return an iterator to the end of the range (immutable)
54-
const T end() const { return end_; }
54+
constexpr const T end() const { return end_; }
5555
///@brief Return true if empty
56-
bool empty() { return begin_ == end_; }
56+
constexpr bool empty() { return begin_ == end_; }
5757
///@brief Return the range size
58-
size_t size() { return std::distance(begin_, end_); }
58+
constexpr size_t size() { return std::distance(begin_, end_); }
5959

6060
private:
6161
T begin_;
@@ -72,13 +72,13 @@ class Range {
7272
* auto my_range = vtr::make_range(my_vec.begin(), my_vec.end());
7373
*/
7474
template<typename T>
75-
auto make_range(T b, T e) { return Range<T>(b, e); }
75+
constexpr auto make_range(T b, T e) { return Range<T>(b, e); }
7676

7777
/**
7878
* @brief Creates a vtr::Range from a container
7979
*/
8080
template<typename Container>
81-
auto make_range(const Container& c) { return make_range(std::begin(c), std::end(c)); }
81+
inline auto make_range(const Container& c) { return make_range(std::begin(c), std::end(c)); }
8282

8383
} // namespace vtr
8484

0 commit comments

Comments
 (0)