Skip to content

Commit 006675f

Browse files
committed
removed dead code and added the command line option to control 3D custom fanin fanout
1 parent 6ede692 commit 006675f

File tree

8 files changed

+40
-23
lines changed

8 files changed

+40
-23
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts)
481481
RouterOpts->generate_rr_node_overuse_report = Options.generate_rr_node_overuse_report;
482482
RouterOpts->flat_routing = Options.flat_routing;
483483
RouterOpts->has_choking_spot = Options.has_choking_spot;
484+
RouterOpts->custom_3d_sb_fanin_fanout = Options.custom_3d_sb_fanin_fanout;
484485
RouterOpts->with_timing_analysis = Options.timing_analysis;
485486
}
486487

vpr/src/base/read_options.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,13 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
24612461
.default_value("false")
24622462
.show_in(argparse::ShowIn::HELP_ONLY);
24632463

2464+
route_grp.add_argument(args.custom_3d_sb_fanin_fanout, "--custom_3d_sb_fanin_fanout")
2465+
.help(
2466+
"Specifies the number of tracks that can drive a 3D switch block connection"
2467+
"and the number of tracks that can be driven by a 3D switch block connection")
2468+
.default_value("1")
2469+
.show_in(argparse::ShowIn::HELP_ONLY);
2470+
24642471
auto& route_timing_grp = parser.add_argument_group("timing-driven routing options");
24652472

24662473
route_timing_grp.add_argument(args.astar_fac, "--astar_fac")

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ struct t_options {
202202
argparse::ArgValue<int> reorder_rr_graph_nodes_seed;
203203
argparse::ArgValue<bool> flat_routing;
204204
argparse::ArgValue<bool> has_choking_spot;
205+
argparse::ArgValue<int> custom_3d_sb_fanin_fanout;
205206

206207
/* Timing-driven router options only */
207208
argparse::ArgValue<float> astar_fac;

vpr/src/base/vpr_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,8 @@ struct t_router_opts {
14641464
bool flat_routing;
14651465
bool has_choking_spot;
14661466

1467+
int custom_3d_sb_fanin_fanout = 1;
1468+
14671469
bool with_timing_analysis;
14681470

14691471
// Options related to rr_node reordering, for testing and possible cache optimization

vpr/src/route/build_switchblocks.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,6 @@ struct t_switchblock_edge {
9292
short to_wire_layer;
9393
};
9494

95-
/**
96-
* @brief contains the required information to create extra length-0 RR nodes to model 3D custom switch blocks connections within the RR graph
97-
*
98-
* @from_tracks a vector containing source tracks ptc_num indices that are connected to the same destination track in above or below layer in multi-die FPGAs
99-
* @offset_to_extra_chanx_node index (max_chan_width + "offset_to_extra_chanx_node") to the correct length-0 RR node that all tracks in "from_tracks" should be connected to in RR graph.
100-
* @connected_to_dest this flag is used to avoid edge duplications while adding edges for all "from_tracks" RR nodes to the same node (length-0 RR node) in the destination layer
101-
*
102-
*/
103-
struct t_inter_die_switchblock_edge {
104-
std::vector<short> from_tracks;
105-
short offset_to_extra_chanx_node = -1;
106-
bool connected_to_dest = false;
107-
};
108-
10995
/* Switchblock connections are made as [x][y][from_side][to_side][from_wire_ind].
11096
* The Switchblock_Lookup class specifies these dimensions.
11197
* Furthermore, a source_wire at a given 5-d coordinate may connect to multiple destination wires so the value

vpr/src/route/rr_graph.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ static std::function<void(t_chan_width*)> alloc_and_load_rr_graph(RRGraphBuilder
198198
const t_chan_width& chan_width,
199199
const int wire_to_ipin_switch,
200200
const int wire_to_pin_between_dice_switch,
201+
const int custom_3d_sb_fanin_fanout,
201202
const int delayless_switch,
202203
const enum e_directionality directionality,
203204
bool* Fc_clipped,
@@ -482,6 +483,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
482483
t_rr_edge_info_set& des_3d_rr_edges_to_create,
483484
const int wire_to_ipin_switch,
484485
const int wire_to_pin_between_dice_switch,
486+
const int custom_3d_sb_fanin_fanout,
485487
const int delayless_switch,
486488
const enum e_directionality directionality);
487489

@@ -654,6 +656,7 @@ static void build_rr_graph(const t_graph_type graph_type,
654656
const int global_route_switch,
655657
const int wire_to_arch_ipin_switch,
656658
const int wire_to_pin_between_dice_switch,
659+
const int custom_3d_sb_fanin_fanout,
657660
const int delayless_switch,
658661
const float R_minW_nmos,
659662
const float R_minW_pmos,
@@ -749,6 +752,7 @@ void create_rr_graph(const t_graph_type graph_type,
749752
det_routing_arch->global_route_switch,
750753
det_routing_arch->wire_to_arch_ipin_switch,
751754
det_routing_arch->wire_to_arch_ipin_switch_between_dice,
755+
router_opts.custom_3d_sb_fanin_fanout,
752756
det_routing_arch->delayless_switch,
753757
det_routing_arch->R_minW_nmos,
754758
det_routing_arch->R_minW_pmos,
@@ -970,6 +974,7 @@ static void build_rr_graph(const t_graph_type graph_type,
970974
const int global_route_switch,
971975
const int wire_to_arch_ipin_switch,
972976
const int wire_to_pin_between_dice_switch,
977+
const int custom_3d_sb_fanin_fanout,
973978
const int delayless_switch,
974979
const float R_minW_nmos,
975980
const float R_minW_pmos,
@@ -1271,7 +1276,7 @@ static void build_rr_graph(const t_graph_type graph_type,
12711276
*/
12721277
if (grid.get_num_layers() > 1 && sb_type == CUSTOM) {
12731278
//keep how many nodes each switchblock requires for each x,y location
1274-
auto extra_nodes_per_switchblock = get_number_track_to_track_inter_die_conn(sb_conn_map, device_ctx.rr_graph_builder);
1279+
auto extra_nodes_per_switchblock = get_number_track_to_track_inter_die_conn(sb_conn_map,custom_3d_sb_fanin_fanout, device_ctx.rr_graph_builder);
12751280
//allocate new nodes in each switchblocks
12761281
alloc_and_load_inter_die_rr_node_indices(device_ctx.rr_graph_builder, &nodes_per_chan, grid, extra_nodes_per_switchblock, &num_rr_nodes);
12771282
device_ctx.rr_graph_builder.resize_nodes(num_rr_nodes);
@@ -1371,6 +1376,7 @@ static void build_rr_graph(const t_graph_type graph_type,
13711376
nodes_per_chan,
13721377
wire_to_arch_ipin_switch,
13731378
wire_to_pin_between_dice_switch,
1379+
custom_3d_sb_fanin_fanout,
13741380
delayless_switch,
13751381
directionality,
13761382
&Fc_clipped,
@@ -2034,6 +2040,7 @@ static std::function<void(t_chan_width*)> alloc_and_load_rr_graph(RRGraphBuilder
20342040
const t_chan_width& chan_width,
20352041
const int wire_to_ipin_switch,
20362042
const int wire_to_pin_between_dice_switch,
2043+
const int custom_3d_sb_fanin_fanout,
20372044
const int delayless_switch,
20382045
const enum e_directionality directionality,
20392046
bool* Fc_clipped,
@@ -2186,6 +2193,7 @@ static std::function<void(t_chan_width*)> alloc_and_load_rr_graph(RRGraphBuilder
21862193
rr_edges_to_create, des_3d_rr_edges_to_create,
21872194
wire_to_ipin_switch,
21882195
wire_to_pin_between_dice_switch,
2196+
custom_3d_sb_fanin_fanout,
21892197
delayless_switch,
21902198
directionality);
21912199

@@ -2206,6 +2214,7 @@ static std::function<void(t_chan_width*)> alloc_and_load_rr_graph(RRGraphBuilder
22062214
rr_edges_to_create, des_3d_rr_edges_to_create,
22072215
wire_to_ipin_switch,
22082216
wire_to_pin_between_dice_switch,
2217+
custom_3d_sb_fanin_fanout,
22092218
delayless_switch,
22102219
directionality);
22112220

@@ -3115,6 +3124,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
31153124
t_rr_edge_info_set& des_3d_rr_edges_to_create,
31163125
const int wire_to_ipin_switch,
31173126
const int wire_to_pin_between_dice_switch,
3127+
const int custom_3d_sb_fanin_fanout,
31183128
const int delayless_switch,
31193129
const enum e_directionality directionality) {
31203130
/* this function builds both x and y-directed channel segments, so set up our
@@ -3198,7 +3208,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
31983208
opposite_chan_type, seg_dimension, max_opposite_chan_width, grid,
31993209
Fs_per_side, sblock_pattern, num_of_3d_conns_custom_SB, node, rr_edges_to_create,
32003210
des_3d_rr_edges_to_create, from_seg_details, to_seg_details, opposite_chan_details,
3201-
directionality,delayless_switch,
3211+
directionality,custom_3d_sb_fanin_fanout,delayless_switch,
32023212
switch_block_conn, sb_conn_map);
32033213
}
32043214
}
@@ -3218,7 +3228,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
32183228
opposite_chan_type, seg_dimension, max_opposite_chan_width, grid,
32193229
Fs_per_side, sblock_pattern, num_of_3d_conns_custom_SB, node, rr_edges_to_create,
32203230
des_3d_rr_edges_to_create, from_seg_details, to_seg_details, opposite_chan_details,
3221-
directionality, delayless_switch, switch_block_conn, sb_conn_map);
3231+
directionality,custom_3d_sb_fanin_fanout, delayless_switch, switch_block_conn, sb_conn_map);
32223232
}
32233233
}
32243234

@@ -3250,7 +3260,7 @@ static void build_rr_chan(RRGraphBuilder& rr_graph_builder,
32503260
chan_type, seg_dimension, max_chan_width, grid,
32513261
Fs_per_side, sblock_pattern, num_of_3d_conns_custom_SB, node, rr_edges_to_create,
32523262
des_3d_rr_edges_to_create, from_seg_details, to_seg_details, from_chan_details,
3253-
directionality,delayless_switch,
3263+
directionality,custom_3d_sb_fanin_fanout, delayless_switch,
32543264
switch_block_conn, sb_conn_map);
32553265
}
32563266
}

vpr/src/route/rr_graph2.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ static void get_switchblocks_edges(RRGraphBuilder& rr_graph_builder,
126126
const int to_y,
127127
const t_rr_type to_chan_type,
128128
const int switch_override,
129+
const int custom_3d_sb_fanin_fanout,
129130
const int delayless_switch,
130131
t_sb_connection_map* sb_conn_map,
131132
vtr::NdMatrix<int, 2>& num_of_3d_conns_custom_SB,
@@ -163,6 +164,7 @@ static int get_track_to_chan_seg(RRGraphBuilder& rr_graph_builder,
163164
const e_side from_side,
164165
const e_side to_side,
165166
const int swtich_override,
167+
const int custom_3d_sb_fanin_fanout,
166168
const int delayless_switch,
167169
t_sb_connection_map* sb_conn_map,
168170
vtr::NdMatrix<int, 2>& num_of_3d_conns_custom_SB,
@@ -1245,6 +1247,7 @@ static bool check_3d_SB_RRnodes(RRGraphBuilder& rr_graph_builder, int x, int y,
12451247
}
12461248

12471249
vtr::NdMatrix<int, 2> get_number_track_to_track_inter_die_conn(t_sb_connection_map* sb_conn_map,
1250+
const int custom_3d_sb_fanin_fanout,
12481251
RRGraphBuilder& rr_graph_builder) {
12491252
auto& grid_ctx = g_vpr_ctx.device().grid;
12501253
vtr::NdMatrix<int, 2> extra_nodes_per_switchblocks;
@@ -1283,7 +1286,7 @@ vtr::NdMatrix<int, 2> get_number_track_to_track_inter_die_conn(t_sb_connection_m
12831286
}
12841287
}
12851288
}
1286-
extra_nodes_per_switchblocks[x][y] += ((num_of_3d_conn + 39)/ 40);
1289+
extra_nodes_per_switchblocks[x][y] += ((num_of_3d_conn + custom_3d_sb_fanin_fanout - 1)/ custom_3d_sb_fanin_fanout);
12871290
}
12881291
}
12891292
}
@@ -1924,6 +1927,7 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
19241927
const t_chan_seg_details* to_seg_details,
19251928
const t_chan_details& to_chan_details,
19261929
const enum e_directionality directionality,
1930+
const int custom_3d_sb_fanin_fanout,
19271931
const int delayless_switch,
19281932
const vtr::NdMatrix<std::vector<int>, 3>& switch_block_conn,
19291933
t_sb_connection_map* sb_conn_map) {
@@ -2056,7 +2060,7 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
20562060
if (Direction::DEC == from_seg_details[from_track].direction() || BI_DIRECTIONAL == directionality) {
20572061
num_conn += get_track_to_chan_seg(rr_graph_builder, layer, max_chan_width, from_track, to_chan, to_seg,
20582062
to_type, from_side_a, to_side,
2059-
switch_override, delayless_switch,
2063+
switch_override, custom_3d_sb_fanin_fanout, delayless_switch,
20602064
sb_conn_map, num_of_3d_conns_custom_SB, from_rr_node, rr_edges_to_create, des_3d_rr_edges_to_create);
20612065
}
20622066
} else {
@@ -2094,7 +2098,7 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
20942098
if (Direction::INC == from_seg_details[from_track].direction() || BI_DIRECTIONAL == directionality) {
20952099
num_conn += get_track_to_chan_seg(rr_graph_builder, layer, max_chan_width, from_track, to_chan, to_seg,
20962100
to_type, from_side_b, to_side,
2097-
switch_override,delayless_switch,
2101+
switch_override,custom_3d_sb_fanin_fanout, delayless_switch,
20982102
sb_conn_map, num_of_3d_conns_custom_SB, from_rr_node, rr_edges_to_create, des_3d_rr_edges_to_create);
20992103
}
21002104
} else {
@@ -2240,6 +2244,7 @@ static void get_switchblocks_edges(RRGraphBuilder& rr_graph_builder,
22402244
const int to_y,
22412245
const t_rr_type to_chan_type,
22422246
const int switch_override,
2247+
const int custom_3d_sb_fanin_fanout,
22432248
const int delayless_switch,
22442249
t_sb_connection_map* sb_conn_map,
22452250
vtr::NdMatrix<int, 2>& num_of_3d_conns_custom_SB,
@@ -2309,7 +2314,7 @@ static void get_switchblocks_edges(RRGraphBuilder& rr_graph_builder,
23092314
* +-------------+ +-------------+ +--------------+ +--------------+
23102315
*
23112316
* */
2312-
int offset = num_of_3d_conns_custom_SB[tile_x][tile_y] / 40;
2317+
int offset = num_of_3d_conns_custom_SB[tile_x][tile_y] / custom_3d_sb_fanin_fanout;
23132318
RRNodeId track_to_chanx_node = rr_graph_builder.node_lookup().find_node(layer, tile_x, tile_y, CHANX, max_chan_width + offset);
23142319
RRNodeId diff_layer_chanx_node = rr_graph_builder.node_lookup().find_node(to_layer, tile_x, tile_y, CHANX, max_chan_width + offset);
23152320
RRNodeId chanx_to_track_node = rr_graph_builder.node_lookup().find_node(to_layer, to_x, to_y, to_chan_type, to_wire);
@@ -2333,7 +2338,7 @@ static void get_switchblocks_edges(RRGraphBuilder& rr_graph_builder,
23332338
++edge_count;
23342339

23352340
//we only add the following edge between intermediate nodes once for the first 3D connection for each pair of intermediate nodes
2336-
if (num_of_3d_conns_custom_SB[tile_x][tile_y] % 40 == 0) {
2341+
if (num_of_3d_conns_custom_SB[tile_x][tile_y] % custom_3d_sb_fanin_fanout == 0) {
23372342
rr_edges_to_create.emplace_back(track_to_chanx_node, diff_layer_chanx_node, delayless_switch, false);
23382343
++edge_count;
23392344
}
@@ -2354,6 +2359,7 @@ static int get_track_to_chan_seg(RRGraphBuilder& rr_graph_builder,
23542359
const e_side from_side,
23552360
const e_side to_side,
23562361
const int switch_override,
2362+
const int custom_3d_sb_fanin_fanout,
23572363
const int delayless_switch,
23582364
t_sb_connection_map* sb_conn_map,
23592365
vtr::NdMatrix<int, 2>& num_of_3d_conns_custom_SB,
@@ -2393,6 +2399,7 @@ static int get_track_to_chan_seg(RRGraphBuilder& rr_graph_builder,
23932399
to_y,
23942400
to_chan_type,
23952401
switch_override,
2402+
custom_3d_sb_fanin_fanout,
23962403
delayless_switch,
23972404
sb_conn_map,
23982405
num_of_3d_conns_custom_SB,
@@ -2415,6 +2422,7 @@ static int get_track_to_chan_seg(RRGraphBuilder& rr_graph_builder,
24152422
to_y,
24162423
to_chan_type,
24172424
switch_override,
2425+
custom_3d_sb_fanin_fanout,
24182426
delayless_switch,
24192427
sb_conn_map,
24202428
num_of_3d_conns_custom_SB,

vpr/src/route/rr_graph2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ int get_rr_node_index(const t_rr_node_indices& L_rr_node_indices,
8787
* @return number of die-crossing connection for each unique (x, y) location within the grid ([0..grid.width-1][0..grid.height-1])
8888
*/
8989
vtr::NdMatrix<int, 2> get_number_track_to_track_inter_die_conn(t_sb_connection_map* sb_conn_map,
90+
const int custom_3d_sb_fanin_fanout,
9091
RRGraphBuilder& rr_graph_builder);
9192

9293
int find_average_rr_node_index(int device_width,
@@ -216,6 +217,7 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
216217
const t_chan_seg_details* to_seg_details,
217218
const t_chan_details& to_chan_details,
218219
const enum e_directionality directionality,
220+
const int custom_3d_sb_fanin_fanout,
219221
const int delayless_switch,
220222
const vtr::NdMatrix<std::vector<int>, 3>& switch_block_conn,
221223
t_sb_connection_map* sb_conn_map);

0 commit comments

Comments
 (0)