Skip to content

Commit 42829ed

Browse files
authored
Merge branch 'master' into openfpga
2 parents 51bd666 + 6405610 commit 42829ed

13 files changed

+42
-17
lines changed

doc/src/vpr/command_line_usage.rst

+9
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,15 @@ The following options are only valid when the router is in timing-driven mode (t
13061306

13071307
**Default:** ``1.2``
13081308

1309+
.. option:: --astar_offset <float>
1310+
1311+
Sets how aggressive the directed search used by the timing-driven router is.
1312+
It is a subtractive adjustment to the lookahead heuristic.
1313+
1314+
Values between 0 and 1e-9 are resonable; higher values may increase quality at the expense of run-time.
1315+
1316+
**Default:** ``0.0``
1317+
13091318
.. option:: --router_profiler_astar_fac <float>
13101319

13111320
Controls the directedness of the timing-driven router's exploration when doing router delay profiling of an architecture.

vpr/src/base/SetupVPR.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ static void SetupRoutingArch(const t_arch& Arch,
434434
static void SetupRouterOpts(const t_options& Options, t_router_opts* RouterOpts) {
435435
RouterOpts->do_check_rr_graph = Options.check_rr_graph;
436436
RouterOpts->astar_fac = Options.astar_fac;
437+
RouterOpts->astar_offset = Options.astar_offset;
437438
RouterOpts->router_profiler_astar_fac = Options.router_profiler_astar_fac;
438439
RouterOpts->bb_factor = Options.bb_factor;
439440
RouterOpts->criticality_exp = Options.criticality_exp;

vpr/src/base/ShowSetup.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ static void ShowRouterOpts(const t_router_opts& RouterOpts) {
382382

383383
if (TIMING_DRIVEN == RouterOpts.router_algorithm) {
384384
VTR_LOG("RouterOpts.astar_fac: %f\n", RouterOpts.astar_fac);
385+
VTR_LOG("RouterOpts.astar_offset: %f\n", RouterOpts.astar_offset);
385386
VTR_LOG("RouterOpts.router_profiler_astar_fac: %f\n", RouterOpts.router_profiler_astar_fac);
386387
VTR_LOG("RouterOpts.criticality_exp: %f\n", RouterOpts.criticality_exp);
387388
VTR_LOG("RouterOpts.max_criticality: %f\n", RouterOpts.max_criticality);

vpr/src/base/read_options.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -2499,6 +2499,14 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
24992499
.default_value("1.2")
25002500
.show_in(argparse::ShowIn::HELP_ONLY);
25012501

2502+
route_timing_grp.add_argument(args.astar_offset, "--astar_offset")
2503+
.help(
2504+
"Controls the directedness of the timing-driven router's exploration."
2505+
" It is a subtractive adjustment to the lookahead heuristic."
2506+
" Values between 0 and 1e-9 are resonable; higher values may increase quality at the expense of run-time.")
2507+
.default_value("0.0")
2508+
.show_in(argparse::ShowIn::HELP_ONLY);
2509+
25022510
route_timing_grp.add_argument(args.router_profiler_astar_fac, "--router_profiler_astar_fac")
25032511
.help(
25042512
"Controls the directedness of the timing-driven router's exploration"

vpr/src/base/read_options.h

+1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ struct t_options {
220220

221221
/* Timing-driven router options only */
222222
argparse::ArgValue<float> astar_fac;
223+
argparse::ArgValue<float> astar_offset;
223224
argparse::ArgValue<float> router_profiler_astar_fac;
224225
argparse::ArgValue<float> max_criticality;
225226
argparse::ArgValue<float> criticality_exp;

vpr/src/base/vpr_types.h

+3
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,8 @@ struct t_placer_opts {
13431343
* an essentially breadth-first search, astar_fac = 1 is near *
13441344
* the usual astar algorithm and astar_fac > 1 are more *
13451345
* aggressive. *
1346+
* astar_offset: Offset that is subtracted from the lookahead (expected *
1347+
* future costs) in the timing-driven router. *
13461348
* max_criticality: The maximum criticality factor (from 0 to 1) any sink *
13471349
* will ever have (i.e. clip criticality to this number). *
13481350
* criticality_exp: Set criticality to (path_length(sink) / longest_path) ^ *
@@ -1433,6 +1435,7 @@ struct t_router_opts {
14331435
enum e_router_algorithm router_algorithm;
14341436
enum e_base_cost_type base_cost_type;
14351437
float astar_fac;
1438+
float astar_offset;
14361439
float router_profiler_astar_fac;
14371440
float max_criticality;
14381441
float criticality_exp;

vpr/src/place/timing_place_lookup.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,8 @@ void OverrideDelayModel::compute_override_delay_model(
11901190
RouterDelayProfiler& route_profiler,
11911191
const t_router_opts& router_opts) {
11921192
t_router_opts router_opts2 = router_opts;
1193-
router_opts2.astar_fac = 0.;
1193+
router_opts2.astar_fac = 0.f;
1194+
router_opts2.astar_offset = 0.f;
11941195

11951196
//Look at all the direct connections that exist, and add overrides to delay model
11961197
auto& device_ctx = g_vpr_ctx.device();

vpr/src/route/connection_router.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "connection_router.h"
2-
#include "rr_graph.h"
32

3+
#include <algorithm>
4+
#include "rr_graph.h"
45
#include "binary_heap.h"
56
#include "four_ary_heap.h"
67
#include "bucket.h"
@@ -660,8 +661,8 @@ float ConnectionRouter<Heap>::compute_node_cost_using_rcv(const t_conn_cost_para
660661
float expected_total_delay_cost;
661662
float expected_total_cong_cost;
662663

663-
float expected_total_cong = cost_params.astar_fac * expected_cong + backwards_cong;
664-
float expected_total_delay = cost_params.astar_fac * expected_delay + backwards_delay;
664+
float expected_total_cong = expected_cong + backwards_cong;
665+
float expected_total_delay = expected_delay + backwards_delay;
665666

666667
//If budgets specified calculate cost as described by RCV paper:
667668
// R. Fung, V. Betz and W. Chow, "Slack Allocation and Routing to Improve FPGA Timing While
@@ -813,7 +814,7 @@ void ConnectionRouter<Heap>::evaluate_timing_driven_node_costs(t_heap* to,
813814
rr_node_arch_name(target_node, is_flat_).c_str(),
814815
describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, target_node, is_flat_).c_str(),
815816
expected_cost, to->R_upstream);
816-
total_cost += to->backward_path_cost + cost_params.astar_fac * expected_cost;
817+
total_cost += to->backward_path_cost + cost_params.astar_fac * std::max(0.f, expected_cost - cost_params.astar_offset);
817818
}
818819
to->cost = total_cost;
819820
}
@@ -905,12 +906,8 @@ void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
905906

906907
if (!rcv_path_manager.is_enabled()) {
907908
// tot_cost = backward_path_cost + cost_params.astar_fac * expected_cost;
908-
float tot_cost = backward_path_cost
909-
+ cost_params.astar_fac
910-
* router_lookahead_.get_expected_cost(inode,
911-
target_node,
912-
cost_params,
913-
R_upstream);
909+
float expected_cost = router_lookahead_.get_expected_cost(inode, target_node, cost_params, R_upstream);
910+
float tot_cost = backward_path_cost + cost_params.astar_fac * std::max(0.f, expected_cost - cost_params.astar_offset);
914911
VTR_LOGV_DEBUG(router_debug_, " Adding node %8d to heap from init route tree with cost %g (%s)\n",
915912
inode,
916913
tot_cost,

vpr/src/route/connection_router_interface.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct t_conn_delay_budget {
2323
struct t_conn_cost_params {
2424
float criticality = 1.;
2525
float astar_fac = 1.2;
26+
float astar_offset = 0.f;
2627
float bend_cost = 1.;
2728
float pres_fac = 1.;
2829
const t_conn_delay_budget* delay_budget = nullptr;

vpr/src/route/route_net.tpp

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ inline NetResultFlags route_net(ConnectionRouter& router,
139139
t_conn_delay_budget conn_delay_budget;
140140
t_conn_cost_params cost_params;
141141
cost_params.astar_fac = router_opts.astar_fac;
142+
cost_params.astar_offset = router_opts.astar_offset;
142143
cost_params.bend_cost = router_opts.bend_cost;
143144
cost_params.pres_fac = pres_fac;
144145
cost_params.delay_budget = ((budgeting_inf.if_set()) ? &conn_delay_budget : nullptr);

vpr/src/route/router_delay_profiling.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ bool RouterDelayProfiler::calculate_delay(RRNodeId source_node,
9595
t_conn_cost_params cost_params;
9696
cost_params.criticality = 1.;
9797
cost_params.astar_fac = router_opts.router_profiler_astar_fac;
98+
cost_params.astar_offset = router_opts.astar_offset;
9899
cost_params.bend_cost = router_opts.bend_cost;
99100

100101
route_budgets budgeting_inf(net_list_, is_flat_);
@@ -164,6 +165,7 @@ vtr::vector<RRNodeId, float> calculate_all_path_delays_from_rr_node(RRNodeId src
164165
t_conn_cost_params cost_params;
165166
cost_params.criticality = 1.;
166167
cost_params.astar_fac = router_opts.astar_fac;
168+
cost_params.astar_offset = router_opts.astar_offset;
167169
cost_params.bend_cost = router_opts.bend_cost;
168170
/* This function is called during placement. Thus, the flat routing option should be disabled. */
169171
//TODO: Placement is run with is_flat=false. However, since is_flat is passed, det_routing_arch should

vpr/test/test_connection_router.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ static float do_one_route(RRNodeId source_node,
4141
t_conn_cost_params cost_params;
4242
cost_params.criticality = router_opts.max_criticality;
4343
cost_params.astar_fac = router_opts.astar_fac;
44+
cost_params.astar_offset = router_opts.astar_offset;
4445
cost_params.bend_cost = router_opts.bend_cost;
4546

4647
const Netlist<>& net_list = is_flat ? (const Netlist<>&)g_vpr_ctx.atom().nlist : (const Netlist<>&)g_vpr_ctx.clustering().clb_nlist;

vtr_flow/arch/ispd/ultrascale_ispd.xml

+5-6
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,11 @@
504504
</pb_type>
505505
<interconnect>
506506
<!-- Fracturable LUT connectivity: Based on Fig 3-1 of 'UltraScale Architecture CLB User Guide' UG574 (v1.5) -->
507-
<!-- UPDATED based on known legal external ISPD placements -->
508-
<complete name="I0" input="LUT6_2.I0" output="LUTX[0].I0 LUTX[1].I0 LUTX[0].I1 LUTX[1].I1 LUTX[0].I2 LUTX[1].I2 LUTX[0].I3 LUTX[1].I3 LUTX[0].I4 LUTX[1].I4"/>
509-
<complete name="I1" input="LUT6_2.I1" output="LUTX[0].I0 LUTX[1].I0 LUTX[0].I1 LUTX[1].I1 LUTX[0].I2 LUTX[1].I2 LUTX[0].I3 LUTX[1].I3 LUTX[0].I4 LUTX[1].I4"/>
510-
<complete name="I2" input="LUT6_2.I2" output="LUTX[0].I0 LUTX[1].I0 LUTX[0].I1 LUTX[1].I1 LUTX[0].I2 LUTX[1].I2 LUTX[0].I3 LUTX[1].I3 LUTX[0].I4 LUTX[1].I4"/>
511-
<complete name="I3" input="LUT6_2.I3" output="LUTX[0].I0 LUTX[1].I0 LUTX[0].I1 LUTX[1].I1 LUTX[0].I2 LUTX[1].I2 LUTX[0].I3 LUTX[1].I3 LUTX[0].I4 LUTX[1].I4"/>
512-
<complete name="I4" input="LUT6_2.I4" output="LUTX[0].I0 LUTX[1].I0 LUTX[0].I1 LUTX[1].I1 LUTX[0].I2 LUTX[1].I2 LUTX[0].I3 LUTX[1].I3 LUTX[0].I4 LUTX[1].I4"/>
507+
<direct name="I0" input="LUT6_2.I0" output="LUTX[0].I0 LUTX[1].I0"/>
508+
<direct name="I1" input="LUT6_2.I1" output="LUTX[0].I1 LUTX[1].I1"/>
509+
<direct name="I2" input="LUT6_2.I2" output="LUTX[0].I2 LUTX[1].I2"/>
510+
<direct name="I3" input="LUT6_2.I3" output="LUTX[0].I3 LUTX[1].I3"/>
511+
<direct name="I4" input="LUT6_2.I4" output="LUTX[0].I4 LUTX[1].I4"/>
513512
<direct name="O6" input="LUTX[0].O" output="LUT6_2.O6"/>
514513
<direct name="O5" input="LUTX[1].O" output="LUT6_2.O5"/>
515514
</interconnect>

0 commit comments

Comments
 (0)