Skip to content

Commit 6b149fc

Browse files
[AP][Solver] Updated Comments in Solver
1 parent 5ec5909 commit 6b149fc

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

vpr/src/analytical_place/analytical_solver.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ void QPHybridSolver::store_solution_into_placement(const Eigen::VectorXd& x_soln
498498
void QPHybridSolver::update_net_weights(const PreClusterTimingManager& pre_cluster_timing_manager) {
499499
// For the quadratic solver, we use a basic net weighting scheme for adding
500500
// timing to the objective.
501+
//
502+
// NOTE: This is only for the quadratic solver, other solvers (like B2B) will
503+
// likely set these weights to something else.
501504

502505
// If the pre-cluster timing manager has not been initialized (i.e. timing
503506
// analysis is off), no need to update.
@@ -977,13 +980,9 @@ std::pair<double, double> B2BSolver::get_delay_derivative(APBlockId driver_blk,
977980
// the derivative to be the penalty for putting the driver and sink in different
978981
// tiles.
979982
if (tile_dx == 0) {
980-
VTR_ASSERT_SAFE_MSG(forward_difference_x == -1.0f * backward_difference_x,
981-
"Delay model expected to be symmetric");
982983
d_delay_x = forward_difference_x;
983984
}
984985
if (tile_dy == 0) {
985-
VTR_ASSERT_SAFE_MSG(forward_difference_y == -1.0f * backward_difference_y,
986-
"Delay model expected to be symmetric");
987986
d_delay_y = forward_difference_y;
988987
}
989988

@@ -996,7 +995,7 @@ std::pair<double, double> B2BSolver::get_delay_normalization_facs(APBlockId driv
996995
// tile. This should be able to remove the units without changing the value
997996
// too much.
998997

999-
// Similar to calcuting the derivative, we want to use the legalized position
998+
// Similar to calculating the derivative, we want to use the legalized position
1000999
// of the driver block to try and estimate the delay from that block type.
10011000
t_physical_tile_loc driver_block_loc(block_x_locs_legalized[driver_blk],
10021001
block_y_locs_legalized[driver_blk],
@@ -1053,6 +1052,8 @@ void B2BSolver::init_linear_system(PartialPlacement& p_placement, unsigned itera
10531052
// ====================================================================
10541053
// Wirelength Connections
10551054
// ====================================================================
1055+
// In the objective there is are wirelength connections and timing
1056+
// connections, trade-off between the weight of each type of connection.
10561057
double wl_net_w = (1.0f - ap_timing_tradeoff_) * net_weights_[net_id];
10571058

10581059
// Find the bounding blocks
@@ -1087,15 +1088,13 @@ void B2BSolver::init_linear_system(PartialPlacement& p_placement, unsigned itera
10871088
// positions to compute the delay derivative, which do not exist until
10881089
// the next iteration. Its fine to do one wirelength driven iteration first.
10891090
if (pre_cluster_timing_manager_.is_valid() && iteration != 0) {
1090-
// Create connections from each driver pin to each of its sink pins.
1091+
// Create connections from each driver pin to each of it's sink pins.
10911092
// This will incentivize shrinking the distance from drivers to sinks
10921093
// of connections which would improve the timing.
10931094
APPinId driver_pin = netlist_.net_driver(net_id);
10941095
APBlockId driver_blk = netlist_.pin_block(driver_pin);
1095-
for (APPinId net_pin : netlist_.net_pins(net_id)) {
1096-
if (net_pin == driver_pin)
1097-
continue;
1098-
APBlockId sink_blk = netlist_.pin_block(net_pin);
1096+
for (APPinId sink_pin : netlist_.net_sinks(net_id)) {
1097+
APBlockId sink_blk = netlist_.pin_block(sink_pin);
10991098

11001099
// Get the instantaneous derivative of delay at the given distance
11011100
// from driver to sink. This will provide a value which is higher
@@ -1113,26 +1112,27 @@ void B2BSolver::init_linear_system(PartialPlacement& p_placement, unsigned itera
11131112
// TODO: If this is negative, it means that the sink should try to move
11141113
// away from the driver. Perhaps add an anchor point to pull the
11151114
// sink away.
1116-
if (d_delay_x < 0)
1117-
d_delay_x = 0;
1118-
if (d_delay_y < 0)
1119-
d_delay_y = 0;
1115+
d_delay_x = std::max(d_delay_x, 0.0);
1116+
d_delay_y = std::max(d_delay_y, 0.0);
11201117

1121-
// The units for delay is in seconds; however the units for
1122-
// the wirelength term is in tile. To ensure the units match,
1118+
// The units for delay are in seconds; however the units for
1119+
// the wirelength term are in tiles. To ensure the units match,
11231120
// we need to normalize away the time units. Get normalization
11241121
// factors to remove the time units.
11251122
auto [delay_x_norm, delay_y_norm] = get_delay_normalization_facs(driver_blk);
11261123

11271124
// Get the criticality of this timing edge from driver to sink.
1128-
double crit = pre_cluster_timing_manager_.get_timing_info().setup_pin_criticality(netlist_.pin_atom_pin(net_pin));
1125+
double crit = pre_cluster_timing_manager_.get_timing_info().setup_pin_criticality(netlist_.pin_atom_pin(sink_pin));
11291126

11301127
// Set the weight of the connection from driver to sink equal to:
11311128
// weight_tradeoff_terms * (1 + crit) * d_delay * delay_norm
11321129
// The intuition is that we want the solver to shrink the distance
11331130
// from drivers to sinks (which would improve timing) for edges
11341131
// with the best tradeoff between delay and wire, with a focus
11351132
// on the more critical edges.
1133+
// The ap_timing_tradeoff serves to trade-off between the wirelength
1134+
// and timing net weights. The net weights are the general net weights
1135+
// based on prior knowledge about the nets.
11361136
double timing_net_w = ap_timing_tradeoff_ * net_weights_[net_id] * timing_slope_fac_ * (1.0 + crit);
11371137

11381138
add_connection_to_system(driver_blk, sink_blk,

vpr/src/analytical_place/analytical_solver.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,9 @@ class B2BSolver : public AnalyticalSolver {
602602
* and sink pair.
603603
*
604604
* The instantaneous derivative gives the amount delay would increase or
605-
* decrease for a change in distance. This is passed into the objective
606-
* function to help guide the solver to trading off timing and wirelength.
605+
* decrease for a change in distance by one unit. This is passed into the
606+
* objective function to help guide the solver to trading off timing and
607+
* wirelength.
607608
*
608609
* @param driver_blk
609610
* The driver block for the edge to get the derivative of.
@@ -707,8 +708,8 @@ class B2BSolver : public AnalyticalSolver {
707708
/// edges in the graph.
708709
const PreClusterTimingManager& pre_cluster_timing_manager_;
709710

710-
/// @breif The place delay model used for calculating the delay between
711-
/// to tiles on the FPGA. Used for computing the timing terms.
711+
/// @brief The place delay model used for calculating the delay between
712+
/// two tiles on the FPGA. Used for computing the timing terms.
712713
std::shared_ptr<PlaceDelayModel> place_delay_model_;
713714
};
714715

0 commit comments

Comments
 (0)