Skip to content

Commit 650a1b9

Browse files
committed
vpr: Use double for placer point-to-point timing cost and net costs
This reduces round-off errors during cost comparisons.
1 parent 53d2620 commit 650a1b9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vpr/src/place/place.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ constexpr double MAX_INV_TIMING_COST = 1.e9;
129129
/********************** Variables local to place.c ***************************/
130130

131131
/* Cost of a net, and a temporary cost of a net used during move assessment. */
132-
static vtr::vector<ClusterNetId, float> net_cost, temp_net_cost;
132+
static vtr::vector<ClusterNetId, double> net_cost, temp_net_cost;
133133

134134
static t_pl_loc** legal_pos = nullptr; /* [0..device_ctx.num_block_types-1][0..type_tsize - 1] */
135135
static int* num_legal_pos = nullptr; /* [0..num_legal_pos-1] */
@@ -152,8 +152,8 @@ static vtr::vector<ClusterNetId, char> bb_updated_before;
152152
/* driven portion of the cost function. These arrays will be set to */
153153
/* (criticality * delay) for each point to point connection. */
154154

155-
static vtr::vector<ClusterNetId, float*> point_to_point_timing_cost;
156-
static vtr::vector<ClusterNetId, float*> temp_point_to_point_timing_cost;
155+
static vtr::vector<ClusterNetId, double*> point_to_point_timing_cost;
156+
static vtr::vector<ClusterNetId, double*> temp_point_to_point_timing_cost;
157157

158158
/* [0..cluster_ctx.clb_nlist.nets().size()-1][1..num_pins-1]. What is the value of the delay */
159159
/* for each connection in the circuit */
@@ -388,7 +388,7 @@ static void record_affected_net(const ClusterNetId net, int& num_affected_nets);
388388
static void update_net_bb(const ClusterNetId net, int iblk, const ClusterBlockId blk, const ClusterPinId blk_pin);
389389
static void update_td_delta_costs(const PlaceDelayModel& delay_model, const ClusterNetId net, const ClusterPinId pin, double& delta_timing_cost);
390390

391-
static float get_net_cost(ClusterNetId net_id, t_bb* bb_ptr);
391+
static double get_net_cost(ClusterNetId net_id, t_bb* bb_ptr);
392392

393393
static void get_bb_from_scratch(ClusterNetId net_id, t_bb* coords, t_bb* num_on_edges);
394394

@@ -2442,10 +2442,10 @@ static void alloc_and_load_placement_structs(float place_cost_exp,
24422442
temp_point_to_point_delay[net_id] = (float*)vtr::malloc(num_sinks * sizeof(float));
24432443
temp_point_to_point_delay[net_id]--;
24442444

2445-
point_to_point_timing_cost[net_id] = (float*)vtr::malloc(num_sinks * sizeof(float));
2445+
point_to_point_timing_cost[net_id] = (double*)vtr::malloc(num_sinks * sizeof(double));
24462446
point_to_point_timing_cost[net_id]--;
24472447

2448-
temp_point_to_point_timing_cost[net_id] = (float*)vtr::malloc(num_sinks * sizeof(float));
2448+
temp_point_to_point_timing_cost[net_id] = (double*)vtr::malloc(num_sinks * sizeof(double));
24492449
temp_point_to_point_timing_cost[net_id]--;
24502450
}
24512451
for (auto net_id : cluster_ctx.clb_nlist.nets()) {
@@ -2738,11 +2738,11 @@ static double get_net_wirelength_estimate(ClusterNetId net_id, t_bb* bbptr) {
27382738
return (ncost);
27392739
}
27402740

2741-
static float get_net_cost(ClusterNetId net_id, t_bb* bbptr) {
2741+
static double get_net_cost(ClusterNetId net_id, t_bb* bbptr) {
27422742
/* Finds the cost due to one net by looking at its coordinate bounding *
27432743
* box. */
27442744

2745-
float ncost, crossing;
2745+
double ncost, crossing;
27462746
auto& cluster_ctx = g_vpr_ctx.clustering();
27472747

27482748
/* Get the expected "crossing count" of a net, based on its number *

0 commit comments

Comments
 (0)